v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
counters.h
Go to the documentation of this file.
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#ifndef V8_LOGGING_COUNTERS_H_
6#define V8_LOGGING_COUNTERS_H_
7
8#include <memory>
9
14#include "src/common/globals.h"
18#include "src/objects/objects.h"
20
21namespace v8 {
22namespace internal {
23
24// StatsCounters is an interface for plugging into external
25// counters for monitoring. Counters can be looked up and
26// manipulated by name.
27
28class Counters;
29class Isolate;
30
32 public:
33 StatsTable(const StatsTable&) = delete;
34 StatsTable& operator=(const StatsTable&) = delete;
35
36 // Register an application-defined function for recording
37 // subsequent counter statistics.
39
40 // Register an application-defined function to create histograms for
41 // recording subsequent histogram samples.
45
46 // Register an application-defined function to add a sample
47 // to a histogram created with CreateHistogram function.
51
52 bool HasCounterFunction() const { return lookup_function_ != nullptr; }
53
54 // Lookup the location of a counter by name. If the lookup
55 // is successful, returns a non-nullptr pointer for writing the
56 // value of the counter. Each thread calling this function
57 // may receive a different location to store it's counter.
58 // The return value must not be cached and reused across
59 // threads, although a single thread is free to cache it.
60 int* FindLocation(const char* name) {
61 if (!lookup_function_) return nullptr;
62 return lookup_function_(name);
63 }
64
65 // Create a histogram by name. If the create is successful,
66 // returns a non-nullptr pointer for use with AddHistogramSample
67 // function. min and max define the expected minimum and maximum
68 // sample values. buckets is the maximum number of buckets
69 // that the samples will be grouped into.
70 void* CreateHistogram(const char* name, int min, int max, size_t buckets) {
71 if (!create_histogram_function_) return nullptr;
72 return create_histogram_function_(name, min, max, buckets);
73 }
74
75 // Add a sample to a histogram created with the CreateHistogram
76 // function.
77 void AddHistogramSample(void* histogram, int sample) {
79 return add_histogram_sample_function_(histogram, sample);
80 }
81
82 private:
83 friend class Counters;
84
85 explicit StatsTable(Counters* counters);
86
90};
91
92// StatsCounters are dynamically created values which can be tracked in the
93// StatsTable. They are designed to be lightweight to create and easy to use.
94//
95// Internally, a counter represents a value in a row of a StatsTable.
96// The row has a 32bit value for each process/thread in the table and also
97// a name (stored in the table metadata). Since the storage location can be
98// thread-specific, this class cannot be shared across threads.
99// This class is thread-safe.
101 public:
102 void Set(int value) { GetPtr()->store(value, std::memory_order_relaxed); }
103 int Get() { return GetPtr()->load(); }
104
105 void Increment(int value = 1) {
106 GetPtr()->fetch_add(value, std::memory_order_relaxed);
107 }
108
109 void Decrement(int value = 1) {
110 GetPtr()->fetch_sub(value, std::memory_order_relaxed);
111 }
112
113 // Returns true if this counter is enabled (a lookup function was provided and
114 // it returned a non-null pointer).
116
117 // Get the internal pointer to the counter. This is used
118 // by the code generator to emit code that manipulates a
119 // given counter without calling the runtime system.
120 std::atomic<int>* GetInternalPointer() { return GetPtr(); }
121
122 private:
123 friend class Counters;
126
127 void Initialize(const char* name, Counters* counters) {
129 DCHECK_NOT_NULL(counters);
130 // Counter names always start with "c:V8.".
131 DCHECK_EQ(0, memcmp(name, "c:V8.", 5));
132 counters_ = counters;
133 name_ = name;
134 }
135
137
138 // Reset the cached internal pointer.
139 void Reset() { ptr_.store(nullptr, std::memory_order_relaxed); }
140
141 // Returns the cached address of this counter location.
142 std::atomic<int>* GetPtr() {
143 auto* ptr = ptr_.load(std::memory_order_acquire);
144 if (V8_LIKELY(ptr)) return ptr;
145 return SetupPtrFromStatsTable();
146 }
147
148 Counters* counters_ = nullptr;
149 const char* name_ = nullptr;
150 // A pointer to an atomic, set atomically in {GetPtr}.
151 std::atomic<std::atomic<int>*> ptr_{nullptr};
152};
153
154// A Histogram represents a dynamically created histogram in the
155// StatsTable. Note: This class is thread safe.
157 public:
158 // Add a single sample to this histogram.
159 V8_EXPORT_PRIVATE void AddSample(int sample);
160
161 // Returns true if this histogram is enabled.
162 bool Enabled() { return histogram_ != nullptr; }
163
164 const char* name() const { return name_; }
165
166 int min() const { return min_; }
167 int max() const { return max_; }
168 int num_buckets() const { return num_buckets_; }
169
170 // Asserts that |expected_counters| are the same as the Counters this
171 // Histogram reports to.
172 void AssertReportsToCounters(Counters* expected_counters) {
173 DCHECK_EQ(counters_, expected_counters);
174 }
175
176 protected:
177 Histogram() = default;
178 Histogram(const Histogram&) = delete;
179 Histogram& operator=(const Histogram&) = delete;
180
181 void Initialize(const char* name, int min, int max, int num_buckets,
182 Counters* counters) {
183 name_ = name;
184 min_ = min;
185 max_ = max;
187 histogram_ = nullptr;
190 }
191
192 Counters* counters() const { return counters_; }
193
194 // Reset the cached internal pointer to nullptr; the histogram will be
195 // created lazily, the first time it is needed.
196 void Reset() { histogram_ = nullptr; }
197
198 // Lazily create the histogram, if it has not been created yet.
199 void EnsureCreated(bool create_new = true) {
200 if (create_new && histogram_.load(std::memory_order_acquire) == nullptr) {
202 if (histogram_.load(std::memory_order_relaxed) == nullptr)
203 histogram_.store(CreateHistogram(), std::memory_order_release);
204 }
205 }
206
207 private:
208 friend class Counters;
210 friend class HistogramResetter;
211
213
214 const char* name_;
215 int min_;
216 int max_;
218 std::atomic<void*> histogram_;
221};
222
223// Dummy classes for better visiting.
224
227
229
230// A thread safe histogram timer.
231class TimedHistogram : public Histogram {
232 public:
233 // Records a TimeDelta::Max() result. Useful to record percentage of tasks
234 // that never got to run in a given scenario. Log if isolate non-null.
235 void RecordAbandon(base::ElapsedTimer* timer, Isolate* isolate);
236
237 // Add a single sample to this histogram.
239
240#ifdef DEBUG
241 // Ensures that we don't have nested timers for TimedHistogram per thread, use
242 // NestedTimedHistogram which correctly pause and resume timers.
243 // This method assumes that each timer is alternating between stopped and
244 // started on a single thread. Multiple timers can be active on different
245 // threads.
246 bool ToggleRunningState(bool expected_is_running) const;
247#endif // DEBUG
248
249 protected:
250 void Stop(base::ElapsedTimer* timer);
251 void LogStart(Isolate* isolate);
252 void LogEnd(Isolate* isolate);
253
254 friend class Counters;
256
258
259 TimedHistogram() = default;
262
263 void Initialize(const char* name, int min, int max,
265 Counters* counters) {
266 Histogram::Initialize(name, min, max, num_buckets, counters);
267 resolution_ = resolution;
268 }
269};
270
271class NestedTimedHistogramScope;
272class PauseNestedTimedHistogramScope;
273
274// For use with the NestedTimedHistogramScope. 'Nested' here means that scopes
275// may have nested lifetimes while still correctly accounting for time, e.g.:
276//
277// void f() {
278// NestedTimedHistogramScope timer(...);
279// ...
280// f(); // Recursive call.
281// }
283 public:
284 // Note: public for testing purposes only.
285 NestedTimedHistogram(const char* name, int min, int max,
287 Counters* counters)
289 Initialize(name, min, max, resolution, num_buckets, counters);
290 }
291
292 private:
293 friend class Counters;
296
302
306
308
312};
313
314// A histogram timer that can aggregate events within a larger scope.
315//
316// Intended use of this timer is to have an outer (aggregating) and an inner
317// (to be aggregated) scope, where the inner scope measure the time of events,
318// and all those inner scope measurements will be summed up by the outer scope.
319// An example use might be to aggregate the time spent in lazy compilation
320// while running a script.
321//
322// Helpers:
323// - AggregatingHistogramTimerScope, the "outer" scope within which
324// times will be summed up.
325// - AggregatedHistogramTimerScope, the "inner" scope which defines the
326// events to be timed.
328 public:
329 // Start/stop the "outer" scope.
331 void Stop() {
332 if (time_ != base::TimeDelta()) {
333 // Only add non-zero samples, since zero samples represent situations
334 // where there were no aggregated samples added.
335 AddSample(static_cast<int>(time_.InMicroseconds()));
336 }
337 }
338
339 // Add a time value ("inner" scope).
340 void Add(base::TimeDelta other) { time_ += other; }
341
342 private:
343 friend class Counters;
344
348 delete;
349
351};
352
353// A helper class for use with AggregatableHistogramTimer. This is the
354// // outer-most timer scope used with an AggregatableHistogramTimer. It will
355// // aggregate the information from the inner AggregatedHistogramTimerScope.
357 public:
359 : histogram_(histogram) {
360 histogram_->Start();
361 }
362 ~AggregatingHistogramTimerScope() { histogram_->Stop(); }
363
364 private:
366};
367
368// A helper class for use with AggregatableHistogramTimer, the "inner" scope
369// // which defines the events to be timed.
371 public:
373 : histogram_(histogram) {
374 timer_.Start();
375 }
376 ~AggregatedHistogramTimerScope() { histogram_->Add(timer_.Elapsed()); }
377
378 private:
381};
382
383// AggretatedMemoryHistogram collects (time, value) sample pairs and turns
384// them into time-uniform samples for the backing histogram, such that the
385// backing histogram receives one sample every T ms, where the T is controlled
386// by the v8_flags.histogram_interval.
387//
388// More formally: let F be a real-valued function that maps time to sample
389// values. We define F as a linear interpolation between adjacent samples. For
390// each time interval [x; x + T) the backing histogram gets one sample value
391// that is the average of F(t) in the interval.
392template <typename Histogram>
394 public:
395 // Note: public for testing purposes only.
396 explicit AggregatedMemoryHistogram(Histogram* backing_histogram)
398 backing_histogram_ = backing_histogram;
399 }
400
401 // Invariants that hold before and after AddSample if
402 // is_initialized_ is true:
403 //
404 // 1) For we processed samples that came in before start_ms_ and sent the
405 // corresponding aggregated samples to backing histogram.
406 // 2) (last_ms_, last_value_) is the last received sample.
407 // 3) last_ms_ < start_ms_ + v8_flags.histogram_interval.
408 // 4) aggregate_value_ is the average of the function that is constructed by
409 // linearly interpolating samples received between start_ms_ and last_ms_.
410 void AddSample(double current_ms, double current_value);
411
412 private:
413 friend class Counters;
414
416 : is_initialized_(false),
417 start_ms_(0.0),
418 last_ms_(0.0),
419 aggregate_value_(0.0),
420 last_value_(0.0),
421 backing_histogram_(nullptr) {}
422 double Aggregate(double current_ms, double current_value);
423
425 double start_ms_;
426 double last_ms_;
430};
431
432template <typename Histogram>
434 double current_value) {
435 if (!is_initialized_) {
436 aggregate_value_ = current_value;
437 start_ms_ = current_ms;
438 last_value_ = current_value;
439 last_ms_ = current_ms;
440 is_initialized_ = true;
441 } else {
442 const double kEpsilon = 1e-6;
443 const int kMaxSamples = 1000;
444 if (current_ms < last_ms_ + kEpsilon) {
445 // Two samples have the same time, remember the last one.
446 last_value_ = current_value;
447 } else {
448 double sample_interval_ms = v8_flags.histogram_interval;
449 double end_ms = start_ms_ + sample_interval_ms;
450 if (end_ms <= current_ms + kEpsilon) {
451 // Linearly interpolate between the last_ms_ and the current_ms.
452 double slope = (current_value - last_value_) / (current_ms - last_ms_);
453 int i;
454 // Send aggregated samples to the backing histogram from the start_ms
455 // to the current_ms.
456 for (i = 0; i < kMaxSamples && end_ms <= current_ms + kEpsilon; i++) {
457 double end_value = last_value_ + (end_ms - last_ms_) * slope;
458 double sample_value;
459 if (i == 0) {
460 // Take aggregate_value_ into account.
461 sample_value = Aggregate(end_ms, end_value);
462 } else {
463 // There is no aggregate_value_ for i > 0.
464 sample_value = (last_value_ + end_value) / 2;
465 }
466 backing_histogram_->AddSample(static_cast<int>(sample_value + 0.5));
467 last_value_ = end_value;
468 last_ms_ = end_ms;
469 end_ms += sample_interval_ms;
470 }
471 if (i == kMaxSamples) {
472 // We hit the sample limit, ignore the remaining samples.
473 aggregate_value_ = current_value;
474 start_ms_ = current_ms;
475 } else {
476 aggregate_value_ = last_value_;
477 start_ms_ = last_ms_;
478 }
479 }
480 aggregate_value_ = current_ms > start_ms_ + kEpsilon
481 ? Aggregate(current_ms, current_value)
482 : aggregate_value_;
483 last_value_ = current_value;
484 last_ms_ = current_ms;
485 }
486 }
487}
488
489template <typename Histogram>
491 double current_value) {
492 double interval_ms = current_ms - start_ms_;
493 double value = (current_value + last_value_) / 2;
494 // The aggregate_value_ is the average for [start_ms_; last_ms_].
495 // The value is the average for [last_ms_; current_ms].
496 // Return the weighted average of the aggregate_value_ and the value.
497 return aggregate_value_ * ((last_ms_ - start_ms_) / interval_ms) +
498 value * ((current_ms - last_ms_) / interval_ms);
499}
500
501// This file contains all the v8 counters that are in use.
502class Counters : public std::enable_shared_from_this<Counters> {
503 public:
504 explicit Counters(Isolate* isolate);
505
506 // Register an application-defined function for recording
507 // subsequent counter statistics. Note: Must be called on the main
508 // thread.
510
511 // Register an application-defined function to create histograms for
512 // recording subsequent histogram samples. Note: Must be called on
513 // the main thread.
515
516 // Register an application-defined function to add a sample
517 // to a histogram. Will be used in all subsequent sample additions.
518 // Note: Must be called on the main thread.
522
523#define HR(name, caption, min, max, num_buckets) \
524 Histogram* name() { \
525 name##_.EnsureCreated(); \
526 return &name##_; \
527 }
529#undef HR
530
531#if V8_ENABLE_DRUMBRAKE
532#define HR(name, caption, min, max, num_buckets) \
533 Histogram* name() { \
534 name##_.EnsureCreated(v8_flags.slow_histograms); \
535 return &name##_; \
536 }
537 HISTOGRAM_RANGE_LIST_SLOW(HR)
538#undef HR
539#endif // V8_ENABLE_DRUMBRAKE
540
541#define HT(name, caption, max, res) \
542 NestedTimedHistogram* name() { \
543 name##_.EnsureCreated(); \
544 return &name##_; \
545 }
547#undef HT
548
549#define HT(name, caption, max, res) \
550 NestedTimedHistogram* name() { \
551 name##_.EnsureCreated(v8_flags.slow_histograms); \
552 return &name##_; \
553 }
555#undef HT
556
557#define HT(name, caption, max, res) \
558 TimedHistogram* name() { \
559 name##_.EnsureCreated(); \
560 return &name##_; \
561 }
563#undef HT
564
565#define AHT(name, caption) \
566 AggregatableHistogramTimer* name() { \
567 name##_.EnsureCreated(); \
568 return &name##_; \
569 }
571#undef AHT
572
573#define HP(name, caption) \
574 PercentageHistogram* name() { \
575 name##_.EnsureCreated(); \
576 return &name##_; \
577 }
579#undef HP
580
581#define HM(name, caption) \
582 LegacyMemoryHistogram* name() { \
583 name##_.EnsureCreated(); \
584 return &name##_; \
585 }
587#undef HM
588
589#define SC(name, caption) \
590 StatsCounter* name() { return &name##_; }
593#undef SC
594
595 // clang-format off
596 enum Id {
597#define RATE_ID(name, caption, max, res) k_##name,
601#undef RATE_ID
602#define AGGREGATABLE_ID(name, caption) k_##name,
604#undef AGGREGATABLE_ID
605#define PERCENTAGE_ID(name, caption) k_##name,
607#undef PERCENTAGE_ID
608#define MEMORY_ID(name, caption) k_##name,
610#undef MEMORY_ID
611#define COUNTER_ID(name, caption) k_##name,
614#undef COUNTER_ID
615#define COUNTER_ID(name) kCountOf##name, kSizeOf##name,
617#undef COUNTER_ID
618#define COUNTER_ID(name) kCountOfCODE_TYPE_##name, \
619 kSizeOfCODE_TYPE_##name,
621#undef COUNTER_ID
623 };
624 // clang-format on
625
626#ifdef V8_RUNTIME_CALL_STATS
627 RuntimeCallStats* runtime_call_stats() { return &runtime_call_stats_; }
628
629 WorkerThreadRuntimeCallStats* worker_thread_runtime_call_stats() {
630 return &worker_thread_runtime_call_stats_;
631 }
632#else // V8_RUNTIME_CALL_STATS
634
638#endif // V8_RUNTIME_CALL_STATS
639
640 private:
641 friend class CountersVisitor;
642 friend class Histogram;
644 friend class StatsCounter;
645 friend class StatsTable;
646
647 int* FindLocation(const char* name) {
648 return stats_table_.FindLocation(name);
649 }
650
651 void* CreateHistogram(const char* name, int min, int max, size_t buckets) {
652 return stats_table_.CreateHistogram(name, min, max, buckets);
653 }
654
655 void AddHistogramSample(void* histogram, int sample) {
656 stats_table_.AddHistogramSample(histogram, sample);
657 }
658
659 Isolate* isolate() { return isolate_; }
660
661#define HR(name, caption, min, max, num_buckets) Histogram name##_;
663#if V8_ENABLE_DRUMBRAKE
664 HISTOGRAM_RANGE_LIST_SLOW(HR)
665#endif // V8_ENABLE_DRUMBRAKE
666#undef HR
667
668#define HT(name, caption, max, res) NestedTimedHistogram name##_;
671#undef HT
672
673#define HT(name, caption, max, res) TimedHistogram name##_;
675#undef HT
676
677#define AHT(name, caption) AggregatableHistogramTimer name##_;
679#undef AHT
680
681#define HP(name, caption) PercentageHistogram name##_;
683#undef HP
684
685#define HM(name, caption) LegacyMemoryHistogram name##_;
687#undef HM
688
689#define SC(name, caption) StatsCounter name##_;
692#undef SC
693
694#ifdef V8_RUNTIME_CALL_STATS
695 RuntimeCallStats runtime_call_stats_;
696 WorkerThreadRuntimeCallStats worker_thread_runtime_call_stats_;
697#endif
700
702};
703
705 public:
706 explicit CountersVisitor(Counters* counters) : counters_(counters) {}
707
708 void Start();
710
711 protected:
712 virtual void VisitHistograms();
713 virtual void VisitStatsCounters();
714
715 virtual void VisitHistogram(Histogram* histogram, const char* caption) {}
716 virtual void VisitStatsCounter(StatsCounter* counter, const char* caption) {}
717
718 virtual void Visit(Histogram* histogram, const char* caption, int min,
719 int max, int num_buckets);
720 virtual void Visit(TimedHistogram* histogram, const char* caption, int max,
722 virtual void Visit(NestedTimedHistogram* histogram, const char* caption,
723 int max, TimedHistogramResolution res);
724 virtual void Visit(AggregatableHistogramTimer* histogram,
725 const char* caption);
726 virtual void Visit(PercentageHistogram* histogram, const char* caption);
727 virtual void Visit(LegacyMemoryHistogram* histogram, const char* caption);
728 virtual void Visit(StatsCounter* counter, const char* caption);
729
730 private:
732};
733
735 public:
737
738 protected:
739 void Visit(Histogram* histogram, const char* caption, int min, int max,
740 int num_buckets) final;
741 void Visit(TimedHistogram* histogram, const char* caption, int max,
742 TimedHistogramResolution res) final;
743 void Visit(NestedTimedHistogram* histogram, const char* caption, int max,
744 TimedHistogramResolution res) final;
745 void Visit(AggregatableHistogramTimer* histogram, const char* caption) final;
746 void Visit(PercentageHistogram* histogram, const char* caption) final;
747 void Visit(LegacyMemoryHistogram* histogram, const char* caption) final;
748 void Visit(StatsCounter* counter, const char* caption) final;
749};
750
752 public:
754
755 protected:
756 void VisitHistograms() final {}
757 void VisitStatsCounter(StatsCounter* counter, const char* caption) final;
758};
759
761 public:
763
764 protected:
765 void VisitStatsCounters() final {}
766 void VisitHistogram(Histogram* histogram, const char* caption) final;
767};
768
769} // namespace internal
770} // namespace v8
771
772#endif // V8_LOGGING_COUNTERS_H_
int64_t InMicroseconds() const
Definition time.cc:251
AggregatableHistogramTimer(const AggregatableHistogramTimer &)=delete
AggregatableHistogramTimer & operator=(const AggregatableHistogramTimer &)=delete
void Add(base::TimeDelta other)
Definition counters.h:340
AggregatedHistogramTimerScope(AggregatableHistogramTimer *histogram)
Definition counters.h:372
AggregatableHistogramTimer * histogram_
Definition counters.h:380
double Aggregate(double current_ms, double current_value)
Definition counters.h:490
AggregatedMemoryHistogram(Histogram *backing_histogram)
Definition counters.h:396
void AddSample(double current_ms, double current_value)
Definition counters.h:433
AggregatableHistogramTimer * histogram_
Definition counters.h:365
AggregatingHistogramTimerScope(AggregatableHistogramTimer *histogram)
Definition counters.h:358
void Visit(Histogram *histogram, const char *caption, int min, int max, int num_buckets) final
Definition counters.cc:113
virtual void VisitStatsCounter(StatsCounter *counter, const char *caption)
Definition counters.h:716
virtual void Visit(Histogram *histogram, const char *caption, int min, int max, int num_buckets)
Definition counters.cc:244
CountersVisitor(Counters *counters)
Definition counters.h:706
virtual void VisitHistogram(Histogram *histogram, const char *caption)
Definition counters.h:715
virtual void VisitStatsCounters()
Definition counters.cc:237
virtual void VisitHistograms()
Definition counters.cc:196
DISALLOW_IMPLICIT_CONSTRUCTORS(Counters)
void SetAddHistogramSampleFunction(AddHistogramSampleCallback f)
Definition counters.h:519
void AddHistogramSample(void *histogram, int sample)
Definition counters.h:655
void * CreateHistogram(const char *name, int min, int max, size_t buckets)
Definition counters.h:651
StatsTable stats_table_
Definition counters.h:699
void ResetCreateHistogramFunction(CreateHistogramCallback f)
Definition counters.cc:185
void ResetCounterFunction(CounterLookupCallback f)
Definition counters.cc:174
WorkerThreadRuntimeCallStats * worker_thread_runtime_call_stats()
Definition counters.h:635
RuntimeCallStats * runtime_call_stats()
Definition counters.h:633
Isolate * isolate()
Definition counters.h:659
int * FindLocation(const char *name)
Definition counters.h:647
Counters(Isolate *isolate)
Definition counters.cc:157
void VisitHistogram(Histogram *histogram, const char *caption) final
Definition counters.cc:180
V8_EXPORT_PRIVATE void * CreateHistogram() const
Definition counters.cc:56
V8_EXPORT_PRIVATE void AddSample(int sample)
Definition counters.cc:50
const char * name() const
Definition counters.h:164
Counters * counters() const
Definition counters.h:192
void EnsureCreated(bool create_new=true)
Definition counters.h:199
Histogram & operator=(const Histogram &)=delete
void Initialize(const char *name, int min, int max, int num_buckets, Counters *counters)
Definition counters.h:181
std::atomic< void * > histogram_
Definition counters.h:218
void AssertReportsToCounters(Counters *expected_counters)
Definition counters.h:172
Histogram(const Histogram &)=delete
int num_buckets() const
Definition counters.h:168
void Leave(NestedTimedHistogramScope *previous)
Definition counters.h:303
NestedTimedHistogramScope * Enter(NestedTimedHistogramScope *next)
Definition counters.h:297
NestedTimedHistogramScope * current_
Definition counters.h:307
NestedTimedHistogram(const NestedTimedHistogram &)=delete
NestedTimedHistogram & operator=(const NestedTimedHistogram &)=delete
NestedTimedHistogram(const char *name, int min, int max, TimedHistogramResolution resolution, int num_buckets, Counters *counters)
Definition counters.h:285
void VisitStatsCounter(StatsCounter *counter, const char *caption) final
Definition counters.cc:169
std::atomic< std::atomic< int > * > ptr_
Definition counters.h:151
V8_NOINLINE V8_EXPORT_PRIVATE std::atomic< int > * SetupPtrFromStatsTable()
Definition counters.cc:34
std::atomic< int > * GetPtr()
Definition counters.h:142
void Set(int value)
Definition counters.h:102
V8_EXPORT_PRIVATE bool Enabled()
Definition counters.cc:32
std::atomic< int > * GetInternalPointer()
Definition counters.h:120
void Initialize(const char *name, Counters *counters)
Definition counters.h:127
void Decrement(int value=1)
Definition counters.h:109
void Increment(int value=1)
Definition counters.h:105
CounterLookupCallback lookup_function_
Definition counters.h:87
void * CreateHistogram(const char *name, int min, int max, size_t buckets)
Definition counters.h:70
StatsTable(const StatsTable &)=delete
void AddHistogramSample(void *histogram, int sample)
Definition counters.h:77
CreateHistogramCallback create_histogram_function_
Definition counters.h:88
int * FindLocation(const char *name)
Definition counters.h:60
bool HasCounterFunction() const
Definition counters.h:52
AddHistogramSampleCallback add_histogram_sample_function_
Definition counters.h:89
void SetCounterFunction(CounterLookupCallback f)
Definition counters.cc:24
void SetAddHistogramSampleFunction(AddHistogramSampleCallback f)
Definition counters.h:48
StatsTable & operator=(const StatsTable &)=delete
void SetCreateHistogramFunction(CreateHistogramCallback f)
Definition counters.h:42
void LogEnd(Isolate *isolate)
TimedHistogram(const TimedHistogram &)=delete
void Stop(base::ElapsedTimer *timer)
Definition counters.cc:60
TimedHistogramResolution resolution_
Definition counters.h:257
void LogStart(Isolate *isolate)
V8_EXPORT_PRIVATE void AddTimedSample(base::TimeDelta sample)
Definition counters.cc:66
TimedHistogram & operator=(const TimedHistogram &)=delete
void RecordAbandon(base::ElapsedTimer *timer, Isolate *isolate)
Definition counters.cc:75
void Initialize(const char *name, int min, int max, TimedHistogramResolution resolution, int num_buckets, Counters *counters)
Definition counters.h:263
#define CODE_KIND_LIST(V)
Definition code-kind.h:18
#define NESTED_TIMED_HISTOGRAM_LIST(HT)
#define HISTOGRAM_LEGACY_MEMORY_LIST(HM)
#define STATS_COUNTER_LIST(SC)
#define HISTOGRAM_PERCENTAGE_LIST(HP)
#define AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
#define NESTED_TIMED_HISTOGRAM_LIST_SLOW(HT)
#define HISTOGRAM_RANGE_LIST(HR)
#define STATS_COUNTER_NATIVE_CODE_LIST(SC)
#define TIMED_HISTOGRAM_LIST(HT)
#define HR(name, caption, min, max, num_buckets)
#define HT(name, caption, max, res)
#define AHT(name, caption)
#define MEMORY_ID(name, caption)
Definition counters.h:608
#define RATE_ID(name, caption, max, res)
Definition counters.h:597
#define PERCENTAGE_ID(name, caption)
Definition counters.h:605
#define HP(name, caption)
Definition counters.h:573
#define HM(name, caption)
Definition counters.h:581
#define COUNTER_ID(name, caption)
Definition counters.h:611
#define AGGREGATABLE_ID(name, caption)
Definition counters.h:602
LineAndColumn previous
base::ElapsedTimer timer_
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in name
Definition flags.cc:2086
TimedHistogramResolution
Definition counters.h:228
V8_EXPORT_PRIVATE FlagValues v8_flags
constexpr Opcode SC
void(*)(void *histogram, int sample) AddHistogramSampleCallback
int *(*)(const char *name) CounterLookupCallback
void *(*)(const char *name, int min, int max, size_t buckets) CreateHistogramCallback
#define INSTANCE_TYPE_LIST(V)
#define DCHECK_NULL(val)
Definition logging.h:491
#define DCHECK_NOT_NULL(val)
Definition logging.h:492
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define V8_EXPORT_PRIVATE
Definition macros.h:460
#define V8_LIKELY(condition)
Definition v8config.h:661
#define V8_NOINLINE
Definition v8config.h:586
#define V8_NODISCARD
Definition v8config.h:693