mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
27 lines
527 B
Plaintext
27 lines
527 B
Plaintext
|
#!/usr/bin/bpftrace
|
||
|
|
||
|
//BEGIN {
|
||
|
// printf("Monitor TXQ usage\n");
|
||
|
// printf(" - Remember: BPF set queue_mapping is one-less here (zero-indexed)\n");
|
||
|
//}
|
||
|
|
||
|
tracepoint:net:net_dev_start_xmit {
|
||
|
$qm = args->queue_mapping;
|
||
|
$dev = str(args->name, 15);
|
||
|
|
||
|
@stat_txq_usage[$dev] = lhist($qm, 0,32,1);
|
||
|
}
|
||
|
|
||
|
/* Periodically print stats */
|
||
|
interval:s:3
|
||
|
{
|
||
|
printf("\nPeriodic show stats - time: ");
|
||
|
time();
|
||
|
print(@stat_txq_usage);
|
||
|
}
|
||
|
|
||
|
/* Default bpftrace will print all remaining maps at END */
|
||
|
//END {
|
||
|
// printf("END stats:\n");
|
||
|
//}
|