Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKirill Fomichev <fanatid@ya.ru>2019-09-13 17:25:31 +0300
committerAnna Henningsen <anna@addaleax.net>2020-02-04 19:41:44 +0300
commit018c3e8949e925efc8077801d44c2b2feb974750 (patch)
treeef8e6e43c89df503aff29546daa75a8455f9bf6f /src
parent60de60a0ce21378c80353489759dc70f05156cc7 (diff)
perf_hooks: add property flags to GCPerformanceEntry
PR-URL: https://github.com/nodejs/node/pull/29547 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node_perf.cc20
-rw-r--r--src/node_perf.h24
2 files changed, 43 insertions, 1 deletions
diff --git a/src/node_perf.cc b/src/node_perf.cc
index 0536c39f6c7..68b015f33ed 100644
--- a/src/node_perf.cc
+++ b/src/node_perf.cc
@@ -244,6 +244,10 @@ void PerformanceGCCallback(Environment* env,
env->kind_string(),
Integer::New(env->isolate(), entry->gckind()),
attr).Check();
+ obj->DefineOwnProperty(context,
+ env->flags_string(),
+ Integer::New(env->isolate(), entry->gcflags()),
+ attr).Check();
PerformanceEntry::Notify(env, entry->kind(), obj);
}
}
@@ -270,6 +274,7 @@ void MarkGarbageCollectionEnd(Isolate* isolate,
auto entry = std::make_unique<GCPerformanceEntry>(
env,
static_cast<PerformanceGCKind>(type),
+ static_cast<PerformanceGCFlags>(flags),
state->performance_last_gc_start_mark,
PERFORMANCE_NOW());
env->SetUnrefImmediate([entry = std::move(entry)](Environment* env) mutable {
@@ -587,6 +592,21 @@ void Initialize(Local<Object> target,
NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_INCREMENTAL);
NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_WEAKCB);
+ NODE_DEFINE_CONSTANT(
+ constants, NODE_PERFORMANCE_GC_FLAGS_NO);
+ NODE_DEFINE_CONSTANT(
+ constants, NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED);
+ NODE_DEFINE_CONSTANT(
+ constants, NODE_PERFORMANCE_GC_FLAGS_FORCED);
+ NODE_DEFINE_CONSTANT(
+ constants, NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING);
+ NODE_DEFINE_CONSTANT(
+ constants, NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE);
+ NODE_DEFINE_CONSTANT(
+ constants, NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY);
+ NODE_DEFINE_CONSTANT(
+ constants, NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE);
+
#define V(name, _) \
NODE_DEFINE_HIDDEN_CONSTANT(constants, NODE_PERFORMANCE_ENTRY_TYPE_##name);
NODE_PERFORMANCE_ENTRY_TYPES(V)
diff --git a/src/node_perf.h b/src/node_perf.h
index c5e45261c2c..4f5ca93f223 100644
--- a/src/node_perf.h
+++ b/src/node_perf.h
@@ -21,6 +21,7 @@ namespace performance {
using v8::FunctionCallbackInfo;
using v8::GCType;
+using v8::GCCallbackFlags;
using v8::Local;
using v8::Object;
using v8::Value;
@@ -110,19 +111,40 @@ enum PerformanceGCKind {
NODE_PERFORMANCE_GC_WEAKCB = GCType::kGCTypeProcessWeakCallbacks
};
+enum PerformanceGCFlags {
+ NODE_PERFORMANCE_GC_FLAGS_NO =
+ GCCallbackFlags::kNoGCCallbackFlags,
+ NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED =
+ GCCallbackFlags::kGCCallbackFlagConstructRetainedObjectInfos,
+ NODE_PERFORMANCE_GC_FLAGS_FORCED =
+ GCCallbackFlags::kGCCallbackFlagForced,
+ NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING =
+ GCCallbackFlags::kGCCallbackFlagSynchronousPhantomCallbackProcessing,
+ NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE =
+ GCCallbackFlags::kGCCallbackFlagCollectAllAvailableGarbage,
+ NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY =
+ GCCallbackFlags::kGCCallbackFlagCollectAllExternalMemory,
+ NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE =
+ GCCallbackFlags::kGCCallbackScheduleIdleGarbageCollection
+};
+
class GCPerformanceEntry : public PerformanceEntry {
public:
GCPerformanceEntry(Environment* env,
PerformanceGCKind gckind,
+ PerformanceGCFlags gcflags,
uint64_t startTime,
uint64_t endTime) :
PerformanceEntry(env, "gc", "gc", startTime, endTime),
- gckind_(gckind) { }
+ gckind_(gckind),
+ gcflags_(gcflags) { }
PerformanceGCKind gckind() const { return gckind_; }
+ PerformanceGCFlags gcflags() const { return gcflags_; }
private:
PerformanceGCKind gckind_;
+ PerformanceGCFlags gcflags_;
};
class ELDHistogram : public HandleWrap, public Histogram {