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

Side by Side Diff: src/counters.cc

Issue 827993003: Integrate Chrome tracing with V8 (WIP) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/counters.h ('k') | src/log.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/platform/platform.h" 7 #include "src/base/platform/platform.h"
8 #include "src/counters.h" 8 #include "src/counters.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/log-inl.h" 10 #include "src/log-inl.h"
(...skipping 22 matching lines...) Expand all
33 return isolate()->stats_table()-> 33 return isolate()->stats_table()->
34 CreateHistogram(name_, min_, max_, num_buckets_); 34 CreateHistogram(name_, min_, max_, num_buckets_);
35 } 35 }
36 36
37 37
38 // Start the timer. 38 // Start the timer.
39 void HistogramTimer::Start() { 39 void HistogramTimer::Start() {
40 if (Enabled()) { 40 if (Enabled()) {
41 timer_.Start(); 41 timer_.Start();
42 } 42 }
43 Logger::CallEventLogger(isolate(), name(), Logger::START, true); 43 Logger::CallEventLogger(isolate(), name(), Logger::START, overhead());
44 } 44 }
45 45
46 46
47 // Stop the timer and record the results. 47 // Stop the timer and record the results.
48 void HistogramTimer::Stop() { 48 void HistogramTimer::Stop() {
49 if (Enabled()) { 49 if (Enabled()) {
50 // Compute the delta between start and stop, in milliseconds. 50 // Compute the delta between start and stop, in milliseconds.
51 AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds())); 51 AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds()));
52 timer_.Stop(); 52 timer_.Stop();
53 } 53 }
54 Logger::CallEventLogger(isolate(), name(), Logger::END, true); 54 Logger::CallEventLogger(isolate(), name(), Logger::END, overhead());
55 } 55 }
56 56
57 57
58 Counters::Counters(Isolate* isolate) { 58 Counters::Counters(Isolate* isolate) {
59 #define HR(name, caption, min, max, num_buckets) \ 59 #define HR(name, caption, min, max, num_buckets) \
60 name##_ = Histogram(#caption, min, max, num_buckets, isolate); 60 name##_ = Histogram(#caption, min, max, num_buckets, isolate);
61 HISTOGRAM_RANGE_LIST(HR) 61 HISTOGRAM_RANGE_LIST(HR)
62 #undef HR 62 #undef HR
63 63
64 #define HT(name, caption) \ 64 #define HT(name, caption, overhead) \
65 name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate); 65 name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate, Logger::overhead);
66 HISTOGRAM_TIMER_LIST(HT) 66 HISTOGRAM_TIMER_LIST(HT)
67 #undef HT 67 #undef HT
68 68
69 #define HP(name, caption) \ 69 #define HP(name, caption) \
70 name##_ = Histogram(#caption, 0, 101, 100, isolate); 70 name##_ = Histogram(#caption, 0, 101, 100, isolate);
71 HISTOGRAM_PERCENTAGE_LIST(HP) 71 HISTOGRAM_PERCENTAGE_LIST(HP)
72 #undef HP 72 #undef HP
73 73
74 #define HM(name, caption) \ 74 #define HM(name, caption) \
75 name##_ = Histogram(#caption, 1000, 500000, 50, isolate); 75 name##_ = Histogram(#caption, 1000, 500000, 50, isolate);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 CODE_AGE_LIST_COMPLETE(SC) 145 CODE_AGE_LIST_COMPLETE(SC)
146 #undef SC 146 #undef SC
147 } 147 }
148 148
149 149
150 void Counters::ResetHistograms() { 150 void Counters::ResetHistograms() {
151 #define HR(name, caption, min, max, num_buckets) name##_.Reset(); 151 #define HR(name, caption, min, max, num_buckets) name##_.Reset();
152 HISTOGRAM_RANGE_LIST(HR) 152 HISTOGRAM_RANGE_LIST(HR)
153 #undef HR 153 #undef HR
154 154
155 #define HT(name, caption) name##_.Reset(); 155 #define HT(name, caption, overhead) name##_.Reset();
156 HISTOGRAM_TIMER_LIST(HT) 156 HISTOGRAM_TIMER_LIST(HT)
157 #undef HT 157 #undef HT
158 158
159 #define HP(name, caption) name##_.Reset(); 159 #define HP(name, caption) name##_.Reset();
160 HISTOGRAM_PERCENTAGE_LIST(HP) 160 HISTOGRAM_PERCENTAGE_LIST(HP)
161 #undef HP 161 #undef HP
162 162
163 #define HM(name, caption) name##_.Reset(); 163 #define HM(name, caption) name##_.Reset();
164 HISTOGRAM_MEMORY_LIST(HM) 164 HISTOGRAM_MEMORY_LIST(HM)
165 #undef HM 165 #undef HM
166 } 166 }
167 167
168 } } // namespace v8::internal 168 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/counters.h ('k') | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698