forked from brendangregg/bpf-perf-tools-book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nettxlat.bt
executable file
·42 lines (37 loc) · 903 Bytes
/
nettxlat.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/local/bin/bpftrace
/*
* nettxlat - Show net device transmission latency.
*
* See BPF Performance Tools, Chapter 10, for an explanation of this tool.
*
* Copyright (c) 2019 Brendan Gregg.
* Licensed under the Apache License, Version 2.0 (the "License").
* This was originally created for the BPF Performance Tools book
* published by Addison Wesley. ISBN-13: 9780136554820
* When copying or porting, include this comment.
*
* 21-Apr-2019 Brendan Gregg Created this.
*/
BEGIN
{
printf("Tracing net device xmit queue latency. Hit Ctrl-C to end.\n");
}
tracepoint:net:net_dev_start_xmit
{
@start[args->skbaddr] = nsecs;
}
tracepoint:skb:consume_skb
/@start[args->skbaddr]/
{
@us = hist((nsecs - @start[args->skbaddr]) / 1000);
delete(@start[args->skbaddr]);
}
tracepoint:net:net_dev_queue
{
// avoid timestamp reuse:
delete(@start[args->skbaddr]);
}
END
{
clear(@start);
}