Skip to content

Commit 06ce134

Browse files
Nicolae Mogoreanuekyooo
authored andcommitted
Delete the element from the starts map after it has been used.
I think it has been an omission, as opposed to an optimization, in the original change that introduced this. The python version of the `funclatency` has the delete after the lookup. Before the change: ./funclatency nvme_setup_cmd Tracing nvme_setup_cmd. Hit Ctrl-C to exit ^C nsec : count distribution 0 -> 1 : 0 | | 2 -> 3 : 0 | | 4 -> 7 : 0 | | 8 -> 15 : 0 | | 16 -> 31 : 0 | | 32 -> 63 : 0 | | 64 -> 127 : 0 | | 128 -> 255 : 0 | | 256 -> 511 : 0 | | 512 -> 1023 : 243 |****************************************| 1024 -> 2047 : 43 |******* | 2048 -> 4095 : 59 |********* | 4096 -> 8191 : 26 |**** | After the change: ./funclatency nvme_setup_cmd Tracing nvme_setup_cmd. Hit Ctrl-C to exit ^C nsec : count distribution 0 -> 1 : 0 | | 2 -> 3 : 0 | | 4 -> 7 : 0 | | 8 -> 15 : 0 | | 16 -> 31 : 0 | | 32 -> 63 : 0 | | 64 -> 127 : 0 | | 128 -> 255 : 0 | | 256 -> 511 : 4 | | 512 -> 1023 : 624 |****************************************| 1024 -> 2047 : 39 |** | 2048 -> 4095 : 98 |****** | 4096 -> 8191 : 71 |**** | 8192 -> 16383 : 1 | |
1 parent 354e423 commit 06ce134

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

libbpf-tools/funclatency.bpf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ static void exit(void)
8888
if (slot >= MAX_SLOTS)
8989
slot = MAX_SLOTS - 1;
9090
__sync_fetch_and_add(&hist[slot], 1);
91+
92+
bpf_map_delete_elem(&starts, &pid);
9193
}
9294

9395
SEC("fexit/dummy_fexit")

0 commit comments

Comments
 (0)