-
Notifications
You must be signed in to change notification settings - Fork 1
/
event.go
61 lines (50 loc) · 1.78 KB
/
event.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2020 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 goat
// EventKind indicates what kind of allocation trace event
// is captured and returned.
type EventKind uint8
const (
EventBad EventKind = iota
EventAlloc // Allocation.
EventFree // Free.
EventGCStart // GC sweep termination.
EventGCEnd // GC mark termination.
EventStackAlloc // Stack allocation.
EventStackFree // Stack free.
)
// Event represents a single allocation trace event.
type Event struct {
// Timestamp is the time in non-normalized CPU ticks
// for this event.
Timestamp uint64
// Address is the address for the allocation or free.
// Only valid when Kind == EventAlloc, Kind == EventFree,
// Kind == EventStackAlloc, Kind == EventStackFree.
Address uint64
// Size indicates the size of the allocation.
// Only valid when Kind == EventAlloc or Kind == EventStackAlloc.
Size uint64
// P indicates which processor generated the event.
// Valid for all events.
P int32
// PC is the program counter that is considered to have
// "triggered" an allocation. The definition is necessarily
// fuzzy, but is useful for simulation allocation-site based
// allocators.
//
// This field is only non-zero if Kind == EventAlloc and an
// allocation site could reasonably be assigned to the allocation
// during the trace.
PC uint64
// Array indicates whether an allocation was for
// an array type.
Array bool
// PointerFree indicates whether an object allocation
// has pointers in it.
PointerFree bool
// Kind indicates what kind of event this is.
// This may be assumed to always be valid.
Kind EventKind
}