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