Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: src/counters.h

Issue 2795763002: Collect array buffer allocation sizes for UMA in megabytes. (Closed)
Patch Set: Fix that allocation size can be zero. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/counters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/atomic-utils.h" 10 #include "src/base/atomic-utils.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 const char* name_; 222 const char* name_;
223 int min_; 223 int min_;
224 int max_; 224 int max_;
225 int num_buckets_; 225 int num_buckets_;
226 void* histogram_; 226 void* histogram_;
227 bool lookup_done_; 227 bool lookup_done_;
228 Isolate* isolate_; 228 Isolate* isolate_;
229 }; 229 };
230 230
231 // A histogram base on megabytes. Use method add() to add a value to
232 // the table.
233 class MegabyteHistogram : public Histogram {
234 public:
235 MegabyteHistogram() {}
236 MegabyteHistogram(const char* name, int min, int max, int num_buckets,
237 Isolate* isolate)
238 : Histogram(name, min, max, num_buckets, isolate) {}
239
240 void Add(size_t size) {
241 constexpr size_t kBitsInMegabyte = 20;
242 AddSample(static_cast<int>(size >> kBitsInMegabyte));
243 }
244 };
bbudge 2017/04/03 18:02:41 This seems like a lot just to scale the sizes, and
kschimpf 2017/04/03 19:20:55 After considerable discussion, we decided to move
245
231 // A HistogramTimer allows distributions of results to be created. 246 // A HistogramTimer allows distributions of results to be created.
232 class HistogramTimer : public Histogram { 247 class HistogramTimer : public Histogram {
233 public: 248 public:
234 enum Resolution { 249 enum Resolution {
235 MILLISECOND, 250 MILLISECOND,
236 MICROSECOND 251 MICROSECOND
237 }; 252 };
238 253
239 HistogramTimer() {} 254 HistogramTimer() {}
240 HistogramTimer(const char* name, int min, int max, Resolution resolution, 255 HistogramTimer(const char* name, int min, int max, Resolution resolution,
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 HR(errors_thrown_per_context, V8.ErrorsThrownPerContext, 0, 200, 20) \ 936 HR(errors_thrown_per_context, V8.ErrorsThrownPerContext, 0, 200, 20) \
922 HR(debug_feature_usage, V8.DebugFeatureUsage, 1, 7, 7) \ 937 HR(debug_feature_usage, V8.DebugFeatureUsage, 1, 7, 7) \
923 HR(incremental_marking_reason, V8.GCIncrementalMarkingReason, 0, 21, 22) \ 938 HR(incremental_marking_reason, V8.GCIncrementalMarkingReason, 0, 21, 22) \
924 HR(mark_compact_reason, V8.GCMarkCompactReason, 0, 21, 22) \ 939 HR(mark_compact_reason, V8.GCMarkCompactReason, 0, 21, 22) \
925 HR(scavenge_reason, V8.GCScavengeReason, 0, 21, 22) \ 940 HR(scavenge_reason, V8.GCScavengeReason, 0, 21, 22) \
926 HR(young_generation_handling, V8.GCYoungGenerationHandling, 0, 2, 3) \ 941 HR(young_generation_handling, V8.GCYoungGenerationHandling, 0, 2, 3) \
927 /* Asm/Wasm. */ \ 942 /* Asm/Wasm. */ \
928 HR(wasm_functions_per_asm_module, V8.WasmFunctionsPerModule.asm, 1, 100000, \ 943 HR(wasm_functions_per_asm_module, V8.WasmFunctionsPerModule.asm, 1, 100000, \
929 51) \ 944 51) \
930 HR(wasm_functions_per_wasm_module, V8.WasmFunctionsPerModule.wasm, 1, \ 945 HR(wasm_functions_per_wasm_module, V8.WasmFunctionsPerModule.wasm, 1, \
931 100000, 51) \ 946 100000, 51)
932 HR(array_buffer_big_allocations, V8.ArrayBufferBigAllocations, 1, 32, 32) \ 947
933 HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 1, 32, 32) 948 #define MEGABYTE_HISTOGRAM_RANGE_LIST(HR) \
949 HR(array_buffer_big_allocations, V8.ArrayBufferBigAllocations, 0, 4096, 13) \
950 HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 0, 4096, 13)
934 951
935 #define HISTOGRAM_TIMER_LIST(HT) \ 952 #define HISTOGRAM_TIMER_LIST(HT) \
936 /* Garbage collection timers. */ \ 953 /* Garbage collection timers. */ \
937 HT(gc_compactor, V8.GCCompactor, 10000, MILLISECOND) \ 954 HT(gc_compactor, V8.GCCompactor, 10000, MILLISECOND) \
938 HT(gc_finalize, V8.GCFinalizeMC, 10000, MILLISECOND) \ 955 HT(gc_finalize, V8.GCFinalizeMC, 10000, MILLISECOND) \
939 HT(gc_finalize_reduce_memory, V8.GCFinalizeMCReduceMemory, 10000, \ 956 HT(gc_finalize_reduce_memory, V8.GCFinalizeMCReduceMemory, 10000, \
940 MILLISECOND) \ 957 MILLISECOND) \
941 HT(gc_scavenger, V8.GCScavenger, 10000, MILLISECOND) \ 958 HT(gc_scavenger, V8.GCScavenger, 10000, MILLISECOND) \
942 HT(gc_context, V8.GCContext, 10000, \ 959 HT(gc_context, V8.GCContext, 10000, \
943 MILLISECOND) /* GC context cleanup time */ \ 960 MILLISECOND) /* GC context cleanup time */ \
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 SC(wasm_lazily_compiled_functions, V8.WasmLazilyCompiledFunctions) 1178 SC(wasm_lazily_compiled_functions, V8.WasmLazilyCompiledFunctions)
1162 1179
1163 // This file contains all the v8 counters that are in use. 1180 // This file contains all the v8 counters that are in use.
1164 class Counters { 1181 class Counters {
1165 public: 1182 public:
1166 #define HR(name, caption, min, max, num_buckets) \ 1183 #define HR(name, caption, min, max, num_buckets) \
1167 Histogram* name() { return &name##_; } 1184 Histogram* name() { return &name##_; }
1168 HISTOGRAM_RANGE_LIST(HR) 1185 HISTOGRAM_RANGE_LIST(HR)
1169 #undef HR 1186 #undef HR
1170 1187
1188 #define HR(name, caption, min, max, num_buckets) \
1189 MegabyteHistogram* name() { return &name##_; }
1190 MEGABYTE_HISTOGRAM_RANGE_LIST(HR)
1191 #undef HR
1192
1171 #define HT(name, caption, max, res) \ 1193 #define HT(name, caption, max, res) \
1172 HistogramTimer* name() { return &name##_; } 1194 HistogramTimer* name() { return &name##_; }
1173 HISTOGRAM_TIMER_LIST(HT) 1195 HISTOGRAM_TIMER_LIST(HT)
1174 #undef HT 1196 #undef HT
1175 1197
1176 #define AHT(name, caption) \ 1198 #define AHT(name, caption) \
1177 AggregatableHistogramTimer* name() { return &name##_; } 1199 AggregatableHistogramTimer* name() { return &name##_; }
1178 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) 1200 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
1179 #undef AHT 1201 #undef AHT
1180 1202
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 1292
1271 void ResetCounters(); 1293 void ResetCounters();
1272 void ResetHistograms(); 1294 void ResetHistograms();
1273 RuntimeCallStats* runtime_call_stats() { return &runtime_call_stats_; } 1295 RuntimeCallStats* runtime_call_stats() { return &runtime_call_stats_; }
1274 1296
1275 private: 1297 private:
1276 #define HR(name, caption, min, max, num_buckets) Histogram name##_; 1298 #define HR(name, caption, min, max, num_buckets) Histogram name##_;
1277 HISTOGRAM_RANGE_LIST(HR) 1299 HISTOGRAM_RANGE_LIST(HR)
1278 #undef HR 1300 #undef HR
1279 1301
1302 #define HR(name, caption, min, max, num_buckets) MegabyteHistogram name##_;
1303 MEGABYTE_HISTOGRAM_RANGE_LIST(HR)
1304 #undef HR
1305
1280 #define HT(name, caption, max, res) HistogramTimer name##_; 1306 #define HT(name, caption, max, res) HistogramTimer name##_;
1281 HISTOGRAM_TIMER_LIST(HT) 1307 HISTOGRAM_TIMER_LIST(HT)
1282 #undef HT 1308 #undef HT
1283 1309
1284 #define AHT(name, caption) \ 1310 #define AHT(name, caption) \
1285 AggregatableHistogramTimer name##_; 1311 AggregatableHistogramTimer name##_;
1286 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) 1312 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
1287 #undef AHT 1313 #undef AHT
1288 1314
1289 #define HP(name, caption) \ 1315 #define HP(name, caption) \
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 1364
1339 explicit Counters(Isolate* isolate); 1365 explicit Counters(Isolate* isolate);
1340 1366
1341 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); 1367 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
1342 }; 1368 };
1343 1369
1344 } // namespace internal 1370 } // namespace internal
1345 } // namespace v8 1371 } // namespace v8
1346 1372
1347 #endif // V8_COUNTERS_H_ 1373 #endif // V8_COUNTERS_H_
OLDNEW
« no previous file with comments | « no previous file | src/counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698