Documentation
¶
Overview ¶
Package traceview renders rt traces for humans: an annotated timeline of the scheduler's decisions, per-goroutine stats, and a keep/drop diff showing exactly which decisions a minimized trace kept. Plain text out, ANSI color optional.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
Diff renders a minimized trace against the original it came from: every original decision marked as kept or dropped, so you can see the skeleton the minimizer decided was actually load-bearing. A minimized trace should be a subsequence of the original; if replay leniency made it drift, that's reported instead of rendered.
func Stats ¶
Stats writes per-goroutine pick counts, what each one blocked on, and the largest virtual-time gaps in the run.
func View ¶
View writes the annotated decision timeline: one line per pick, with the virtual time it ran at, the goroutine by name, and what that goroutine did when its turn ended. Traces recorded before steps existed fall back to bare goroutine ids.
Example ¶
A trace from a run where a producer and consumer deadlocked, rendered as an annotated timeline.
package main
import (
"fmt"
"os"
"github.com/arshnah/detsim/rt"
"github.com/arshnah/detsim/traceview"
)
func main() {
tr := rt.Trace{
Seed: 847291,
Decisions: []uint64{0, 1, 0, 0, 1},
Labels: []string{"producer", "consumer"},
Steps: []rt.Step{
{At: 0, Goroutine: 0, After: "chan send"},
{At: 0, Goroutine: 1, After: "chan recv"},
{At: 0, Goroutine: 0, After: "chan send"},
{At: 0, Goroutine: 0, After: "finished"},
{At: 0, Goroutine: 1, After: "chan recv"},
},
}
if err := traceview.View(os.Stdout, tr, traceview.Options{}); err != nil {
fmt.Println("render failed:", err)
}
}
Output: seed 847291 · 5 decisions · 2 goroutines · no time advanced #1 producer blocked on chan send at t=0s #2 consumer blocked on chan recv at t=0s #3 producer blocked on chan send at t=0s #4 producer ran to completion at t=0s #5 consumer blocked on chan recv at t=0s