Bug 716619 - Simplify GC probes (r=sfink)
☠☠ backed out by ff332e866e41 ☠ ☠
authorBill McCloskey <wmccloskey@mozilla.com>
Fri, 27 Jan 2012 11:35:12 -0800
changeset 86827 77b82d0464b41d26fe4bf107526d95cefbe3eed7
parent 86826 f5784f097de32f145f3d028e9112894e7cf8c218
child 86828 687b80084d3d3131ce45f06454cc12620db49bbf
child 86829 ff332e866e416734dee23306397f35ae012c76ad
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs716619
milestone12.0a1
Bug 716619 - Simplify GC probes (r=sfink)
js/src/ETWProvider.man
js/src/gc/Statistics.cpp
js/src/jsprobes.h
--- a/js/src/ETWProvider.man
+++ b/js/src/ETWProvider.man
@@ -74,39 +74,39 @@
           <event symbol="EvtObjectResize" value="1011" version="1"
                  channel="MozillaChannel" level="win:Verbose"
                  template="ObjectResizeTemplate" task="Allocation" opcode="ObjectResize"
                  keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
 
           <!-- GC -->
           <event symbol="EvtGCStart" value="1012" version="1"
                  channel="MozillaChannel" level="win:Informational"
-                 template="CompartmentTemplate" task="Allocation" opcode="GCStart"
+                 template="BooleanTemplate" task="Allocation" opcode="GCStart"
                  keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
           <event symbol="EvtGCEnd" value="1013" version="1"
                  channel="MozillaChannel" level="win:Informational"
-                 template="CompartmentTemplate" task="Allocation" opcode="GCEnd"
+                 template="BooleanTemplate" task="Allocation" opcode="GCEnd"
                  keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
 
           <event symbol="EvtGCStartMarkPhase" value="1014" version="1"
                  channel="MozillaChannel" level="win:Informational"
-                 template="CompartmentTemplate" task="Allocation" opcode="GCMarkStart"
+                 template="VoidTemplate" task="Allocation" opcode="GCMarkStart"
                  keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
           <event symbol="EvtGCEndMarkPhase" value="1015" version="1"
                  channel="MozillaChannel" level="win:Informational"
-                 template="CompartmentTemplate" task="Allocation" opcode="GCMarkEnd"
+                 template="VoidTemplate" task="Allocation" opcode="GCMarkEnd"
                  keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
                     
           <event symbol="EvtGCStartSweepPhase" value="1016" version="1"
                  channel="MozillaChannel" level="win:Informational"
-                 template="CompartmentTemplate" task="Allocation" opcode="GCSweepStart"
+                 template="VoidTemplate" task="Allocation" opcode="GCSweepStart"
                  keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
           <event symbol="EvtGCEndSweepPhase" value="1017" version="1"
                  channel="MozillaChannel" level="win:Informational"
-                 template="CompartmentTemplate" task="Allocation" opcode="GCSweepEnd"
+                 template="VoidTemplate" task="Allocation" opcode="GCSweepEnd"
                  keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
 
           <event symbol="EvtMemoryAcquire" value="1018" version="1"
                  channel="MozillaChannel" level="win:Verbose"
                  template="MemoryLocationTemplate" task="Allocation" opcode="AcquireMemory"
                  keywords="SampleKeyword" message="$(string.SampleProvider.SampleEvent.message)"/>
           <event symbol="EvtMemoryRelease" value="1019" version="1"
                  channel="MozillaChannel" level="win:Verbose"
@@ -226,18 +226,18 @@
             <data name="Size" inType="win:Int64" outType="xs:long"/>
           </template>
 
           <template tid="StringFinalizeTemplate">
             <data name="Address" inType="win:Int64" outType="xs:long"/>
             <data name="Size" inType="win:Int64" outType="xs:long"/>
           </template>
 
-          <template tid="CompartmentTemplate">
-            <data name="Compartment" inType="win:Int64" outType="xs:long"/>
+          <template tid="BooleanTemplate">
+            <data name="Boolean" inType="win:Boolean" outType="xs:boolean"/>
           </template>
 
           <template tid="MemoryLocationTemplate">
             <data name="Compartment" inType="win:Int64" outType="xs:long"/>
             <data name="Address" inType="win:Int64" outType="xs:long"/>
             <data name="Size" inType="win:Int64" outType="xs:long"/>
           </template>
 
@@ -254,16 +254,19 @@
           <template tid="StringTemplate">
             <data name="String" inType="win:UnicodeString" outType="xs:string"/>
           </template>
 
           <template tid="IntTemplate">
             <data name="Int" inType="win:Int32" outType="xs:int"/>
           </template>
 
