I'm trying to measure exact execution time/cycles for specific functions with oerf tool. I added events for entering and returning from each function by using perf probe. I can see the functions with perf script like so:
perf script --header -F comm,pid,tid,cpu,time,event
This is what I get:
kpktgend_1 33688/33688 [001] 151433.505544: probe:pktgen_alloc_skb:
kpktgend_1 33688/33688 [001] 151433.505545: probe:pktgen_alloc_skb_1:
kpktgend_1 33688/33688 [001] 151433.505546: probe:mlx5e_xmit:
kpktgend_1 33688/33688 [001] 151433.505546: probe:mlx5e_xmit_1:
kpktgend_1 33688/33688 [001] 151433.505547: probe:pktgen_alloc_skb:
kpktgend_1 33688/33688 [001] 151433.505547: probe:pktgen_alloc_skb_1:
kpktgend_1 33688/33688 [001] 151433.505548: probe:mlx5e_xmit:
kpktgend_1 33688/33688 [001] 151433.505549: probe:mlx5e_xmit_1:
Each "event" is entry point to the function and "event"_1 is the return point from the function. This is pretty close to what I want, as you can see I get the timing of the calls.
Three questions:
Running perf script with --ns flag solves the issue.
perf script -F time --ns
76970.575503465:
76970.575506464:
76970.575507479:
Without:
$perf script -F time
76970.575503:
76970.575506:
76970.575507:
From documentation:
perf script -h
--ns Use 9 decimal places when displaying time