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
3 // found in the LICENSE file.
7 #include "v8-counters.h"
12 Counters::Counters(Isolate* isolate) {
13 #define HT(name, caption) \
14 name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate);
15 HISTOGRAM_TIMER_LIST(HT)
18 #define HP(name, caption) \
19 name##_ = Histogram(#caption, 0, 101, 100, isolate);
20 HISTOGRAM_PERCENTAGE_LIST(HP)
23 #define HM(name, caption) \
24 name##_ = Histogram(#caption, 1000, 500000, 50, isolate);
25 HISTOGRAM_MEMORY_LIST(HM)
28 #define SC(name, caption) \
29 name##_ = StatsCounter(isolate, "c:" #caption);
31 STATS_COUNTER_LIST_1(SC)
32 STATS_COUNTER_LIST_2(SC)
36 count_of_##name##_ = StatsCounter(isolate, "c:" "V8.CountOf_" #name); \
37 size_of_##name##_ = StatsCounter(isolate, "c:" "V8.SizeOf_" #name);
38 INSTANCE_TYPE_LIST(SC)
42 count_of_CODE_TYPE_##name##_ = \
43 StatsCounter(isolate, "c:" "V8.CountOf_CODE_TYPE-" #name); \
44 size_of_CODE_TYPE_##name##_ = \
45 StatsCounter(isolate, "c:" "V8.SizeOf_CODE_TYPE-" #name);
50 count_of_FIXED_ARRAY_##name##_ = \
51 StatsCounter(isolate, "c:" "V8.CountOf_FIXED_ARRAY-" #name); \
52 size_of_FIXED_ARRAY_##name##_ = \
53 StatsCounter(isolate, "c:" "V8.SizeOf_FIXED_ARRAY-" #name);
54 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
58 count_of_CODE_AGE_##name##_ = \
59 StatsCounter(isolate, "c:" "V8.CountOf_CODE_AGE-" #name); \
60 size_of_CODE_AGE_##name##_ = \
61 StatsCounter(isolate, "c:" "V8.SizeOf_CODE_AGE-" #name);
62 CODE_AGE_LIST_COMPLETE(SC)
67 void Counters::ResetHistograms() {
68 #define HT(name, caption) name##_.Reset();
69 HISTOGRAM_TIMER_LIST(HT)
72 #define HP(name, caption) name##_.Reset();
73 HISTOGRAM_PERCENTAGE_LIST(HP)
76 #define HM(name, caption) name##_.Reset();
77 HISTOGRAM_MEMORY_LIST(HM)
81 } } // namespace v8::internal