diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-23 13:20:52 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-23 13:20:52 +0200 |
| commit | 2b1c849422973cf926e2bfda31703f4bfef5563d (patch) | |
| tree | 6220608d1baaeaf6c09fa3fc8062a9831fbc8055 | |
| parent | 95441bb43ef1ea6d003cd3b4143bbaee70f797d6 (diff) | |
docs: define durationToPrev timing semantics
| -rw-r--r-- | README.md | 14 | ||||
| -rw-r--r-- | internal/event/pair.go | 3 |
2 files changed, 16 insertions, 1 deletions
@@ -10,6 +10,19 @@ Maybe this is a spiritual successor of one of my previous projects, I/O Riot htt This works only on Linux! +## Timing Semantics + +Each reported event pair has two timing counters: + +- `durationNs`: syscall runtime on the same thread (`exit(current) - enter(current)`). +- `durationToPrevNs`: inter-syscall gap on the same thread (`enter(current) - exit(previous)`). + +Important details: + +- `durationToPrevNs` is tracked per `tid` (thread), not globally across all threads. +- The first observed syscall pair for a thread has `durationToPrevNs = 0` because there is no prior exit timestamp. +- `durationToPrevNs` is attributed to the current syscall pair (the one whose `enter` closes the gap). + ## Fedora To get this running on Fedora 42, run: @@ -50,4 +63,3 @@ We are using Inferno Flamegraphs: https://github.com/jonhoo/inferno ```sh cargo install inferno ``` - diff --git a/internal/event/pair.go b/internal/event/pair.go index 1e9a544..4b93013 100644 --- a/internal/event/pair.go +++ b/internal/event/pair.go @@ -33,8 +33,11 @@ func NewPair(enterEv Event) *Pair { } func (e *Pair) CalculateDurations(prevPairTime uint64) { + // Duration is syscall runtime: exit(current) - enter(current). e.Duration = e.ExitEv.GetTime() - e.EnterEv.GetTime() if prevPairTime > 0 { + // DurationToPrev is the inter-syscall gap on the same TID: + // enter(current) - exit(previous). e.DurationToPrev = e.EnterEv.GetTime() - prevPairTime } } |
