feat: add cachegrind data model
This commit is contained in:
parent
3220dfff64
commit
d3c7f27c21
1 changed files with 26 additions and 0 deletions
26
internal/cachegrind/model.go
Normal file
26
internal/cachegrind/model.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package cachegrind
|
||||
|
||||
// Profile holds the parsed contents of a cachegrind file.
|
||||
type Profile struct {
|
||||
Cmd string
|
||||
Events []string
|
||||
Functions []*Function
|
||||
ByName map[string][]*Function // one name may appear in multiple files
|
||||
}
|
||||
|
||||
// Function represents a single profiled function with aggregated inclusive costs.
|
||||
type Function struct {
|
||||
Name string
|
||||
File string
|
||||
Costs []int64 // one entry per Profile.Events; inclusive (includes callees)
|
||||
Calls []*Call // outgoing call edges
|
||||
CalledBy []*Call // incoming call edges
|
||||
}
|
||||
|
||||
// Call is a directed call edge between two functions.
|
||||
type Call struct {
|
||||
Caller *Function
|
||||
Callee *Function
|
||||
Count int64
|
||||
Costs []int64
|
||||
}
|
||||
Loading…
Reference in a new issue