本文整理汇总了Golang中go/skia/org/infra/perf/go/types.PerfTrace类的典型用法代码示例。如果您正苦于以下问题:Golang PerfTrace类的具体用法?Golang PerfTrace怎么用?Golang PerfTrace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PerfTrace类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: traceGuiFromTrace
// traceGuiFromTrace returns a populated TraceGUI from the given trace.
func traceGuiFromTrace(trace *types.PerfTrace, key string, tile *tiling.Tile) *tiling.TraceGUI {
newTraceData := make([][2]float64, 0)
for i, v := range trace.Values {
if v != config.MISSING_DATA_SENTINEL && tile.Commits[i] != nil && tile.Commits[i].CommitTime > 0 {
//newTraceData = append(newTraceData, [2]float64{float64(tile.Commits[i].CommitTime), v})
newTraceData = append(newTraceData, [2]float64{float64(i), v})
}
}
if len(newTraceData) >= 0 {
return &tiling.TraceGUI{
Data: newTraceData,
Label: key,
Params: trace.Params(),
}
} else {
return nil
}
}
示例2: addBenchDataToTile
// addBenchDataToTile adds BenchData to a Tile.
//
// See the description at the top of this file for how the mapping works.
func addBenchDataToTile(benchData *BenchData, tile *tiling.Tile, offset int, counter metrics.Counter) {
// cb is the anonymous closure we'll pass over all the trace values found in benchData.
cb := func(key string, value float64, params map[string]string) {
needsUpdate := false
var trace *types.PerfTrace
if tr, ok := tile.Traces[key]; !ok {
trace = types.NewPerfTrace()
tile.Traces[key] = trace
needsUpdate = true
} else {
trace = tr.(*types.PerfTrace)
if !util.MapsEqual(params, tile.Traces[key].Params()) {
needsUpdate = true
}
}
trace.Params_ = params
trace.Values[offset] = value
counter.Inc(1)
if needsUpdate {
// Update the Tile's ParamSet with any new keys or values we see.
//
// TODO(jcgregorio) Maybe defer this until we are about to Put the Tile
// back to disk and rebuild ParamSet from scratch over all the Traces.
for k, v := range params {
if _, ok := tile.ParamSet[k]; !ok {
tile.ParamSet[k] = []string{v}
} else if !util.In(v, tile.ParamSet[k]) {
tile.ParamSet[k] = append(tile.ParamSet[k], v)
}
}
}
}
benchData.ForEach(cb)
}
示例3: skpOnly
func skpOnly(_ string, tr *types.PerfTrace) bool {
return tr.Params()["source_type"] == "skp" && tr.Params()["sub_result"] == "min_ms"
}