diff options
Diffstat (limited to 'src/node_perf.h')
-rw-r--r-- | src/node_perf.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/node_perf.h b/src/node_perf.h index e3ef69c0fb..a8e43dc347 100644 --- a/src/node_perf.h +++ b/src/node_perf.h @@ -7,6 +7,7 @@ #include "node_perf_common.h" #include "env.h" #include "base_object-inl.h" +#include "histogram-inl.h" #include "v8.h" #include "uv.h" @@ -124,6 +125,41 @@ class GCPerformanceEntry : public PerformanceEntry { PerformanceGCKind gckind_; }; +class ELDHistogram : public BaseObject, public Histogram { + public: + ELDHistogram(Environment* env, + Local<Object> wrap, + int32_t resolution); + + ~ELDHistogram() override; + + bool RecordDelta(); + bool Enable(); + bool Disable(); + void ResetState() { + Reset(); + exceeds_ = 0; + prev_ = 0; + } + int64_t Exceeds() { return exceeds_; } + + void MemoryInfo(MemoryTracker* tracker) const override { + tracker->TrackFieldWithSize("histogram", GetMemorySize()); + } + + SET_MEMORY_INFO_NAME(ELDHistogram) + SET_SELF_SIZE(ELDHistogram) + + private: + void CloseTimer(); + + bool enabled_ = false; + int32_t resolution_ = 0; + int64_t exceeds_ = 0; + uint64_t prev_ = 0; + uv_timer_t* timer_; +}; + } // namespace performance } // namespace node |