Ejemplo n.º 1
0
 internal static void TraceOperationCreation(CausalityTraceLevel traceLevel, int taskId, string operationName, ulong relatedContext)
 {
     try
     {
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.ETW) != (AsyncCausalityTracer.Loggers) 0)
         {
             TplEtwProvider.Log.TraceOperationBegin(taskId, operationName, (long)relatedContext);
         }
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.CausalityTracer) != (AsyncCausalityTracer.Loggers) 0)
         {
             AsyncCausalityTracer.s_TracerFactory.TraceOperationCreation((CausalityTraceLevel)traceLevel, CausalitySource.Library, AsyncCausalityTracer.s_PlatformId, AsyncCausalityTracer.GetOperationId((uint)taskId), operationName, relatedContext);
         }
     }
     catch (Exception ex)
     {
         AsyncCausalityTracer.LogAndDisable(ex);
     }
 }
Ejemplo n.º 2
0
 internal static void TraceSynchronousWorkCompletion(CausalityTraceLevel traceLevel, CausalitySynchronousWork work)
 {
     try
     {
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.ETW) != (AsyncCausalityTracer.Loggers) 0)
         {
             TplEtwProvider.Log.TraceSynchronousWorkEnd(work);
         }
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.CausalityTracer) != (AsyncCausalityTracer.Loggers) 0)
         {
             AsyncCausalityTracer.s_TracerFactory.TraceSynchronousWorkCompletion((CausalityTraceLevel)traceLevel, CausalitySource.Library, (CausalitySynchronousWork)work);
         }
     }
     catch (Exception ex)
     {
         AsyncCausalityTracer.LogAndDisable(ex);
     }
 }
Ejemplo n.º 3
0
 internal static void TraceSynchronousWorkStart(CausalityTraceLevel traceLevel, int taskId, CausalitySynchronousWork work)
 {
     try
     {
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.ETW) != (AsyncCausalityTracer.Loggers) 0)
         {
             TplEtwProvider.Log.TraceSynchronousWorkBegin(taskId, work);
         }
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.CausalityTracer) != (AsyncCausalityTracer.Loggers) 0)
         {
             AsyncCausalityTracer.s_TracerFactory.TraceSynchronousWorkStart((CausalityTraceLevel)traceLevel, CausalitySource.Library, AsyncCausalityTracer.s_PlatformId, AsyncCausalityTracer.GetOperationId((uint)taskId), (CausalitySynchronousWork)work);
         }
     }
     catch (Exception ex)
     {
         AsyncCausalityTracer.LogAndDisable(ex);
     }
 }
Ejemplo n.º 4
0
 internal static void TraceOperationRelation(CausalityTraceLevel traceLevel, int taskId, CausalityRelation relation)
 {
     try
     {
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.ETW) != (AsyncCausalityTracer.Loggers) 0)
         {
             TplEtwProvider.Log.TraceOperationRelation(taskId, relation);
         }
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.CausalityTracer) != (AsyncCausalityTracer.Loggers) 0)
         {
             AsyncCausalityTracer.s_TracerFactory.TraceOperationRelation((CausalityTraceLevel)traceLevel, CausalitySource.Library, AsyncCausalityTracer.s_PlatformId, AsyncCausalityTracer.GetOperationId((uint)taskId), (CausalityRelation)relation);
         }
     }
     catch (Exception ex)
     {
         AsyncCausalityTracer.LogAndDisable(ex);
     }
 }
Ejemplo n.º 5
0
 internal static void TraceOperationCompletion(CausalityTraceLevel traceLevel, int taskId, AsyncCausalityStatus status)
 {
     try
     {
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.ETW) != (AsyncCausalityTracer.Loggers) 0)
         {
             TplEtwProvider.Log.TraceOperationEnd(taskId, status);
         }
         if ((AsyncCausalityTracer.f_LoggingOn & AsyncCausalityTracer.Loggers.CausalityTracer) == (AsyncCausalityTracer.Loggers) 0)
         {
             return;
         }
         AsyncCausalityTracer.s_TracerFactory.TraceOperationCompletion((Windows.Foundation.Diagnostics.CausalityTraceLevel)traceLevel, CausalitySource.Library, AsyncCausalityTracer.s_PlatformId, AsyncCausalityTracer.GetOperationId((uint)taskId), (Windows.Foundation.Diagnostics.AsyncCausalityStatus)status);
     }
     catch (Exception ex)
     {
         AsyncCausalityTracer.LogAndDisable(ex);
     }
 }
Ejemplo n.º 6
0
        static AsyncCausalityTracer()
        {
            if (!Environment.IsWinRTSupported)
            {
                return;
            }
            string activatableClassId = "Windows.Foundation.Diagnostics.AsyncCausalityTracer";
            Guid   iid     = new Guid(1350896422, (short)9854, (short)17691, (byte)168, (byte)144, (byte)171, (byte)106, (byte)55, (byte)2, (byte)69, (byte)238);
            object factory = (object)null;

            try
            {
                if (UnsafeNativeMethods.RoGetActivationFactory(activatableClassId, ref iid, out factory) < 0 || factory == null)
                {
                    return;
                }
                AsyncCausalityTracer.s_TracerFactory = (IAsyncCausalityTracerStatics)factory;
                AsyncCausalityTracer.s_TracerFactory.add_TracingStatusChanged(new EventHandler <TracingStatusChangedEventArgs>(AsyncCausalityTracer.TracingStatusChangedHandler));
            }
            catch (Exception ex)
            {
                AsyncCausalityTracer.LogAndDisable(ex);
            }
        }
Ejemplo n.º 7
0
        static AsyncCausalityTracer()
        {
            if (!Environment.IsWinRTSupported)
            {
                return;
            }
            string activatableClassId = "Windows.Foundation.Diagnostics.AsyncCausalityTracer";
            Guid   guid = new Guid(1350896422, 9854, 17691, 168, 144, 171, 106, 55, 2, 69, 238);
            object obj  = null;

            try
            {
                int num = Microsoft.Win32.UnsafeNativeMethods.RoGetActivationFactory(activatableClassId, ref guid, out obj);
                if (num >= 0 && obj != null)
                {
                    AsyncCausalityTracer.s_TracerFactory = (IAsyncCausalityTracerStatics)obj;
                    EventRegistrationToken eventRegistrationToken = AsyncCausalityTracer.s_TracerFactory.add_TracingStatusChanged(new EventHandler <TracingStatusChangedEventArgs>(AsyncCausalityTracer.TracingStatusChangedHandler));
                }
            }
            catch (Exception ex)
            {
                AsyncCausalityTracer.LogAndDisable(ex);
            }
        }