Пример #1
0
 public static void OnGlobalActivityEnded(ActivityScope globalActivityScope)
 {
     if (!ActivityCoverageReport.IsReportEnabled || globalActivityScope.ActivityType != ActivityType.Global)
     {
         return;
     }
     foreach (KeyValuePair <OperationKey, OperationStatistics> keyValuePair in globalActivityScope.Statistics)
     {
         OperationStatistics operationStatistics = null;
         if (ActivityCoverageReport.statistics.TryGetValue(keyValuePair.Key, out operationStatistics))
         {
             operationStatistics.Merge(keyValuePair.Value);
         }
         else
         {
             ActivityCoverageReport.statistics[keyValuePair.Key] = keyValuePair.Value;
         }
     }
     ActivityCoverageReport.currentActivityCycleCount++;
     if (ActivityCoverageReport.currentActivityCycleCount == ActivityCoverageReport.rollupActivityCycleCount)
     {
         ActivityCoverageReport.LogReport();
         ActivityCoverageReport.Clear();
     }
 }
Пример #2
0
        private static string GetAppName()
        {
            Process currentProcess = Process.GetCurrentProcess();
            string  text           = ActivityCoverageReport.GetAppPoolName(currentProcess);

            if (text == null)
            {
                text = AppDomain.CurrentDomain.FriendlyName;
            }
            if (text == null)
            {
                text = "Unknown";
            }
            return(text);
        }
Пример #3
0
        private static void LogReport()
        {
            Process currentProcess = Process.GetCurrentProcess();
            string  processName    = currentProcess.ProcessName;

            if (ActivityCoverageReport.statistics.Count > 0)
            {
                ActivityCoverageReport.TryLogActivityRollupReportWithUsageEvent(new object[]
                {
                    processName,
                    ActivityCoverageReport.CachedAppName,
                    ActivityCoverageReport.rollupTime,
                    LogRowFormatter.FormatCollection(ActivityScopeImpl.GetFormattableStatistics(ActivityCoverageReport.statistics))
                });
                return;
            }
            ActivityCoverageReport.TryLogActivityRollupReportWithNoUsageEvent(new object[]
            {
                processName,
                ActivityCoverageReport.CachedAppName,
                ActivityCoverageReport.rollupTime
            });
        }
Пример #4
0
 public static void Configure(int globalActivityLifetimeMS, int rollupActivityCycleCount)
 {
     ActivityCoverageReport.rollupActivityCycleCount = rollupActivityCycleCount;
     ActivityCoverageReport.rollupTime = new TimeSpan(0, 0, 0, 0, rollupActivityCycleCount * globalActivityLifetimeMS);
     ActivityCoverageReport.Clear();
 }