Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Unified Diff: src/counters.h

Issue 1681943002: [counter] Properly measure own-time of runtime counters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2016-02-08_builtins_timer_1678973002
Patch Set: fixing type Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins.cc ('k') | src/counters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters.h
diff --git a/src/counters.h b/src/counters.h
index 057c24e3f383ae321f057bb3d6796effe7b9227e..bf10a4ece0b298aa680a335b0064dffb5135ff44 100644
--- a/src/counters.h
+++ b/src/counters.h
@@ -701,23 +701,35 @@ double AggregatedMemoryHistogram<Histogram>::Aggregate(double current_ms,
/* Total count of functions compiled using the baseline compiler. */ \
SC(total_baseline_compile_count, V8.TotalBaselineCompileCount)
+typedef struct RuntimeCallCounter {
+ int64_t count = 0;
+ base::TimeDelta time;
+ RuntimeCallCounter* parent_counter;
+
+ void Reset();
+} RuntimeCallCounter;
+
struct RuntimeCallStats {
#define CALL_RUNTIME_COUNTER(name, nargs, ressize) \
- uint32_t Count_Runtime_##name; \
- base::TimeDelta Time_Runtime_##name;
+ RuntimeCallCounter Runtime_##name;
FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER)
#undef CALL_RUNTIME_COUNTER
-#define CALL_BUILTIN_COUNTER(name, type) \
- uint32_t Count_Builtin_##name; \
- base::TimeDelta Time_Builtin_##name;
+#define CALL_BUILTIN_COUNTER(name, type) RuntimeCallCounter Builtin_##name;
BUILTIN_LIST_C(CALL_BUILTIN_COUNTER)
#undef CALL_BUILTIN_COUNTER
// Dummy counter for the unexpected stub miss.
- uint32_t Count_UnexpectedStubMiss;
- base::TimeDelta Time_UnexpectedStubMiss;
-
- bool in_runtime_call = false;
+ RuntimeCallCounter UnexpectedStubMiss;
+ // Counter to track recursive time events.
+ RuntimeCallCounter* current_counter;
+
+ // Starting measuring the time for a function. This will establish the
+ // connection to the parent counter for properly calculating the own times.
+ void Enter(RuntimeCallCounter* counter);
+ // Leave a scope for a measured runtime function. This will properly add
+ // the time delta to the current_counter and subtract the delta from its
+ // parent.
+ void Leave(base::TimeDelta time);
void Reset();
void Print(std::ostream& os);
« no previous file with comments | « src/builtins.cc ('k') | src/counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698