OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 static int *FindLocation(const char* name) { | 68 static int *FindLocation(const char* name) { |
69 if (!lookup_function_) return NULL; | 69 if (!lookup_function_) return NULL; |
70 return lookup_function_(name); | 70 return lookup_function_(name); |
71 } | 71 } |
72 | 72 |
73 // Create a histogram by name. If the create is successful, | 73 // Create a histogram by name. If the create is successful, |
74 // returns a non-NULL pointer for use with AddHistogramSample | 74 // returns a non-NULL pointer for use with AddHistogramSample |
75 // function. min and max define the expected minimum and maximum | 75 // function. min and max define the expected minimum and maximum |
76 // sample values. buckets is the maximum number of buckets | 76 // sample values. buckets is the maximum number of buckets |
77 // that the samples will be grouped into. | 77 // that the samples will be grouped into. |
78 static void *CreateHistogram(const char* name, | 78 static void* CreateHistogram(const char* name, |
79 int min, | 79 int min, |
80 int max, | 80 int max, |
81 size_t buckets) { | 81 size_t buckets) { |
82 if (!create_histogram_function_) return NULL; | 82 if (!create_histogram_function_) return NULL; |
83 return create_histogram_function_(name, min, max, buckets); | 83 return create_histogram_function_(name, min, max, buckets); |
84 } | 84 } |
85 | 85 |
86 // Add a sample to a histogram created with the CreateHistogram | 86 // Add a sample to a histogram created with the CreateHistogram |
87 // function. | 87 // function. |
88 static void AddHistogramSample(void* histogram, int sample) { | 88 static void AddHistogramSample(void* histogram, int sample) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 timer_->Stop(); | 230 timer_->Stop(); |
231 } | 231 } |
232 private: | 232 private: |
233 HistogramTimer* timer_; | 233 HistogramTimer* timer_; |
234 }; | 234 }; |
235 | 235 |
236 | 236 |
237 } } // namespace v8::internal | 237 } } // namespace v8::internal |
238 | 238 |
239 #endif // V8_COUNTERS_H_ | 239 #endif // V8_COUNTERS_H_ |
OLD | NEW |