Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / v8 / src / v8-counters.cc
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.
4
5 #include "v8.h"
6
7 #include "v8-counters.h"
8
9 namespace v8 {
10 namespace internal {
11
12 Counters::Counters(Isolate* isolate) {
13 #define HT(name, caption) \
14     name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate);
15     HISTOGRAM_TIMER_LIST(HT)
16 #undef HT
17
18 #define HP(name, caption) \
19     name##_ = Histogram(#caption, 0, 101, 100, isolate);
20     HISTOGRAM_PERCENTAGE_LIST(HP)
21 #undef HP
22
23 #define HM(name, caption) \
24     name##_ = Histogram(#caption, 1000, 500000, 50, isolate);
25     HISTOGRAM_MEMORY_LIST(HM)
26 #undef HM
27
28 #define SC(name, caption) \
29     name##_ = StatsCounter(isolate, "c:" #caption);
30
31     STATS_COUNTER_LIST_1(SC)
32     STATS_COUNTER_LIST_2(SC)
33 #undef SC
34
35 #define SC(name) \
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)
39 #undef SC
40
41 #define SC(name) \
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);
46     CODE_KIND_LIST(SC)
47 #undef SC
48
49 #define SC(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)
55 #undef SC
56
57 #define SC(name) \
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)
63 #undef SC
64 }
65
66
67 void Counters::ResetHistograms() {
68 #define HT(name, caption) name##_.Reset();
69     HISTOGRAM_TIMER_LIST(HT)
70 #undef HT
71
72 #define HP(name, caption) name##_.Reset();
73     HISTOGRAM_PERCENTAGE_LIST(HP)
74 #undef HP
75
76 #define HM(name, caption) name##_.Reset();
77     HISTOGRAM_MEMORY_LIST(HM)
78 #undef HM
79 }
80
81 } }  // namespace v8::internal