@@ -24,7 +24,6 @@ using v8::Integer;
2424using v8::Isolate;
2525using v8::Local;
2626using v8::MaybeLocal;
27- using v8::Number;
2827using v8::Object;
2928using v8::ObjectTemplate;
3029using v8::PropertyAttribute;
@@ -43,6 +42,7 @@ uint64_t performance_v8_start;
4342
4443PerformanceState::PerformanceState (Isolate* isolate,
4544 uint64_t time_origin,
45+ double time_origin_timestamp,
4646 const PerformanceState::SerializeInfo* info)
4747 : root(isolate,
4848 sizeof (performance_state_internal),
@@ -63,7 +63,7 @@ PerformanceState::PerformanceState(Isolate* isolate,
6363 // For deserialized performance states, we will do the
6464 // initialization in the deserialize callback.
6565 ResetMilestones ();
66- Initialize (time_origin);
66+ Initialize (time_origin, time_origin_timestamp );
6767 }
6868}
6969
@@ -86,23 +86,27 @@ PerformanceState::SerializeInfo PerformanceState::Serialize(
8686 return info;
8787}
8888
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.
9394 this ->milestones [NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN] =
9495 static_cast <double >(time_origin);
96+ this ->milestones [NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN_TIMESTAMP] =
97+ time_origin_timestamp;
9598}
9699
97100void PerformanceState::Deserialize (v8::Local<v8::Context> context,
98- uint64_t time_origin) {
101+ uint64_t time_origin,
102+ double time_origin_timestamp) {
99103 // Resets the pointers.
100104 root.Deserialize (context);
101105 milestones.Deserialize (context);
102106 observers.Deserialize (context);
103107
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 );
106110}
107111
108112std::ostream& operator <<(std::ostream& o,
@@ -254,7 +258,7 @@ void Notify(const FunctionCallbackInfo<Value>& args) {
254258void LoopIdleTime (const FunctionCallbackInfo<Value>& args) {
255259 Environment* env = Environment::GetCurrent (args);
256260 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 );
258262}
259263
260264void CreateELDHistogram (const FunctionCallbackInfo<Value>& args) {
@@ -278,12 +282,6 @@ void CreateELDHistogram(const FunctionCallbackInfo<Value>& args) {
278282 args.GetReturnValue ().Set (histogram->object ());
279283}
280284
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-
287285void MarkBootstrapComplete (const FunctionCallbackInfo<Value>& args) {
288286 Realm* realm = Realm::GetCurrent (args);
289287 CHECK_EQ (realm->kind (), Realm::Kind::kPrincipal );
@@ -324,7 +322,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
324322 RemoveGarbageCollectionTracking);
325323 SetMethod (isolate, target, " notify" , Notify);
326324 SetMethod (isolate, target, " loopIdleTime" , LoopIdleTime);
327- SetMethod (isolate, target, " getTimeOriginTimestamp" , GetTimeOriginTimeStamp);
328325 SetMethod (isolate, target, " createELDHistogram" , CreateELDHistogram);
329326 SetMethod (isolate, target, " markBootstrapComplete" , MarkBootstrapComplete);
330327 SetFastMethodNoSideEffect (
@@ -391,7 +388,6 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
391388 registry->Register (RemoveGarbageCollectionTracking);
392389 registry->Register (Notify);
393390 registry->Register (LoopIdleTime);
394- registry->Register (GetTimeOriginTimeStamp);
395391 registry->Register (CreateELDHistogram);
396392 registry->Register (MarkBootstrapComplete);
397393 registry->Register (SlowPerformanceNow);
0 commit comments