Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

feat(timestamps): more accurate timestamps #44

Merged
merged 1 commit into from
Oct 11, 2022
Merged

Conversation

JonasBa
Copy link
Member

@JonasBa JonasBa commented Oct 11, 2022

We were previously not collecting accurate timestamps in regards to when profiling was started/stopped relative to the transaction.

Since calling profile.GetStartTime() and profile->GetEndTime() do not return relative timestamps it is not suitable to use that data to determine the elapsed time between the start of transaction. Having a relative ts here would improve accuracy. For those reasons, we use process.hrtime to mark the start/stop timestamps of calls to startProfiling and stopProfiling.

We error on the safe side by placing the hrtime marker call after startProfiling which effectively means that our relative start time will be reported higher than it is, however this is beneficial as it allows us to monitor the delay to start/stop profiling which can be different depending on the v8::CpuProfilingLoggingMode used.

process.hrtime markers are added to following points in the transaction/profiling lifecycle.

  • after startTransaction
  • after startProfiling
  • after stopProfiling

@JonasBa
Copy link
Member Author

JonasBa commented Oct 11, 2022

Oh and I removed /lib because it shouldn't have been there in the first place.

@JonasBa JonasBa merged commit 6ba01e3 into main Oct 11, 2022
@JonasBa JonasBa deleted the jb/feat/ts-accuracy branch October 11, 2022 17:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant