Reviewers: vogelheim,

Description:
Rescale histogram timers.

[email protected]

Please review this at https://codereview.chromium.org/875873002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+46, -41 lines):
  M src/counters.h
  M src/counters.cc


Index: src/counters.cc
diff --git a/src/counters.cc b/src/counters.cc
index ec5d21d47c3a415846f9e5c5c7537ddf04972d82..63113a182c5e27688a020d051307640b44c48ed9 100644
--- a/src/counters.cc
+++ b/src/counters.cc
@@ -47,8 +47,8 @@ void HistogramTimer::Start() {
 // Stop the timer and record the results.
 void HistogramTimer::Stop() {
   if (Enabled()) {
-    // Compute the delta between start and stop, in milliseconds.
-    AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds()));
+    // Compute the delta between start and stop, in microseconds.
+    AddSample(static_cast<int>(timer_.Elapsed().InMicroseconds()));
     timer_.Stop();
   }
   Logger::CallEventLogger(isolate(), name(), Logger::END, true);
@@ -61,13 +61,13 @@ Counters::Counters(Isolate* isolate) {
   HISTOGRAM_RANGE_LIST(HR)
 #undef HR

-#define HT(name, caption) \
-    name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate);
+#define HT(name, caption, max) \
+  name##_ = HistogramTimer(#caption, 0, max, 50, isolate);
     HISTOGRAM_TIMER_LIST(HT)
 #undef HT

 #define AHT(name, caption) \
-  name##_ = AggregatableHistogramTimer(#caption, 0, 10000, 50, isolate);
+  name##_ = AggregatableHistogramTimer(#caption, 0, 1000000, 50, isolate);
     AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
 #undef AHT

