Skip to content

high-resolution timestamps for pipeline stages #29

@davepacheco

Description

@davepacheco

Since pipeline stages tend to be logically important steps, they're a natural place to record timestamps. By having vasync record high-resolution timestamps for the start and completion of each operation in a pipeline, users can quickly understand overall pipeline latency. This behavior should be optional, since recording timestamps isn't free.

My implementation is here:
https://github.com/davepacheco/node-vasync/compare/dev-issue-29

I suggest starting with the README update to see what the interface looks like.

A few notes:

  • It's tempting to record timestamps only at the start of each operation, but I want to be able to account for time spent between operations due to queueing on the event loop, so this implementation records two timestamps per operation.
  • The second timestamp is recorded as a delta from the first one because I think that's how most people will want to use it. Callers that want an absolute timestamp (e.g., to construct a timeline) can always use jsprim's hrtimeAdd() function.
  • I've added "start" and "elapsed" timestamps for the overall pipeline as well.
  • I hope to add this interface to the other vasync functions as well, but I wanted to try it out on pipeline() first and see how it looks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions