mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/trace: use different colors for tasks
and assign the same colors for spans belong to the tasks (sadly, the trace viewer will change the saturation/ligthness for asynchronous slices so exact color mapping is impossible. But I hope they are not too far from each other) Change-Id: Idaaf0828a1e0dac8012d336dcefa1c6572ddca2e Reviewed-on: https://go-review.googlesource.com/109338 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
8a958bb8a6
commit
af5143e384
1 changed files with 66 additions and 35 deletions
|
|
@ -900,7 +900,7 @@ func (ctx *traceContext) emitTask(task *taskDesc, sortIndex int) {
|
||||||
Dur: durationUsec,
|
Dur: durationUsec,
|
||||||
Pid: tasksSection,
|
Pid: tasksSection,
|
||||||
Tid: taskRow,
|
Tid: taskRow,
|
||||||
Cname: colorSeafoamGreen,
|
Cname: pickTaskColor(task.id),
|
||||||
}
|
}
|
||||||
targ := TaskArg{ID: task.id}
|
targ := TaskArg{ID: task.id}
|
||||||
if task.create != nil {
|
if task.create != nil {
|
||||||
|
|
@ -946,7 +946,7 @@ func (ctx *traceContext) emitRegion(s regionDesc) {
|
||||||
Tid: s.G, // only in goroutine-oriented view
|
Tid: s.G, // only in goroutine-oriented view
|
||||||
ID: uint64(regionID),
|
ID: uint64(regionID),
|
||||||
Scope: scopeID,
|
Scope: scopeID,
|
||||||
Cname: colorDeepMagenta,
|
Cname: pickTaskColor(s.TaskID),
|
||||||
}
|
}
|
||||||
if s.Start != nil {
|
if s.Start != nil {
|
||||||
sl0.Stack = ctx.stack(s.Start.Stk)
|
sl0.Stack = ctx.stack(s.Start.Stk)
|
||||||
|
|
@ -961,7 +961,7 @@ func (ctx *traceContext) emitRegion(s regionDesc) {
|
||||||
Tid: s.G,
|
Tid: s.G,
|
||||||
ID: uint64(regionID),
|
ID: uint64(regionID),
|
||||||
Scope: scopeID,
|
Scope: scopeID,
|
||||||
Cname: colorDeepMagenta,
|
Cname: pickTaskColor(s.TaskID),
|
||||||
Arg: RegionArg{TaskID: s.TaskID},
|
Arg: RegionArg{TaskID: s.TaskID},
|
||||||
}
|
}
|
||||||
if s.End != nil {
|
if s.End != nil {
|
||||||
|
|
@ -1222,7 +1222,38 @@ const (
|
||||||
colorLime = "cq_build_passed" // 153, 238, 102
|
colorLime = "cq_build_passed" // 153, 238, 102
|
||||||
colorPink = "cq_build_failed" // 238, 136, 136
|
colorPink = "cq_build_failed" // 238, 136, 136
|
||||||
colorSilver = "cq_build_abandoned" // 187, 187, 187
|
colorSilver = "cq_build_abandoned" // 187, 187, 187
|
||||||
colorManzGreen = "cq_build_attempt_running" // 222, 222, 75
|
colorManzGreen = "cq_build_attempt_runnig" // 222, 222, 75
|
||||||
colorKellyGreen = "cq_build_attempt_passed" // 108, 218, 35
|
colorKellyGreen = "cq_build_attempt_passed" // 108, 218, 35
|
||||||
colorFuzzyWuzzyBrown = "cq_build_attempt_failed" // 187, 187, 187
|
colorAnotherGrey = "cq_build_attempt_failed" // 187, 187, 187
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var colorForTask = []string{
|
||||||
|
colorLightMauve,
|
||||||
|
colorOrange,
|
||||||
|
colorSeafoamGreen,
|
||||||
|
colorVistaBlue,
|
||||||
|
colorTan,
|
||||||
|
colorMidnightBlue,
|
||||||
|
colorIrisBlue,
|
||||||
|
colorDeepMagenta,
|
||||||
|
colorGreen,
|
||||||
|
colorDarkGoldenrod,
|
||||||
|
colorPeach,
|
||||||
|
colorOlive,
|
||||||
|
colorCornflowerBlue,
|
||||||
|
colorSunsetOrange,
|
||||||
|
colorTangerine,
|
||||||
|
colorShamrockGreen,
|
||||||
|
colorTawny,
|
||||||
|
colorLemon,
|
||||||
|
colorLime,
|
||||||
|
colorPink,
|
||||||
|
colorSilver,
|
||||||
|
colorManzGreen,
|
||||||
|
colorKellyGreen,
|
||||||
|
}
|
||||||
|
|
||||||
|
func pickTaskColor(id uint64) string {
|
||||||
|
idx := id % uint64(len(colorForTask))
|
||||||
|
return colorForTask[idx]
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue