@@ -24,7 +24,6 @@ using v8::Integer;
24
24
using v8::Isolate;
25
25
using v8::Local;
26
26
using v8::MaybeLocal;
27
- using v8::Number;
28
27
using v8::Object;
29
28
using v8::ObjectTemplate;
30
29
using v8::PropertyAttribute;
@@ -43,6 +42,7 @@ uint64_t performance_v8_start;
43
42
44
43
PerformanceState::PerformanceState (Isolate* isolate,
45
44
uint64_t time_origin,
45
+ double time_origin_timestamp,
46
46
const PerformanceState::SerializeInfo* info)
47
47
: root(isolate,
48
48
sizeof (performance_state_internal),
@@ -63,7 +63,7 @@ PerformanceState::PerformanceState(Isolate* isolate,
63
63
// For deserialized performance states, we will do the
64
64
// initialization in the deserialize callback.
65
65
ResetMilestones ();
66
- Initialize (time_origin);
66
+ Initialize (time_origin, time_origin_timestamp );
67
67
}
68
68
}
69
69
@@ -86,23 +86,27 @@ PerformanceState::SerializeInfo PerformanceState::Serialize(
86
86
return info;
87
87
}
88
88
89
- void PerformanceState::Initialize (uint64_t time_origin) {
90
- // We are only reusing the milestone array to store the time origin, so do
91
- // not use the Mark() method. The time origin milestone is not exposed
92
- // to user land.
89
+ void PerformanceState::Initialize (uint64_t time_origin,
90
+ double time_origin_timestamp) {
91
+ // We are only reusing the milestone array to store the time origin
92
+ // and time origin timestamp, so do not use the Mark() method.
93
+ // The time origin milestone is not exposed to user land.
93
94
this ->milestones [NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN] =
94
95
static_cast <double >(time_origin);
96
+ this ->milestones [NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN_TIMESTAMP] =
97
+ time_origin_timestamp;
95
98
}
96
99
97
100
void PerformanceState::Deserialize (v8::Local<v8::Context> context,
98
- uint64_t time_origin) {
101
+ uint64_t time_origin,
102
+ double time_origin_timestamp) {
99
103
// Resets the pointers.
100
104
root.Deserialize (context);
101
105
milestones.Deserialize (context);
102
106
observers.Deserialize (context);
103
107
104
- // Re-initialize the time origin i.e. the process start time.
105
- Initialize (time_origin);
108
+ // Re-initialize the time origin and timestamp i.e. the process start time.
109
+ Initialize (time_origin, time_origin_timestamp );
106
110
}
107
111
108
112
std::ostream& operator <<(std::ostream& o,
@@ -254,7 +258,7 @@ void Notify(const FunctionCallbackInfo<Value>& args) {
254
258
void LoopIdleTime (const FunctionCallbackInfo<Value>& args) {
255
259
Environment* env = Environment::GetCurrent (args);
256
260
uint64_t idle_time = uv_metrics_idle_time (env->event_loop ());
257
- args.GetReturnValue ().Set (1.0 * idle_time / 1e6 );
261
+ args.GetReturnValue ().Set (1.0 * idle_time / NANOS_PER_MILLIS );
258
262
}
259
263
260
264
void CreateELDHistogram (const FunctionCallbackInfo<Value>& args) {
@@ -278,12 +282,6 @@ void CreateELDHistogram(const FunctionCallbackInfo<Value>& args) {
278
282
args.GetReturnValue ().Set (histogram->object ());
279
283
}
280
284
281
- void GetTimeOriginTimeStamp (const FunctionCallbackInfo<Value>& args) {
282
- Environment* env = Environment::GetCurrent (args);
283
- args.GetReturnValue ().Set (Number::New (
284
- args.GetIsolate (), env->time_origin_timestamp () / MICROS_PER_MILLIS));
285
- }
286
-
287
285
void MarkBootstrapComplete (const FunctionCallbackInfo<Value>& args) {
288
286
Realm* realm = Realm::GetCurrent (args);
289
287
CHECK_EQ (realm->kind (), Realm::Kind::kPrincipal );
@@ -324,7 +322,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
324
322
RemoveGarbageCollectionTracking);
325
323
SetMethod (isolate, target, " notify" , Notify);
326
324
SetMethod (isolate, target, " loopIdleTime" , LoopIdleTime);
327
- SetMethod (isolate, target, " getTimeOriginTimestamp" , GetTimeOriginTimeStamp);
328
325
SetMethod (isolate, target, " createELDHistogram" , CreateELDHistogram);
329
326
SetMethod (isolate, target, " markBootstrapComplete" , MarkBootstrapComplete);
330
327
SetFastMethodNoSideEffect (
@@ -391,7 +388,6 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
391
388
registry->Register (RemoveGarbageCollectionTracking);
392
389
registry->Register (Notify);
393
390
registry->Register (LoopIdleTime);
394
- registry->Register (GetTimeOriginTimeStamp);
395
391
registry->Register (CreateELDHistogram);
396
392
registry->Register (MarkBootstrapComplete);
397
393
registry->Register (SlowPerformanceNow);
0 commit comments