Ejemplo n.º 1
0
        private static void ConfigureGlobalActivity(int globalActivityLifetimeMS, int rollupActivityCycleCount)
        {
            Timer timer = ActivityContext.globalScopeTimer;

            ActivityContext.globalActivityLifetime = globalActivityLifetimeMS;
            ActivityContext.rollupActivityCycle    = rollupActivityCycleCount;
            ActivityContext.IsGlobalScopeEnabled   = (globalActivityLifetimeMS != -1);
            if (ActivityContext.IsGlobalScopeEnabled)
            {
                ActivityContext.OnGlobalActivityTimer(null);
                ActivityContext.globalScopeTimer = new Timer(new TimerCallback(ActivityContext.OnGlobalActivityTimer), null, ActivityContext.globalActivityLifetime, ActivityContext.globalActivityLifetime);
            }
            ActivityCoverageReport.Configure(globalActivityLifetimeMS, rollupActivityCycleCount);
            if (timer != null)
            {
                timer.Dispose();
            }
        }
Ejemplo n.º 2
0
 private static void LogGlobalInactive()
 {
     try
     {
         ActivityScope activityScope = ActivityContext.inactiveGlobalScope;
         if (activityScope != null && activityScope.Status == ActivityContextStatus.ActivityStarted)
         {
             ActivityContext.SetThreadScope(activityScope);
             ActivityCoverageReport.OnGlobalActivityEnded(activityScope);
             activityScope.ActivityScopeImpl.RemoveInstrInstances();
             activityScope.End();
             ActivityContext.inactiveGlobalScope = null;
         }
     }
     finally
     {
         ActivityContext.ClearThreadScope();
     }
 }