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

Side by Side Diff: src/counters.h

Issue 875873002: Rescale histogram timers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/counters.cc » ('j') | src/counters.cc » ('J')
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 #ifndef V8_COUNTERS_H_ 5 #ifndef V8_COUNTERS_H_
6 #define V8_COUNTERS_H_ 6 #define V8_COUNTERS_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/allocation.h" 9 #include "src/allocation.h"
10 #include "src/base/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // events to be timed. 308 // events to be timed.
309 class AggregatableHistogramTimer : public Histogram { 309 class AggregatableHistogramTimer : public Histogram {
310 public: 310 public:
311 AggregatableHistogramTimer() {} 311 AggregatableHistogramTimer() {}
312 AggregatableHistogramTimer(const char* name, int min, int max, 312 AggregatableHistogramTimer(const char* name, int min, int max,
313 int num_buckets, Isolate* isolate) 313 int num_buckets, Isolate* isolate)
314 : Histogram(name, min, max, num_buckets, isolate) {} 314 : Histogram(name, min, max, num_buckets, isolate) {}
315 315
316 // Start/stop the "outer" scope. 316 // Start/stop the "outer" scope.
317 void Start() { time_ = base::TimeDelta(); } 317 void Start() { time_ = base::TimeDelta(); }
318 void Stop() { AddSample(static_cast<int>(time_.InMilliseconds())); } 318 void Stop() { AddSample(static_cast<int>(time_.InMicroseconds())); }
319 319
320 // Add a time value ("inner" scope). 320 // Add a time value ("inner" scope).
321 void Add(base::TimeDelta other) { time_ += other; } 321 void Add(base::TimeDelta other) { time_ += other; }
322 322
323 private: 323 private:
324 base::TimeDelta time_; 324 base::TimeDelta time_;
325 }; 325 };
326 326
327 327
328 // A helper class for use with AggregatableHistogramTimer. 328 // A helper class for use with AggregatableHistogramTimer.
(...skipping 24 matching lines...) Expand all
353 AggregatableHistogramTimer* histogram_; 353 AggregatableHistogramTimer* histogram_;
354 }; 354 };
355 355
356 356
357 #define HISTOGRAM_RANGE_LIST(HR) \ 357 #define HISTOGRAM_RANGE_LIST(HR) \
358 /* Generic range histograms */ \ 358 /* Generic range histograms */ \
359 HR(gc_idle_time_allotted_in_ms, V8.GCIdleTimeAllottedInMS, 0, 10000, 101) \ 359 HR(gc_idle_time_allotted_in_ms, V8.GCIdleTimeAllottedInMS, 0, 10000, 101) \
360 HR(gc_idle_time_limit_overshot, V8.GCIdleTimeLimit.Overshot, 0, 10000, 101) \ 360 HR(gc_idle_time_limit_overshot, V8.GCIdleTimeLimit.Overshot, 0, 10000, 101) \
361 HR(gc_idle_time_limit_undershot, V8.GCIdleTimeLimit.Undershot, 0, 10000, 101) 361 HR(gc_idle_time_limit_undershot, V8.GCIdleTimeLimit.Undershot, 0, 10000, 101)
362 362
363 #define HISTOGRAM_TIMER_LIST(HT) \ 363 #define SECONDS *1000 * 1000
364 /* Garbage collection timers. */ \ 364 #define MILLISECONDS *1000
vogelheim 2015/01/26 14:46:50 I'm not super fond of this style of macro meta pro
Yang 2015/01/26 15:09:07 Done.
365 HT(gc_compactor, V8.GCCompactor) \ 365
366 HT(gc_scavenger, V8.GCScavenger) \ 366 #define HISTOGRAM_TIMER_LIST(HT) \
367 HT(gc_context, V8.GCContext) /* GC context cleanup time */ \ 367 /* Garbage collection timers. */ \
368 HT(gc_idle_notification, V8.GCIdleNotification) \ 368 HT(gc_compactor, V8.GCCompactor, 10 SECONDS) \
369 HT(gc_incremental_marking, V8.GCIncrementalMarking) \ 369 HT(gc_scavenger, V8.GCScavenger, 10 SECONDS) \
370 HT(gc_low_memory_notification, V8.GCLowMemoryNotification) \ 370 HT(gc_context, V8.GCContext, 10 SECONDS) /* GC context cleanup time */ \
371 /* Parsing timers. */ \ 371 HT(gc_idle_notification, V8.GCIdleNotification, 10 SECONDS) \
372 HT(parse, V8.Parse) \ 372 HT(gc_incremental_marking, V8.GCIncrementalMarking, 10 SECONDS) \
373 HT(parse_lazy, V8.ParseLazy) \ 373 HT(gc_low_memory_notification, V8.GCLowMemoryNotification, 10 SECONDS) \
374 HT(pre_parse, V8.PreParse) \ 374 /* Parsing timers. */ \
375 /* Compilation times. */ \ 375 HT(parse, V8.Parse, 1000 MILLISECONDS) \
376 HT(compile, V8.Compile) \ 376 HT(parse_lazy, V8.ParseLazy, 1000 MILLISECONDS) \
377 HT(compile_eval, V8.CompileEval) \ 377 HT(pre_parse, V8.PreParse, 1000 MILLISECONDS) \
378 /* Serialization as part of compilation (code caching) */ \ 378 /* Compilation times. */ \
379 HT(compile_serialize, V8.CompileSerialize) \ 379 HT(compile, V8.Compile, 1000 MILLISECONDS) \
380 HT(compile_deserialize, V8.CompileDeserialize) \ 380 HT(compile_eval, V8.CompileEval, 1000 MILLISECONDS) \
381 /* Total compilation time incl. caching/parsing */ \ 381 /* Serialization as part of compilation (code caching) */ \
382 HT(compile_script, V8.CompileScript) 382 HT(compile_serialize, V8.CompileSerialize, 100 MILLISECONDS) \
383 HT(compile_deserialize, V8.CompileDeserialize, 100 MILLISECONDS) \
384 /* Total compilation time incl. caching/parsing */ \
385 HT(compile_script, V8.CompileScript, 1000 MILLISECONDS)
386
387 #undef SECONDS
388 #undef MILLISECONDS
383 389
384 390
385 #define AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) \ 391 #define AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) \
386 AHT(compile_lazy, V8.CompileLazy) 392 AHT(compile_lazy, V8.CompileLazy)
387 393
388 394
389 #define HISTOGRAM_PERCENTAGE_LIST(HP) \ 395 #define HISTOGRAM_PERCENTAGE_LIST(HP) \
390 /* Heap fragmentation. */ \ 396 /* Heap fragmentation. */ \
391 HP(external_fragmentation_total, \ 397 HP(external_fragmentation_total, \
392 V8.MemoryExternalFragmentationTotal) \ 398 V8.MemoryExternalFragmentationTotal) \
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 630
625 631
626 // This file contains all the v8 counters that are in use. 632 // This file contains all the v8 counters that are in use.
627 class Counters { 633 class Counters {
628 public: 634 public:
629 #define HR(name, caption, min, max, num_buckets) \ 635 #define HR(name, caption, min, max, num_buckets) \
630 Histogram* name() { return &name##_; } 636 Histogram* name() { return &name##_; }
631 HISTOGRAM_RANGE_LIST(HR) 637 HISTOGRAM_RANGE_LIST(HR)
632 #undef HR 638 #undef HR
633 639
634 #define HT(name, caption) \ 640 #define HT(name, caption, scale) \
635 HistogramTimer* name() { return &name##_; } 641 HistogramTimer* name() { return &name##_; }
636 HISTOGRAM_TIMER_LIST(HT) 642 HISTOGRAM_TIMER_LIST(HT)
637 #undef HT 643 #undef HT
638 644
639 #define AHT(name, caption) \ 645 #define AHT(name, caption) \
640 AggregatableHistogramTimer* name() { return &name##_; } 646 AggregatableHistogramTimer* name() { return &name##_; }
641 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) 647 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
642 #undef AHT 648 #undef AHT
643 649
644 #define HP(name, caption) \ 650 #define HP(name, caption) \
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 687
682 #define SC(name) \ 688 #define SC(name) \
683 StatsCounter* count_of_CODE_AGE_##name() \ 689 StatsCounter* count_of_CODE_AGE_##name() \
684 { return &count_of_CODE_AGE_##name##_; } \ 690 { return &count_of_CODE_AGE_##name##_; } \
685 StatsCounter* size_of_CODE_AGE_##name() \ 691 StatsCounter* size_of_CODE_AGE_##name() \
686 { return &size_of_CODE_AGE_##name##_; } 692 { return &size_of_CODE_AGE_##name##_; }
687 CODE_AGE_LIST_COMPLETE(SC) 693 CODE_AGE_LIST_COMPLETE(SC)
688 #undef SC 694 #undef SC
689 695
690 enum Id { 696 enum Id {
691 #define RATE_ID(name, caption) k_##name, 697 #define RATE_ID(name, caption, scale) k_##name,
692 HISTOGRAM_TIMER_LIST(RATE_ID) 698 HISTOGRAM_TIMER_LIST(RATE_ID)
693 #undef RATE_ID 699 #undef RATE_ID
694 #define AGGREGATABLE_ID(name, caption) k_##name, 700 #define AGGREGATABLE_ID(name, caption) k_##name,
695 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AGGREGATABLE_ID) 701 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AGGREGATABLE_ID)
696 #undef AGGREGATABLE_ID 702 #undef AGGREGATABLE_ID
697 #define PERCENTAGE_ID(name, caption) k_##name, 703 #define PERCENTAGE_ID(name, caption) k_##name,
698 HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID) 704 HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
699 #undef PERCENTAGE_ID 705 #undef PERCENTAGE_ID
700 #define MEMORY_ID(name, caption) k_##name, 706 #define MEMORY_ID(name, caption) k_##name,
701 HISTOGRAM_MEMORY_LIST(MEMORY_ID) 707 HISTOGRAM_MEMORY_LIST(MEMORY_ID)
702 #undef MEMORY_ID 708 #undef MEMORY_ID
703 #define COUNTER_ID(name, caption) k_##name, 709 #define COUNTER_ID(name, caption) k_##name,
704 STATS_COUNTER_LIST_1(COUNTER_ID) 710 STATS_COUNTER_LIST_1(COUNTER_ID) STATS_COUNTER_LIST_2(
705 STATS_COUNTER_LIST_2(COUNTER_ID) 711 COUNTER_ID)
706 #undef COUNTER_ID 712 #undef COUNTER_ID
707 #define COUNTER_ID(name) kCountOf##name, kSizeOf##name, 713 #define COUNTER_ID(name) kCountOf##name, kSizeOf##name,
708 INSTANCE_TYPE_LIST(COUNTER_ID) 714 INSTANCE_TYPE_LIST(COUNTER_ID)
709 #undef COUNTER_ID 715 #undef COUNTER_ID
710 #define COUNTER_ID(name) kCountOfCODE_TYPE_##name, \ 716 #define COUNTER_ID(name) kCountOfCODE_TYPE_##name, \
711 kSizeOfCODE_TYPE_##name, 717 kSizeOfCODE_TYPE_##name,
712 CODE_KIND_LIST(COUNTER_ID) 718 CODE_KIND_LIST(COUNTER_ID)
713 #undef COUNTER_ID 719 #undef COUNTER_ID
714 #define COUNTER_ID(name) kCountOfFIXED_ARRAY__##name, \ 720 #define COUNTER_ID(name) kCountOfFIXED_ARRAY__##name, \
715 kSizeOfFIXED_ARRAY__##name, 721 kSizeOfFIXED_ARRAY__##name,
716 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID) 722 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID)
717 #undef COUNTER_ID 723 #undef COUNTER_ID
718 #define COUNTER_ID(name) kCountOfCODE_AGE__##name, \ 724 #define COUNTER_ID(name) kCountOfCODE_AGE__##name, \
719 kSizeOfCODE_AGE__##name, 725 kSizeOfCODE_AGE__##name,
720 CODE_AGE_LIST_COMPLETE(COUNTER_ID) 726 CODE_AGE_LIST_COMPLETE(COUNTER_ID)
721 #undef COUNTER_ID 727 #undef COUNTER_ID
722 stats_counter_count 728 stats_counter_count
vogelheim 2015/01/26 14:46:50 This (and above) is a super strange indent. I tak
Yang 2015/01/26 15:09:07 Done.
723 }; 729 };
724 730
725 void ResetCounters(); 731 void ResetCounters();
726 void ResetHistograms(); 732 void ResetHistograms();
727 733
728 private: 734 private:
729 #define HR(name, caption, min, max, num_buckets) Histogram name##_; 735 #define HR(name, caption, min, max, num_buckets) Histogram name##_;
730 HISTOGRAM_RANGE_LIST(HR) 736 HISTOGRAM_RANGE_LIST(HR)
731 #undef HR 737 #undef HR
732 738
733 #define HT(name, caption) \ 739 #define HT(name, caption, scale) HistogramTimer name##_;
734 HistogramTimer name##_;
735 HISTOGRAM_TIMER_LIST(HT) 740 HISTOGRAM_TIMER_LIST(HT)
736 #undef HT 741 #undef HT
737 742
738 #define AHT(name, caption) \ 743 #define AHT(name, caption) \
739 AggregatableHistogramTimer name##_; 744 AggregatableHistogramTimer name##_;
740 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) 745 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
741 #undef AHT 746 #undef AHT
742 747
743 #define HP(name, caption) \ 748 #define HP(name, caption) \
744 Histogram name##_; 749 Histogram name##_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 friend class Isolate; 788 friend class Isolate;
784 789
785 explicit Counters(Isolate* isolate); 790 explicit Counters(Isolate* isolate);
786 791
787 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); 792 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
788 }; 793 };
789 794
790 } } // namespace v8::internal 795 } } // namespace v8::internal
791 796
792 #endif // V8_COUNTERS_H_ 797 #endif // V8_COUNTERS_H_
OLDNEW
« no previous file with comments | « no previous file | src/counters.cc » ('j') | src/counters.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698