Add comments per code review feedback
authorSung Yoon Whang <suwhang@microsoft.com>
Sun, 24 May 2020 09:33:12 +0000 (02:33 -0700)
committerSung Yoon Whang <suwhang@microsoft.com>
Sun, 24 May 2020 09:33:12 +0000 (02:33 -0700)
src/coreclr/src/vm/eventpipeprovider.cpp
src/coreclr/src/vm/eventtrace.cpp

index f2d7760..28a9bf6 100644 (file)
@@ -255,11 +255,14 @@ void EventPipeProvider::AddEvent(EventPipeEvent &event)
         isEventFilterDescriptorInitialized = true;
     }
 
+    // NOTE: When we call the callback, we pass in enabled (which is either 1 or 0) as the ControlCode.
+    // If we want to add new ControlCode, we have to make corresponding change in eventtrace.cpp:EtwCallbackCommon
+    // to address this. See https://github.com/dotnet/runtime/pull/36733 for more discussions on this.
     if (pCallbackFunction != NULL && !g_fEEShutDown)
     {
         (*pCallbackFunction)(
             NULL, /* providerId */
-            enabled,
+            enabled, /* ControlCode */
             (UCHAR)providerLevel,
             keywords,
             0 /* matchAllKeywords */,
index 6118a66..ef7f471 100644 (file)
@@ -4268,6 +4268,9 @@ VOID EtwCallbackCommon(
         ctxToUpdate->EventPipeProvider.Level = Level;
         ctxToUpdate->EventPipeProvider.EnabledKeywordsBitmask = MatchAnyKeyword;
         ctxToUpdate->EventPipeProvider.IsEnabled = ControlCode;
+
+        // For EventPipe, ControlCode can only be either 0 or 1.
+        _ASSERTE(ControlCode == 0 || ControlCode == 1);
     }
 
     if (