github.com/octohelm/cuemod@v0.9.4/internal/internals/trace/traceviewer/format/format.go (about)

     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  //
    11  // Note: This can't be part of the parent traceviewer package as that would
    12  // throw. go_bootstrap cannot depend on the cgo version of package net in ./make.bash.
    13  package format
    14  
    15  type Data struct {
    16  	Events   []*Event         `json:"traceEvents"`
    17  	Frames   map[string]Frame `json:"stackFrames"`
    18  	TimeUnit string           `json:"displayTimeUnit"`
    19  }
    20  
    21  type Event struct {
    22  	Name      string  `json:"name,omitempty"`
    23  	Phase     string  `json:"ph"`
    24  	Scope     string  `json:"s,omitempty"`
    25  	Time      float64 `json:"ts"`
    26  	Dur       float64 `json:"dur,omitempty"`
    27  	PID       uint64  `json:"pid"`
    28  	TID       uint64  `json:"tid"`
    29  	ID        uint64  `json:"id,omitempty"`
    30  	BindPoint string  `json:"bp,omitempty"`
    31  	Stack     int     `json:"sf,omitempty"`
    32  	EndStack  int     `json:"esf,omitempty"`
    33  	Arg       any     `json:"args,omitempty"`
    34  	Cname     string  `json:"cname,omitempty"`
    35  	Category  string  `json:"cat,omitempty"`
    36  }
    37  
    38  type Frame struct {
    39  	Name   string `json:"name"`
    40  	Parent int    `json:"parent,omitempty"`
    41  }
    42  
    43  type NameArg struct {
    44  	Name string `json:"name"`
    45  }
    46  
    47  type BlockedArg struct {
    48  	Blocked string `json:"blocked"`
    49  }
    50  
    51  type SortIndexArg struct {
    52  	Index int `json:"sort_index"`
    53  }
    54  
    55  type HeapCountersArg struct {
    56  	Allocated uint64
    57  	NextGC    uint64
    58  }
    59  
    60  const (
    61  	ProcsSection = 0 // where Goroutines or per-P timelines are presented.
    62  	StatsSection = 1 // where counters are presented.
    63  	TasksSection = 2 // where Task hierarchy & timeline is presented.
    64  )
    65  
    66  type GoroutineCountersArg struct {
    67  	Running   uint64
    68  	Runnable  uint64
    69  	GCWaiting uint64
    70  }
    71  
    72  type ThreadCountersArg struct {
    73  	Running   int64
    74  	InSyscall int64
    75  }
    76  
    77  type ThreadIDArg struct {
    78  	ThreadID uint64
    79  }