feat: add cachegrind data model

This commit is contained in:
thibaud-leclere 2026-05-12 09:37:12 +02:00
parent 3220dfff64
commit d3c7f27c21

View 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
}