OLD | NEW |
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" |
11 #include "src/base/platform/time.h" | 11 #include "src/base/platform/time.h" |
| 12 #include "src/builtins.h" |
12 #include "src/globals.h" | 13 #include "src/globals.h" |
13 #include "src/objects.h" | 14 #include "src/objects.h" |
| 15 #include "src/runtime/runtime.h" |
14 | 16 |
15 namespace v8 { | 17 namespace v8 { |
16 namespace internal { | 18 namespace internal { |
17 | 19 |
18 // StatsCounters is an interface for plugging into external | 20 // StatsCounters is an interface for plugging into external |
19 // counters for monitoring. Counters can be looked up and | 21 // counters for monitoring. Counters can be looked up and |
20 // manipulated by name. | 22 // manipulated by name. |
21 | 23 |
22 class StatsTable { | 24 class StatsTable { |
23 public: | 25 public: |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed) \ | 694 SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed) \ |
693 SC(turbo_escape_allocs_replaced, V8.TurboEscapeAllocsReplaced) \ | 695 SC(turbo_escape_allocs_replaced, V8.TurboEscapeAllocsReplaced) \ |
694 SC(crankshaft_escape_allocs_replaced, V8.CrankshaftEscapeAllocsReplaced) \ | 696 SC(crankshaft_escape_allocs_replaced, V8.CrankshaftEscapeAllocsReplaced) \ |
695 SC(turbo_escape_loads_replaced, V8.TurboEscapeLoadsReplaced) \ | 697 SC(turbo_escape_loads_replaced, V8.TurboEscapeLoadsReplaced) \ |
696 SC(crankshaft_escape_loads_replaced, V8.CrankshaftEscapeLoadsReplaced) \ | 698 SC(crankshaft_escape_loads_replaced, V8.CrankshaftEscapeLoadsReplaced) \ |
697 /* Total code size (including metadata) of baseline code or bytecode. */ \ | 699 /* Total code size (including metadata) of baseline code or bytecode. */ \ |
698 SC(total_baseline_code_size, V8.TotalBaselineCodeSize) \ | 700 SC(total_baseline_code_size, V8.TotalBaselineCodeSize) \ |
699 /* Total count of functions compiled using the baseline compiler. */ \ | 701 /* Total count of functions compiled using the baseline compiler. */ \ |
700 SC(total_baseline_compile_count, V8.TotalBaselineCompileCount) | 702 SC(total_baseline_compile_count, V8.TotalBaselineCompileCount) |
701 | 703 |
| 704 struct RuntimeCallStats { |
| 705 #define CALL_RUNTIME_COUNTER(name, nargs, ressize) \ |
| 706 uint32_t Count_Runtime_##name; \ |
| 707 base::TimeDelta Time_Runtime_##name; |
| 708 FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER) |
| 709 #undef CALL_RUNTIME_COUNTER |
| 710 #define CALL_BUILTIN_COUNTER(name, type) \ |
| 711 uint32_t Count_Builtin_##name; \ |
| 712 base::TimeDelta Time_Builtin_##name; |
| 713 BUILTIN_LIST_C(CALL_BUILTIN_COUNTER) |
| 714 #undef CALL_BUILTIN_COUNTER |
| 715 |
| 716 // Dummy counter for the unexpected stub miss. |
| 717 uint32_t Count_UnexpectedStubMiss; |
| 718 base::TimeDelta Time_UnexpectedStubMiss; |
| 719 |
| 720 bool in_runtime_call = false; |
| 721 |
| 722 void Reset(); |
| 723 void Print(std::ostream& os); |
| 724 |
| 725 RuntimeCallStats() { Reset(); } |
| 726 }; |
| 727 |
702 // This file contains all the v8 counters that are in use. | 728 // This file contains all the v8 counters that are in use. |
703 class Counters { | 729 class Counters { |
704 public: | 730 public: |
705 #define HR(name, caption, min, max, num_buckets) \ | 731 #define HR(name, caption, min, max, num_buckets) \ |
706 Histogram* name() { return &name##_; } | 732 Histogram* name() { return &name##_; } |
707 HISTOGRAM_RANGE_LIST(HR) | 733 HISTOGRAM_RANGE_LIST(HR) |
708 #undef HR | 734 #undef HR |
709 | 735 |
710 #define HT(name, caption, max, res) \ | 736 #define HT(name, caption, max, res) \ |
711 HistogramTimer* name() { return &name##_; } | 737 HistogramTimer* name() { return &name##_; } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 #undef COUNTER_ID | 828 #undef COUNTER_ID |
803 #define COUNTER_ID(name) kCountOfCODE_AGE__##name, \ | 829 #define COUNTER_ID(name) kCountOfCODE_AGE__##name, \ |
804 kSizeOfCODE_AGE__##name, | 830 kSizeOfCODE_AGE__##name, |
805 CODE_AGE_LIST_COMPLETE(COUNTER_ID) | 831 CODE_AGE_LIST_COMPLETE(COUNTER_ID) |
806 #undef COUNTER_ID | 832 #undef COUNTER_ID |
807 stats_counter_count | 833 stats_counter_count |
808 }; | 834 }; |
809 | 835 |
810 void ResetCounters(); | 836 void ResetCounters(); |
811 void ResetHistograms(); | 837 void ResetHistograms(); |
| 838 RuntimeCallStats* runtime_call_stats() { return &runtime_call_stats_; } |
812 | 839 |
813 private: | 840 private: |
814 #define HR(name, caption, min, max, num_buckets) Histogram name##_; | 841 #define HR(name, caption, min, max, num_buckets) Histogram name##_; |
815 HISTOGRAM_RANGE_LIST(HR) | 842 HISTOGRAM_RANGE_LIST(HR) |
816 #undef HR | 843 #undef HR |
817 | 844 |
818 #define HT(name, caption, max, res) HistogramTimer name##_; | 845 #define HT(name, caption, max, res) HistogramTimer name##_; |
819 HISTOGRAM_TIMER_LIST(HT) | 846 HISTOGRAM_TIMER_LIST(HT) |
820 #undef HT | 847 #undef HT |
821 | 848 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 StatsCounter count_of_FIXED_ARRAY_##name##_; | 890 StatsCounter count_of_FIXED_ARRAY_##name##_; |
864 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC) | 891 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC) |
865 #undef SC | 892 #undef SC |
866 | 893 |
867 #define SC(name) \ | 894 #define SC(name) \ |
868 StatsCounter size_of_CODE_AGE_##name##_; \ | 895 StatsCounter size_of_CODE_AGE_##name##_; \ |
869 StatsCounter count_of_CODE_AGE_##name##_; | 896 StatsCounter count_of_CODE_AGE_##name##_; |
870 CODE_AGE_LIST_COMPLETE(SC) | 897 CODE_AGE_LIST_COMPLETE(SC) |
871 #undef SC | 898 #undef SC |
872 | 899 |
| 900 RuntimeCallStats runtime_call_stats_; |
| 901 |
873 friend class Isolate; | 902 friend class Isolate; |
874 | 903 |
875 explicit Counters(Isolate* isolate); | 904 explicit Counters(Isolate* isolate); |
876 | 905 |
877 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 906 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
878 }; | 907 }; |
879 | 908 |
880 } // namespace internal | 909 } // namespace internal |
881 } // namespace v8 | 910 } // namespace v8 |
882 | 911 |
883 #endif // V8_COUNTERS_H_ | 912 #endif // V8_COUNTERS_H_ |
OLD | NEW |