| // Copyright 2014 The Go Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| package trace | |
| // Frame is a frame in stack traces. | |
| type Frame struct { | |
| PC uint64 | |
| Fn string | |
| File string | |
| Line int | |
| } | |
| const ( | |
| // Special P identifiers: | |
| FakeP = 1000000 + iota | |
| TimerP // depicts timer unblocks | |
| NetpollP // depicts network unblocks | |
| SyscallP // depicts returns from syscalls | |
| GCP // depicts GC state | |
| ProfileP // depicts recording of CPU profile samples | |
| ) | |
| // Event types in the trace. | |
| // Verbatim copy from src/runtime/trace.go with the "trace" prefix removed. | |
| const ( | |
| EvNone = 0 // unused | |
| EvBatch = 1 // start of per-P batch of events [pid, timestamp] | |
| EvFrequency = 2 // contains tracer timer frequency [frequency (ticks per second)] | |
| EvStack = 3 // stack [stack id, number of PCs, array of {PC, func string ID, file string ID, line}] | |
| EvGomaxprocs = 4 // current value of GOMAXPROCS [timestamp, GOMAXPROCS, stack id] | |
| EvProcStart = 5 // start of P [timestamp, thread id] | |
| EvProcStop = 6 // stop of P [timestamp] | |
| EvGCStart = 7 // GC start [timestamp, seq, stack id] | |
| EvGCDone = 8 // GC done [timestamp] | |
| EvSTWStart = 9 // GC mark termination start [timestamp, kind] | |
| EvSTWDone = 10 // GC mark termination done [timestamp] | |
| EvGCSweepStart = 11 // GC sweep start [timestamp, stack id] | |
| EvGCSweepDone = 12 // GC sweep done [timestamp, swept, reclaimed] | |
| EvGoCreate = 13 // goroutine creation [timestamp, new goroutine id, new stack id, stack id] | |
| EvGoStart = 14 // goroutine starts running [timestamp, goroutine id, seq] | |
| EvGoEnd = 15 // goroutine ends [timestamp] | |
| EvGoStop = 16 // goroutine stops (like in select{}) [timestamp, stack] | |
| EvGoSched = 17 // goroutine calls Gosched [timestamp, stack] | |
| EvGoPreempt = 18 // goroutine is preempted [timestamp, stack] | |
| EvGoSleep = 19 // goroutine calls Sleep [timestamp, stack] | |
| EvGoBlock = 20 // goroutine blocks [timestamp, stack] | |
| EvGoUnblock = 21 // goroutine is unblocked [timestamp, goroutine id, seq, stack] | |
| EvGoBlockSend = 22 // goroutine blocks on chan send [timestamp, stack] | |
| EvGoBlockRecv = 23 // goroutine blocks on chan recv [timestamp, stack] | |
| EvGoBlockSelect = 24 // goroutine blocks on select [timestamp, stack] | |
| EvGoBlockSync = 25 // goroutine blocks on Mutex/RWMutex [timestamp, stack] | |
| EvGoBlockCond = 26 // goroutine blocks on Cond [timestamp, stack] | |
| EvGoBlockNet = 27 // goroutine blocks on network [timestamp, stack] | |
| EvGoSysCall = 28 // syscall enter [timestamp, stack] | |
| EvGoSysExit = 29 // syscall exit [timestamp, goroutine id, seq, real timestamp] | |
| EvGoSysBlock = 30 // syscall blocks [timestamp] | |
| EvGoWaiting = 31 // denotes that goroutine is blocked when tracing starts [timestamp, goroutine id] | |
| EvGoInSyscall = 32 // denotes that goroutine is in syscall when tracing starts [timestamp, goroutine id] | |
| EvHeapAlloc = 33 // gcController.heapLive change [timestamp, heap live bytes] | |
| EvHeapGoal = 34 // gcController.heapGoal change [timestamp, heap goal bytes] | |
| EvTimerGoroutine = 35 // denotes timer goroutine [timer goroutine id] | |
| EvFutileWakeup = 36 // denotes that the previous wakeup of this goroutine was futile [timestamp] | |
| EvString = 37 // string dictionary entry [ID, length, string] | |
| EvGoStartLocal = 38 // goroutine starts running on the same P as the last event [timestamp, goroutine id] | |
| EvGoUnblockLocal = 39 // goroutine is unblocked on the same P as the last event [timestamp, goroutine id, stack] | |
| EvGoSysExitLocal = 40 // syscall exit on the same P as the last event [timestamp, goroutine id, real timestamp] | |
| EvGoStartLabel = 41 // goroutine starts running with label [timestamp, goroutine id, seq, label string id] | |
| EvGoBlockGC = 42 // goroutine blocks on GC assist [timestamp, stack] | |
| EvGCMarkAssistStart = 43 // GC mark assist start [timestamp, stack] | |
| EvGCMarkAssistDone = 44 // GC mark assist done [timestamp] | |
| EvUserTaskCreate = 45 // trace.NewTask [timestamp, internal task id, internal parent id, name string, stack] | |
| EvUserTaskEnd = 46 // end of task [timestamp, internal task id, stack] | |
| EvUserRegion = 47 // trace.WithRegion [timestamp, internal task id, mode(0:start, 1:end), name string, stack] | |
| EvUserLog = 48 // trace.Log [timestamp, internal id, key string id, stack, value string] | |
| EvCPUSample = 49 // CPU profiling sample [timestamp, real timestamp, real P id (-1 when absent), goroutine id, stack] | |
| EvCount = 50 | |
| ) |