@@ -157,7 +157,7 @@ void Counters::ResetHistograms() {
   HISTOGRAM_RANGE_LIST(HR)
 #undef HR

-#define HT(name, caption) name##_.Reset();
+#define HT(name, caption, max) name##_.Reset();
     HISTOGRAM_TIMER_LIST(HT)
 #undef HT

Index: src/counters.h
diff --git a/src/counters.h b/src/counters.h
index 1209b454643de30bbb986e0b7760335ca0756b0c..45ca6890be7035364a435a96af7e88d5432544c5 100644
--- a/src/counters.h
+++ b/src/counters.h
@@ -315,7 +315,7 @@ class AggregatableHistogramTimer : public Histogram {

   // Start/stop the "outer" scope.
   void Start() { time_ = base::TimeDelta(); }
-  void Stop() { AddSample(static_cast<int>(time_.InMilliseconds())); }
+  void Stop() { AddSample(static_cast<int>(time_.InMicroseconds())); }

   // Add a time value ("inner" scope).
   void Add(base::TimeDelta other) { time_ += other; }
@@ -360,26 +360,32 @@ class AggregatedHistogramTimerScope {
HR(gc_idle_time_limit_overshot, V8.GCIdleTimeLimit.Overshot, 0, 10000, 101) \ HR(gc_idle_time_limit_undershot, V8.GCIdleTimeLimit.Undershot, 0, 10000, 101)

-#define HISTOGRAM_TIMER_LIST(HT)                             \
-  /* Garbage collection timers. */                           \
-  HT(gc_compactor, V8.GCCompactor)                           \
-  HT(gc_scavenger, V8.GCScavenger)                           \
-  HT(gc_context, V8.GCContext) /* GC context cleanup time */ \
-  HT(gc_idle_notification, V8.GCIdleNotification)            \
-  HT(gc_incremental_marking, V8.GCIncrementalMarking)        \
-  HT(gc_low_memory_notification, V8.GCLowMemoryNotification) \
-  /* Parsing timers. */                                      \
-  HT(parse, V8.Parse)                                        \
-  HT(parse_lazy, V8.ParseLazy)                               \
-  HT(pre_parse, V8.PreParse)                                 \
-  /* Compilation times. */                                   \
-  HT(compile, V8.Compile)                                    \
-  HT(compile_eval, V8.CompileEval)                           \
-  /* Serialization as part of compilation (code caching) */  \
-  HT(compile_serialize, V8.CompileSerialize)                 \
-  HT(compile_deserialize, V8.CompileDeserialize)             \
-  /* Total compilation time incl. caching/parsing */         \
-  HT(compile_script, V8.CompileScript)
+#define SECONDS *1000 * 1000
+#define MILLISECONDS *1000
+
+#define HISTOGRAM_TIMER_LIST(HT)                                         \
+  /* Garbage collection timers. */                                       \
+  HT(gc_compactor, V8.GCCompactor, 10 SECONDS)                           \
+  HT(gc_scavenger, V8.GCScavenger, 10 SECONDS)                           \
+  HT(gc_context, V8.GCContext, 10 SECONDS) /* GC context cleanup time */ \
+  HT(gc_idle_notification, V8.GCIdleNotification, 10 SECONDS)            \
+  HT(gc_incremental_marking, V8.GCIncrementalMarking, 10 SECONDS)        \
+  HT(gc_low_memory_notification, V8.GCLowMemoryNotification, 10 SECONDS) \
+  /* Parsing timers. */                                                  \
+  HT(parse, V8.Parse, 1000 MILLISECONDS)                                 \
+  HT(parse_lazy, V8.ParseLazy, 1000 MILLISECONDS)                        \
+  HT(pre_parse, V8.PreParse, 1000 MILLISECONDS)                          \
+  /* Compilation times. */                                               \
+  HT(compile, V8.Compile, 1000 MILLISECONDS)                             \
+  HT(compile_eval, V8.CompileEval, 1000 MILLISECONDS)                    \
+  /* Serialization as part of compilation (code caching) */              \
+  HT(compile_serialize, V8.CompileSerialize, 100 MILLISECONDS)           \
+  HT(compile_deserialize, V8.CompileDeserialize, 100 MILLISECONDS)       \
+  /* Total compilation time incl. caching/parsing */                     \
+  HT(compile_script, V8.CompileScript, 1000 MILLISECONDS)
+
+#undef SECONDS
+#undef MILLISECONDS


 #define AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) \
@@ -631,7 +637,7 @@ class Counters {
   HISTOGRAM_RANGE_LIST(HR)
 #undef HR

-#define HT(name, caption) \
+#define HT(name, caption, scale) \
   HistogramTimer* name() { return &name##_; }
   HISTOGRAM_TIMER_LIST(HT)
 #undef HT
@@ -688,38 +694,38 @@ class Counters {
 #undef SC

   enum Id {
-#define RATE_ID(name, caption) k_##name,
+#define RATE_ID(name, caption, scale) k_##name,
     HISTOGRAM_TIMER_LIST(RATE_ID)
 #undef RATE_ID
 #define AGGREGATABLE_ID(name, caption) k_##name,
-    AGGREGATABLE_HISTOGRAM_TIMER_LIST(AGGREGATABLE_ID)
+        AGGREGATABLE_HISTOGRAM_TIMER_LIST(AGGREGATABLE_ID)
 #undef AGGREGATABLE_ID
 #define PERCENTAGE_ID(name, caption) k_##name,
-    HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
+            HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
 #undef PERCENTAGE_ID
 #define MEMORY_ID(name, caption) k_##name,
-    HISTOGRAM_MEMORY_LIST(MEMORY_ID)
+                HISTOGRAM_MEMORY_LIST(MEMORY_ID)
 #undef MEMORY_ID
 #define COUNTER_ID(name, caption) k_##name,
-    STATS_COUNTER_LIST_1(COUNTER_ID)
-    STATS_COUNTER_LIST_2(COUNTER_ID)
+                    STATS_COUNTER_LIST_1(COUNTER_ID) STATS_COUNTER_LIST_2(
+                        COUNTER_ID)
 #undef COUNTER_ID
 #define COUNTER_ID(name) kCountOf##name, kSizeOf##name,
-    INSTANCE_TYPE_LIST(COUNTER_ID)
+                        INSTANCE_TYPE_LIST(COUNTER_ID)
 #undef COUNTER_ID
 #define COUNTER_ID(name) kCountOfCODE_TYPE_##name, \
     kSizeOfCODE_TYPE_##name,
-    CODE_KIND_LIST(COUNTER_ID)
+                            CODE_KIND_LIST(COUNTER_ID)
 #undef COUNTER_ID
 #define COUNTER_ID(name) kCountOfFIXED_ARRAY__##name, \
     kSizeOfFIXED_ARRAY__##name,
-    FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID)
+ FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID)
 #undef COUNTER_ID
 #define COUNTER_ID(name) kCountOfCODE_AGE__##name, \
     kSizeOfCODE_AGE__##name,
-    CODE_AGE_LIST_COMPLETE(COUNTER_ID)
+                                    CODE_AGE_LIST_COMPLETE(COUNTER_ID)
 #undef COUNTER_ID
-    stats_counter_count
+                                        stats_counter_count
   };

   void ResetCounters();
@@ -730,8 +736,7 @@ class Counters {
   HISTOGRAM_RANGE_LIST(HR)
 #undef HR

-#define HT(name, caption) \
-  HistogramTimer name##_;
+#define HT(name, caption, scale) HistogramTimer name##_;
   HISTOGRAM_TIMER_LIST(HT)
 #undef HT



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to