v8  3.14.5(node0.10.28)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
v8-counters.cc
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
27 
28 #include "v8.h"
29 
30 #include "v8-counters.h"
31 
32 namespace v8 {
33 namespace internal {
34 
35 Counters::Counters() {
36 #define HT(name, caption) \
37  HistogramTimer name = { {#caption, 0, 10000, 50, NULL, false}, 0, 0 }; \
38  name##_ = name;
40 #undef HT
41 
42 #define HP(name, caption) \
43  Histogram name = { #caption, 0, 101, 100, NULL, false }; \
44  name##_ = name;
46 #undef HP
47 
48 #define HM(name, caption) \
49  Histogram name = { #caption, 1000, 500000, 50, NULL, false }; \
50  name##_ = name;
52 #undef HM
53 
54 #define SC(name, caption) \
55  StatsCounter name = { "c:" #caption, NULL, false };\
56  name##_ = name;
57 
60 #undef SC
61 
62 #define SC(name) \
63  StatsCounter count_of_##name = { "c:" "V8.CountOf_" #name, NULL, false };\
64  count_of_##name##_ = count_of_##name; \
65  StatsCounter size_of_##name = { "c:" "V8.SizeOf_" #name, NULL, false };\
66  size_of_##name##_ = size_of_##name;
68 #undef SC
69 
70 #define SC(name) \
71  StatsCounter count_of_CODE_TYPE_##name = { \
72  "c:" "V8.CountOf_CODE_TYPE-" #name, NULL, false }; \
73  count_of_CODE_TYPE_##name##_ = count_of_CODE_TYPE_##name; \
74  StatsCounter size_of_CODE_TYPE_##name = { \
75  "c:" "V8.SizeOf_CODE_TYPE-" #name, NULL, false }; \
76  size_of_CODE_TYPE_##name##_ = size_of_CODE_TYPE_##name;
78 #undef SC
79 
80 #define SC(name) \
81  StatsCounter count_of_FIXED_ARRAY_##name = { \
82  "c:" "V8.CountOf_FIXED_ARRAY-" #name, NULL, false }; \
83  count_of_FIXED_ARRAY_##name##_ = count_of_FIXED_ARRAY_##name; \
84  StatsCounter size_of_FIXED_ARRAY_##name = { \
85  "c:" "V8.SizeOf_FIXED_ARRAY-" #name, NULL, false }; \
86  size_of_FIXED_ARRAY_##name##_ = size_of_FIXED_ARRAY_##name;
88 #undef SC
89 
90  StatsCounter state_counters[] = {
91 #define COUNTER_NAME(name) \
92  { "c:V8.State" #name, NULL, false },
94 #undef COUNTER_NAME
95  };
96 
97  for (int i = 0; i < kSlidingStateWindowCounterCount; ++i) {
98  state_counters_[i] = state_counters[i];
99  }
100 }
101 
103 #define HT(name, caption) name##_.Reset();
105 #undef HT
106 
107 #define HP(name, caption) name##_.Reset();
109 #undef HP
110 
111 #define HM(name, caption) name##_.Reset();
113 #undef HM
114 }
115 
116 } } // namespace v8::internal
#define INSTANCE_TYPE_LIST(V)
Definition: objects.h:318
#define HM(name, caption)
#define STATS_COUNTER_LIST_2(SC)
Definition: v8-counters.h:147
#define HISTOGRAM_MEMORY_LIST(HM)
Definition: v8-counters.h:75
#define HISTOGRAM_PERCENTAGE_LIST(HP)
Definition: v8-counters.h:54
#define HT(name, caption)
#define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V)
Definition: objects.h:675
#define CODE_KIND_LIST(V)
Definition: objects.h:4187
#define SC(name, caption)
#define HISTOGRAM_TIMER_LIST(HT)
Definition: v8-counters.h:39
#define HP(name, caption)
#define COUNTER_NAME(name)
#define STATS_COUNTER_LIST_1(SC)
Definition: v8-counters.h:89
StatsCounter * state_counters(StateTag state)
Definition: v8-counters.h:383
#define STATE_TAG_LIST(V)
Definition: v8globals.h:354