| 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" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // Returns true if this histogram is enabled. | 191 // Returns true if this histogram is enabled. |
| 192 bool Enabled() { | 192 bool Enabled() { |
| 193 return GetHistogram() != NULL; | 193 return GetHistogram() != NULL; |
| 194 } | 194 } |
| 195 | 195 |
| 196 // Reset the cached internal pointer. | 196 // Reset the cached internal pointer. |
| 197 void Reset() { | 197 void Reset() { |
| 198 lookup_done_ = false; | 198 lookup_done_ = false; |
| 199 } | 199 } |
| 200 | 200 |
| 201 const char* name() { return name_; } |
| 202 |
| 201 protected: | 203 protected: |
| 202 // Returns the handle to the histogram. | 204 // Returns the handle to the histogram. |
| 203 void* GetHistogram() { | 205 void* GetHistogram() { |
| 204 if (!lookup_done_) { | 206 if (!lookup_done_) { |
| 205 lookup_done_ = true; | 207 lookup_done_ = true; |
| 206 histogram_ = CreateHistogram(); | 208 histogram_ = CreateHistogram(); |
| 207 } | 209 } |
| 208 return histogram_; | 210 return histogram_; |
| 209 } | 211 } |
| 210 | 212 |
| 211 const char* name() { return name_; } | |
| 212 Isolate* isolate() const { return isolate_; } | 213 Isolate* isolate() const { return isolate_; } |
| 213 | 214 |
| 214 private: | 215 private: |
| 215 void* CreateHistogram() const; | 216 void* CreateHistogram() const; |
| 216 | 217 |
| 217 const char* name_; | 218 const char* name_; |
| 218 int min_; | 219 int min_; |
| 219 int max_; | 220 int max_; |
| 220 int num_buckets_; | 221 int num_buckets_; |
| 221 void* histogram_; | 222 void* histogram_; |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 | 917 |
| 917 explicit Counters(Isolate* isolate); | 918 explicit Counters(Isolate* isolate); |
| 918 | 919 |
| 919 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); | 920 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
| 920 }; | 921 }; |
| 921 | 922 |
| 922 } // namespace internal | 923 } // namespace internal |
| 923 } // namespace v8 | 924 } // namespace v8 |
| 924 | 925 |
| 925 #endif // V8_COUNTERS_H_ | 926 #endif // V8_COUNTERS_H_ |
| OLD | NEW |