Source file src/cmd/internal/traceviewer/format.go

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package traceviewer provides definitions of the JSON data structures
     6  // used by the Chrome trace viewer.
     7  //
     8  // The official description of the format is in this file:
     9  // https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
    10  package traceviewer
    11  
    12  type Data struct {
    13  	Events   []*Event         `json:"traceEvents"`
    14  	Frames   map[string]Frame `json:"stackFrames"`
    15  	TimeUnit string           `json:"displayTimeUnit"`
    16  }
    17  
    18  type Event struct {
    19  	Name      string  `json:"name,omitempty"`
    20  	Phase     string  `json:"ph"`
    21  	Scope     string  `json:"s,omitempty"`
    22  	Time      float64 `json:"ts"`
    23  	Dur       float64 `json:"dur,omitempty"`
    24  	PID       uint64  `json:"pid"`
    25  	TID       uint64  `json:"tid"`
    26  	ID        uint64  `json:"id,omitempty"`
    27  	BindPoint string  `json:"bp,omitempty"`
    28  	Stack     int     `json:"sf,omitempty"`
    29  	EndStack  int     `json:"esf,omitempty"`
    30  	Arg       any     `json:"args,omitempty"`
    31  	Cname     string  `json:"cname,omitempty"`
    32  	Category  string  `json:"cat,omitempty"`
    33  }
    34  
    35  type Frame struct {
    36  	Name   string `json:"name"`
    37  	Parent int    `json:"parent,omitempty"`
    38  }
    39  

View as plain text