You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There may be micro difference betweentime.Now() and the time when connection closed, the former is the processing time, and the latter is the event time. The duration between these two timestamps is used for agent handling.
The text was updated successfully, but these errors were encountered:
Here is my idea.
eBPF program can get the time since boot, by calling bpf_ktime_get_boot_ns. We can record it as event_ktime.
GoLang program can also get the time since boot, by wrapping the clock_gettime syscall. We can record it as process_ktime. Here is a GoLang demo:
func getMonotonicTime() {
const CLOCK_MONOTONIC = 1 // CLOCK_MONOTONIC is the identifier for the monotonic clock in Linux.
var ts syscall.Timespec
_, _, errCode := syscall.Syscall(syscall.SYS_CLOCK_GETTIME, CLOCK_MONOTONIC, uintptr(unsafe.Pointer(&ts)), 0)
if errCode != 0 {
fmt.Printf("Failed to call SYS_CLOCK_GETTIME.\n")
return
}
fmt.Printf("Monotonic time since boot is: %d seconds, %d nanoseconds.\n", ts.Sec, ts.Nsec)
duration, err := time.ParseDuration(fmt.Sprintf("%ds%dns", ts.Sec, ts.Nsec))
if err != nil {
return
}
fmt.Printf("That's about %d minutes\n", int(duration.Minutes()))
}
Obviously GoLang program can get the well clock time through the now() function. We can record it as process_time.
So the accurate well clock time when l7_event emitted from the tracepiont event_time = process_time - process_ktime + event_ktime.
coroot-node-agent/tracing/tracing.go
Line 90 in a90fb2d
There may be micro difference between
time.Now()
and the time when connection closed, the former is the processing time, and the latter is the event time. The duration between these two timestamps is used for agent handling.The text was updated successfully, but these errors were encountered: