Skip to content

Commit

Permalink
fixup: change OffTimes from uint64 to in64
Browse files Browse the repository at this point in the history
#196 (comment)

Signed-off-by: Florian Lehner <[email protected]>
  • Loading branch information
florianl committed Jan 8, 2025
1 parent 9a3ac76 commit 9526af9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Trace struct {
PID libpf.PID
TID libpf.PID
Origin libpf.Origin
OffTime uint64 // Time a task was off-cpu in nanoseconds.
OffTime int64 // Time a task was off-cpu in nanoseconds.
APMTraceID libpf.APMTraceID
APMTransactionID libpf.APMTransactionID
CPU int
Expand Down
2 changes: 1 addition & 1 deletion reporter/base_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (b *baseReporter) ReportTraceEvent(trace *libpf.Trace, meta *TraceEventMeta
MappingEnds: trace.MappingEnd,
MappingFileOffsets: trace.MappingFileOffsets,
Timestamps: []uint64{uint64(meta.Timestamp)},
OffTimes: []uint64{meta.OffTime},
OffTimes: []int64{meta.OffTime},
}
}

Expand Down
4 changes: 1 addition & 3 deletions reporter/internal/pdata/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ func (p *Pdata) setProfile(
case support.TraceOriginSampling:
sample.Value().Append(1)
case support.TraceOriginOffCPU:
for _, offTime := range traceInfo.OffTimes {
sample.Value().Append(int64(offTime))
}
sample.Value().Append(traceInfo.OffTimes...)
}

// Walk every frame of the trace.
Expand Down
4 changes: 2 additions & 2 deletions reporter/internal/samples/samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type TraceEventMeta struct {
PID, TID libpf.PID
CPU int
Origin libpf.Origin
OffTime uint64
OffTime int64
}

// TraceEvents holds known information about a trace.
Expand All @@ -25,7 +25,7 @@ type TraceEvents struct {
MappingEnds []libpf.Address
MappingFileOffsets []uint64
Timestamps []uint64 // in nanoseconds
OffTimes []uint64 // in nanoseconds
OffTimes []int64 // in nanoseconds
}

// TraceAndMetaKey is the deduplication key for samples. This **must always**
Expand Down
2 changes: 1 addition & 1 deletion tracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ func (t *Tracer) loadBpfTrace(raw []byte, cpu int) *host.Trace {
PID: pid,
TID: libpf.PID(ptr.tid),
Origin: libpf.Origin(ptr.origin),
OffTime: uint64(ptr.offtime),
OffTime: int64(ptr.offtime),
KTime: times.KTime(ptr.ktime),
CPU: cpu,
}
Expand Down

0 comments on commit 9526af9

Please sign in to comment.