+          <template tid="VoidTemplate">
+          </template>
+
         </templates>
       </provider>
     </events>
   </instrumentation>
 
   <localization>
     <resources culture="en-US">
       <stringTable>
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -201,17 +201,17 @@ Statistics::beginGC(JSCompartment *comp,
 
     PodArrayZero(phaseStarts);
     PodArrayZero(phaseEnds);
     PodArrayZero(phaseTimes);
 
     triggerReason = reason;
 
     beginPhase(PHASE_GC);
-    Probes::GCStart(compartment);
+    Probes::GCStart(!!compartment);
 
     GCCrashData crashData;
     crashData.isCompartment = !!compartment;
     crash::SaveCrashData(crash::JS_CRASH_TAG_GC, &crashData, sizeof(crashData));
 }
 
 double
 Statistics::t(Phase phase)
@@ -278,17 +278,17 @@ Statistics::printStats()
                 t(PHASE_GC), t(PHASE_MARK), t(PHASE_SWEEP));
     }
     fflush(fp);
 }
 
 void
 Statistics::endGC()
 {
-    Probes::GCEnd(compartment);
+    Probes::GCEnd(!!compartment);
     endPhase(PHASE_GC);
     crash::SnapshotGCStack();
 
     for (int i = 0; i < PHASE_LIMIT; i++)
         totals[i] += phaseTimes[i];
 
     if (JSAccumulateTelemetryDataCallback cb = runtime->telemetryCallback) {
         (*cb)(JS_TELEMETRY_GC_REASON, triggerReason);
@@ -310,40 +310,28 @@ Statistics::endGC()
     PodArrayZero(counts);
 }
 
 void
 Statistics::beginPhase(Phase phase)
 {
     phaseStarts[phase] = PRMJ_Now();
 
-    if (phase == gcstats::PHASE_SWEEP) {
-        Probes::GCStartSweepPhase(NULL);
-        if (!compartment) {
-            for (JSCompartment **c = runtime->compartments.begin();
-                 c != runtime->compartments.end(); ++c)
-            {
-                Probes::GCStartSweepPhase(*c);
-            }
-        }
-    }
+    if (phase == gcstats::PHASE_MARK)
+        Probes::GCStartMarkPhase();
+    else if (phase == gcstats::PHASE_SWEEP)
+        Probes::GCStartSweepPhase();
 }
 
 void
 Statistics::endPhase(Phase phase)
 {
     phaseEnds[phase] = PRMJ_Now();
     phaseTimes[phase] += phaseEnds[phase] - phaseStarts[phase];
 
-    if (phase == gcstats::PHASE_SWEEP) {
-        if (!compartment) {
-            for (JSCompartment **c = runtime->compartments.begin();
-                 c != runtime->compartments.end(); ++c)
-            {
-                Probes::GCEndSweepPhase(*c);
-            }
-        }
-        Probes::GCEndSweepPhase(NULL);
-    }
+    if (phase == gcstats::PHASE_MARK)
+        Probes::GCEndMarkPhase();
+    else if (phase == gcstats::PHASE_SWEEP)
+        Probes::GCEndSweepPhase();
 }
 
 } /* namespace gcstats */
 } /* namespace js */
--- a/js/src/jsprobes.h
+++ b/js/src/jsprobes.h
@@ -192,24 +192,24 @@ bool releaseMemory(JSContext *cx, void *
  * GC timing is tricky and at the time of this writing is changing frequently.
  * GCStart(NULL)/GCEnd(NULL) are intended to bracket the entire garbage
  * collection (either global or single-compartment), but a separate thread may
  * continue doing work after GCEnd.
  *
  * Multiple compartments' GC will be interleaved during a global collection
  * (eg, compartment 1 starts, compartment 2 starts, compartment 1 ends, ...)
  */
-bool GCStart(JSCompartment *compartment);
-bool GCEnd(JSCompartment *compartment);
+bool GCStart(bool isFull);
+bool GCEnd(bool isFull);
 
-bool GCStartMarkPhase(JSCompartment *compartment);
-bool GCEndMarkPhase(JSCompartment *compartment);
+bool GCStartMarkPhase();
+bool GCEndMarkPhase();
 
-bool GCStartSweepPhase(JSCompartment *compartment);
-bool GCEndSweepPhase(JSCompartment *compartment);
+bool GCStartSweepPhase();
+bool GCEndSweepPhase();
 
 /*
  * Various APIs for inserting custom probe points. These might be used to mark
  * when something starts and stops, or for various other purposes the user has
  * in mind. These are useful to export to JS so that JS code can mark
  * application-meaningful events and phases of execution.
  *
  * Not all backends support these.