Skip to content

Commit

Permalink
info: expose bpf_prog_info fields to ProgramInfo
Browse files Browse the repository at this point in the history
Exposes additional metadata fields from `bpf_prog_info` to
`ProgramInfo`:
- jited_prog_len
- xlated_prog_len
- load_time
- verified_insns

Signed-off-by: tyrone-wu <wudevelops@gmail.com>
  • Loading branch information
tyrone-wu committed Jul 11, 2024
1 parent 5976561 commit f8c72b7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions info.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ type ProgramInfo struct {
// Name as supplied by user space at load time. Available from 4.15.
Name string

JitedSize uint32
TranslatedSize uint32
LoadTime time.Duration
VerifiedInstructions uint32

createdByUID uint32
haveCreatedByUID bool
btf btf.ID
Expand All @@ -137,11 +142,15 @@ func newProgramInfoFromFd(fd *sys.FD) (*ProgramInfo, error) {
}

pi := ProgramInfo{
Type: ProgramType(info.Type),
id: ProgramID(info.Id),
Tag: hex.EncodeToString(info.Tag[:]),
Name: unix.ByteSliceToString(info.Name[:]),
btf: btf.ID(info.BtfId),
Type: ProgramType(info.Type),
id: ProgramID(info.Id),
Tag: hex.EncodeToString(info.Tag[:]),
Name: unix.ByteSliceToString(info.Name[:]),
JitedSize: info.JitedProgLen,
TranslatedSize: info.XlatedProgLen,
LoadTime: time.Duration(info.LoadTime),
VerifiedInstructions: info.VerifiedInsns,
btf: btf.ID(info.BtfId),
stats: &programStats{
runtime: time.Duration(info.RunTimeNs),
runCount: info.RunCnt,
Expand Down

0 comments on commit f8c72b7

Please sign in to comment.