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

Side by Side Diff: src/v8-counters.h

Issue 10702168: Add counters that automatically track object sizes and counts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Whitespace change Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-visiting.h ('k') | src/v8-counters.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
(...skipping 11 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_V8_COUNTERS_H_ 28 #ifndef V8_V8_COUNTERS_H_
29 #define V8_V8_COUNTERS_H_ 29 #define V8_V8_COUNTERS_H_
30 30
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "counters.h" 32 #include "counters.h"
33 #include "objects.h"
33 #include "v8globals.h" 34 #include "v8globals.h"
34 35
35 namespace v8 { 36 namespace v8 {
36 namespace internal { 37 namespace internal {
37 38
38 #define HISTOGRAM_TIMER_LIST(HT) \ 39 #define HISTOGRAM_TIMER_LIST(HT) \
39 /* Garbage collection timers. */ \ 40 /* Garbage collection timers. */ \
40 HT(gc_compactor, V8.GCCompactor) \ 41 HT(gc_compactor, V8.GCCompactor) \
41 HT(gc_scavenger, V8.GCScavenger) \ 42 HT(gc_scavenger, V8.GCScavenger) \
42 HT(gc_context, V8.GCContext) /* GC context cleanup time */ \ 43 HT(gc_context, V8.GCContext) /* GC context cleanup time */ \
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 HistogramTimer* name() { return &name##_; } 280 HistogramTimer* name() { return &name##_; }
280 HISTOGRAM_TIMER_LIST(HT) 281 HISTOGRAM_TIMER_LIST(HT)
281 #undef HT 282 #undef HT
282 283
283 #define SC(name, caption) \ 284 #define SC(name, caption) \
284 StatsCounter* name() { return &name##_; } 285 StatsCounter* name() { return &name##_; }
285 STATS_COUNTER_LIST_1(SC) 286 STATS_COUNTER_LIST_1(SC)
286 STATS_COUNTER_LIST_2(SC) 287 STATS_COUNTER_LIST_2(SC)
287 #undef SC 288 #undef SC
288 289
290 #define SC(name) \
291 StatsCounter* count_of_##name() { return &count_of_##name##_; } \
292 StatsCounter* size_of_##name() { return &size_of_##name##_; }
293 INSTANCE_TYPE_LIST(SC)
294 #undef SC
295
289 enum Id { 296 enum Id {
290 #define RATE_ID(name, caption) k_##name, 297 #define RATE_ID(name, caption) k_##name,
291 HISTOGRAM_TIMER_LIST(RATE_ID) 298 HISTOGRAM_TIMER_LIST(RATE_ID)
292 #undef RATE_ID 299 #undef RATE_ID
293 #define COUNTER_ID(name, caption) k_##name, 300 #define COUNTER_ID(name, caption) k_##name,
294 STATS_COUNTER_LIST_1(COUNTER_ID) 301 STATS_COUNTER_LIST_1(COUNTER_ID)
295 STATS_COUNTER_LIST_2(COUNTER_ID) 302 STATS_COUNTER_LIST_2(COUNTER_ID)
296 #undef COUNTER_ID 303 #undef COUNTER_ID
304 #define COUNTER_ID(name) kCountOf##name, kSizeOf##name,
305 INSTANCE_TYPE_LIST(COUNTER_ID)
306 #undef COUNTER_ID
297 #define COUNTER_ID(name) k_##name, 307 #define COUNTER_ID(name) k_##name,
298 STATE_TAG_LIST(COUNTER_ID) 308 STATE_TAG_LIST(COUNTER_ID)
299 #undef COUNTER_ID 309 #undef COUNTER_ID
300 stats_counter_count 310 stats_counter_count
301 }; 311 };
302 312
303 StatsCounter* state_counters(StateTag state) { 313 StatsCounter* state_counters(StateTag state) {
304 return &state_counters_[state]; 314 return &state_counters_[state];
305 } 315 }
306 316
307 private: 317 private:
308 #define HT(name, caption) \ 318 #define HT(name, caption) \
309 HistogramTimer name##_; 319 HistogramTimer name##_;
310 HISTOGRAM_TIMER_LIST(HT) 320 HISTOGRAM_TIMER_LIST(HT)
311 #undef HT 321 #undef HT
312 322
313 #define SC(name, caption) \ 323 #define SC(name, caption) \
314 StatsCounter name##_; 324 StatsCounter name##_;
315 STATS_COUNTER_LIST_1(SC) 325 STATS_COUNTER_LIST_1(SC)
316 STATS_COUNTER_LIST_2(SC) 326 STATS_COUNTER_LIST_2(SC)
317 #undef SC 327 #undef SC
318 328
329 #define SC(name) \
330 StatsCounter size_of_##name##_; \
331 StatsCounter count_of_##name##_;
332 INSTANCE_TYPE_LIST(SC)
333 #undef SC
334
319 enum { 335 enum {
320 #define COUNTER_ID(name) __##name, 336 #define COUNTER_ID(name) __##name,
321 STATE_TAG_LIST(COUNTER_ID) 337 STATE_TAG_LIST(COUNTER_ID)
322 #undef COUNTER_ID 338 #undef COUNTER_ID
323 kSlidingStateWindowCounterCount 339 kSlidingStateWindowCounterCount
324 }; 340 };
325 341
326 // Sliding state window counters. 342 // Sliding state window counters.
327 StatsCounter state_counters_[kSlidingStateWindowCounterCount]; 343 StatsCounter state_counters_[kSlidingStateWindowCounterCount];
328 friend class Isolate; 344 friend class Isolate;
329 345
330 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); 346 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
331 }; 347 };
332 348
333 } } // namespace v8::internal 349 } } // namespace v8::internal
334 350
335 #endif // V8_V8_COUNTERS_H_ 351 #endif // V8_V8_COUNTERS_H_
OLDNEW
« no previous file with comments | « src/objects-visiting.h ('k') | src/v8-counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698