mirror of
https://github.com/golang/go.git
synced 2026-02-06 18:00:01 +00:00
cmd/trace: annotation proc start/stop with thread and proc always
In the proc view, the thread ID is useful. In the thread view, the proc ID is useful. Add both in both cases forever more. Change-Id: I9cb7bd67a21ee17d865c25d73b2049b3da7aefbc Reviewed-on: https://go-review.googlesource.com/c/go/+/720402 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
17a02b9106
commit
704f841eab
3 changed files with 17 additions and 8 deletions
|
|
@ -143,6 +143,13 @@ func (g *procGenerator) ProcTransition(ctx *traceContext, ev *trace.Event) {
|
|||
viewerEv := traceviewer.InstantEvent{
|
||||
Resource: uint64(proc),
|
||||
Stack: ctx.Stack(viewerFrames(ev.Stack())),
|
||||
|
||||
// Annotate with the thread and proc. The proc is redundant, but this is to
|
||||
// stay consistent with the thread view, where it's useful information.
|
||||
Arg: format.SchedCtxArg{
|
||||
ProcID: uint64(st.Resource.Proc()),
|
||||
ThreadID: uint64(ev.Thread()),
|
||||
},
|
||||
}
|
||||
|
||||
from, to := st.Proc()
|
||||
|
|
@ -156,7 +163,6 @@ func (g *procGenerator) ProcTransition(ctx *traceContext, ev *trace.Event) {
|
|||
start = ctx.startTime
|
||||
}
|
||||
viewerEv.Name = "proc start"
|
||||
viewerEv.Arg = format.ThreadIDArg{ThreadID: uint64(ev.Thread())}
|
||||
viewerEv.Ts = ctx.elapsed(start)
|
||||
ctx.IncThreadStateCount(ctx.elapsed(start), traceviewer.ThreadStateRunning, 1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,14 +138,17 @@ func (g *threadGenerator) ProcTransition(ctx *traceContext, ev *trace.Event) {
|
|||
}
|
||||
}
|
||||
|
||||
type procArg struct {
|
||||
Proc uint64 `json:"proc,omitempty"`
|
||||
}
|
||||
st := ev.StateTransition()
|
||||
viewerEv := traceviewer.InstantEvent{
|
||||
Resource: uint64(ev.Thread()),
|
||||
Stack: ctx.Stack(viewerFrames(ev.Stack())),
|
||||
Arg: procArg{Proc: uint64(st.Resource.Proc())},
|
||||
|
||||
// Annotate with the thread and proc. The thread is redundant, but this is to
|
||||
// stay consistent with the proc view.
|
||||
Arg: format.SchedCtxArg{
|
||||
ProcID: uint64(st.Resource.Proc()),
|
||||
ThreadID: uint64(ev.Thread()),
|
||||
},
|
||||
}
|
||||
|
||||
from, to := st.Proc()
|
||||
|
|
@ -159,7 +162,6 @@ func (g *threadGenerator) ProcTransition(ctx *traceContext, ev *trace.Event) {
|
|||
start = ctx.startTime
|
||||
}
|
||||
viewerEv.Name = "proc start"
|
||||
viewerEv.Arg = format.ThreadIDArg{ThreadID: uint64(ev.Thread())}
|
||||
viewerEv.Ts = ctx.elapsed(start)
|
||||
// TODO(mknyszek): We don't have a state machine for threads, so approximate
|
||||
// running threads with running Ps.
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ type ThreadCountersArg struct {
|
|||
InSyscall int64
|
||||
}
|
||||
|
||||
type ThreadIDArg struct {
|
||||
ThreadID uint64
|
||||
type SchedCtxArg struct {
|
||||
ThreadID uint64 `json:"thread,omitempty"`
|
||||
ProcID uint64 `json:"proc,omitempty"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue