| OLD | NEW |
| 1 // Copyright 2012 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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "v8-counters.h" | 30 #include "v8-counters.h" |
| 31 | 31 |
| 32 namespace v8 { | 32 namespace v8 { |
| 33 namespace internal { | 33 namespace internal { |
| 34 | 34 |
| 35 Counters::Counters() { | 35 Counters::Counters(Isolate* isolate) { |
| 36 #define HT(name, caption) \ | 36 #define HT(name, caption) \ |
| 37 HistogramTimer name = { {#caption, 0, 10000, 50, NULL, false}, 0, 0 }; \ | 37 name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate); |
| 38 name##_ = name; | |
| 39 HISTOGRAM_TIMER_LIST(HT) | 38 HISTOGRAM_TIMER_LIST(HT) |
| 40 #undef HT | 39 #undef HT |
| 41 | 40 |
| 42 #define HP(name, caption) \ | 41 #define HP(name, caption) \ |
| 43 Histogram name = { #caption, 0, 101, 100, NULL, false }; \ | 42 name##_ = Histogram(#caption, 0, 101, 100, isolate); |
| 44 name##_ = name; | |
| 45 HISTOGRAM_PERCENTAGE_LIST(HP) | 43 HISTOGRAM_PERCENTAGE_LIST(HP) |
| 46 #undef HP | 44 #undef HP |
| 47 | 45 |
| 48 #define HM(name, caption) \ | 46 #define HM(name, caption) \ |
| 49 Histogram name = { #caption, 1000, 500000, 50, NULL, false }; \ | 47 name##_ = Histogram(#caption, 1000, 500000, 50, isolate); |
| 50 name##_ = name; | |
| 51 HISTOGRAM_MEMORY_LIST(HM) | 48 HISTOGRAM_MEMORY_LIST(HM) |
| 52 #undef HM | 49 #undef HM |
| 53 | 50 |
| 54 #define SC(name, caption) \ | 51 #define SC(name, caption) \ |
| 55 StatsCounter name = { "c:" #caption, NULL, false };\ | 52 name##_ = StatsCounter("c:" #caption); |
| 56 name##_ = name; | |
| 57 | 53 |
| 58 STATS_COUNTER_LIST_1(SC) | 54 STATS_COUNTER_LIST_1(SC) |
| 59 STATS_COUNTER_LIST_2(SC) | 55 STATS_COUNTER_LIST_2(SC) |
| 60 #undef SC | 56 #undef SC |
| 61 | 57 |
| 62 #define SC(name) \ | 58 #define SC(name) \ |
| 63 StatsCounter count_of_##name = { "c:" "V8.CountOf_" #name, NULL, false };\ | 59 count_of_##name##_ = StatsCounter("c:" "V8.CountOf_" #name); \ |
| 64 count_of_##name##_ = count_of_##name; \ | 60 size_of_##name##_ = StatsCounter("c:" "V8.SizeOf_" #name); |
| 65 StatsCounter size_of_##name = { "c:" "V8.SizeOf_" #name, NULL, false };\ | |
| 66 size_of_##name##_ = size_of_##name; | |
| 67 INSTANCE_TYPE_LIST(SC) | 61 INSTANCE_TYPE_LIST(SC) |
| 68 #undef SC | 62 #undef SC |
| 69 | 63 |
| 70 #define SC(name) \ | 64 #define SC(name) \ |
| 71 StatsCounter count_of_CODE_TYPE_##name = { \ | 65 count_of_CODE_TYPE_##name##_ = \ |
| 72 "c:" "V8.CountOf_CODE_TYPE-" #name, NULL, false }; \ | 66 StatsCounter("c:" "V8.CountOf_CODE_TYPE-" #name); \ |
| 73 count_of_CODE_TYPE_##name##_ = count_of_CODE_TYPE_##name; \ | 67 size_of_CODE_TYPE_##name##_ = \ |
| 74 StatsCounter size_of_CODE_TYPE_##name = { \ | 68 StatsCounter("c:" "V8.SizeOf_CODE_TYPE-" #name); |
| 75 "c:" "V8.SizeOf_CODE_TYPE-" #name, NULL, false }; \ | |
| 76 size_of_CODE_TYPE_##name##_ = size_of_CODE_TYPE_##name; | |
| 77 CODE_KIND_LIST(SC) | 69 CODE_KIND_LIST(SC) |
| 78 #undef SC | 70 #undef SC |
| 79 | 71 |
| 80 #define SC(name) \ | 72 #define SC(name) \ |
| 81 StatsCounter count_of_FIXED_ARRAY_##name = { \ | 73 count_of_FIXED_ARRAY_##name##_ = \ |
| 82 "c:" "V8.CountOf_FIXED_ARRAY-" #name, NULL, false }; \ | 74 StatsCounter("c:" "V8.CountOf_FIXED_ARRAY-" #name); \ |
| 83 count_of_FIXED_ARRAY_##name##_ = count_of_FIXED_ARRAY_##name; \ | 75 size_of_FIXED_ARRAY_##name##_ = \ |
| 84 StatsCounter size_of_FIXED_ARRAY_##name = { \ | 76 StatsCounter("c:" "V8.SizeOf_FIXED_ARRAY-" #name); \ |
| 85 "c:" "V8.SizeOf_FIXED_ARRAY-" #name, NULL, false }; \ | |
| 86 size_of_FIXED_ARRAY_##name##_ = size_of_FIXED_ARRAY_##name; | |
| 87 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC) | 77 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC) |
| 88 #undef SC | 78 #undef SC |
| 89 } | 79 } |
| 90 | 80 |
| 91 void Counters::ResetHistograms() { | 81 void Counters::ResetHistograms() { |
| 92 #define HT(name, caption) name##_.Reset(); | 82 #define HT(name, caption) name##_.Reset(); |
| 93 HISTOGRAM_TIMER_LIST(HT) | 83 HISTOGRAM_TIMER_LIST(HT) |
| 94 #undef HT | 84 #undef HT |
| 95 | 85 |
| 96 #define HP(name, caption) name##_.Reset(); | 86 #define HP(name, caption) name##_.Reset(); |
| 97 HISTOGRAM_PERCENTAGE_LIST(HP) | 87 HISTOGRAM_PERCENTAGE_LIST(HP) |
| 98 #undef HP | 88 #undef HP |
| 99 | 89 |
| 100 #define HM(name, caption) name##_.Reset(); | 90 #define HM(name, caption) name##_.Reset(); |
| 101 HISTOGRAM_MEMORY_LIST(HM) | 91 HISTOGRAM_MEMORY_LIST(HM) |
| 102 #undef HM | 92 #undef HM |
| 103 } | 93 } |
| 104 | 94 |
| 105 } } // namespace v8::internal | 95 } } // namespace v8::internal |
| OLD | NEW |