{"id":15056937,"url":"https://github.com/asphaltt/skbdist","last_synced_at":"2025-04-10T04:56:41.848Z","repository":{"id":248384913,"uuid":"828540263","full_name":"Asphaltt/skbdist","owner":"Asphaltt","description":"A bpf-based packet's latency distribution measurement tool. Apache 2.0 License","archived":false,"fork":false,"pushed_at":"2024-07-15T14:03:46.000Z","size":772,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T06:11:32.375Z","etag":null,"topics":["ebpf","ebpf-co-re","skb","skbdist"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Asphaltt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-14T13:10:33.000Z","updated_at":"2025-03-15T20:58:35.000Z","dependencies_parsed_at":"2024-07-14T15:19:24.639Z","dependency_job_id":"fd6023ca-0130-4df8-9f59-adf316e8d30c","html_url":"https://github.com/Asphaltt/skbdist","commit_stats":null,"previous_names":["asphaltt/skbdist"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asphaltt%2Fskbdist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asphaltt%2Fskbdist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asphaltt%2Fskbdist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asphaltt%2Fskbdist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Asphaltt","download_url":"https://codeload.github.com/Asphaltt/skbdist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161261,"owners_count":21057554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ebpf","ebpf-co-re","skb","skbdist"],"created_at":"2024-09-24T21:58:59.754Z","updated_at":"2025-04-10T04:56:41.820Z","avatar_url":"https://github.com/Asphaltt.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n Copyright 2024 Leon Hwang.\n SPDX-License-Identifier: Apache-2.0\n--\u003e\n\n# skbdist: A bpf-based packet's latency distribution measurement tool\n\nAt netdev layer of Linux networking stack, there are two tracepoints to measure packet's latency:\n\n- `netif_receive_skb`: This tracepoint is triggered when a packet is received by the network device driver.\n- `net_dev_xmit`: This tracepoint is triggered when a packet is transmitted by the network device driver.\n\n## Usage\n\n```bash\n$ ./skbdist -h\nUsage: ./skbdist [options] [pcap-filter]\n    Available pcap-filter: see \"man 7 pcap-filter\"\n    Available options:\n      --dist-cpu           Measure distribution of CPU\n      --dist-latency       Measure distribution of skb latency\n      --dist-queue         Measure distribution of queue\n      --dist-skblen        Measure distribution of skb length\n  -i, --interface string   Interface to filter packets, all interfaces if not specified\n  -n, --non-core           Run with non-core bpf [TODO]\n```\n\nNOTE: If to use [pcap-filter](https://www.tcpdump.org/manpages/pcap-filter.7.html), `src`/`dst` should not be used in it.\n\n## Examples\n\nTo measure the response latency of a TCP port, you can use the following command:\n\n```bash\n$ sudo ./skbdist --dist-cpu --dist-queue --dist-skblen --dist-latency tcp port 8080\n2024/07/15 13:41:27 Attached tracepoint/net/netif_receive_skb\n2024/07/15 13:41:27 Attached tracepoint/net/net_dev_xmit\nCtrl+C to show results..\n^C\nSend SKB lengths (total 5 pkts) :\n      byte               : count         distribution\n         0 -\u003e 1          : 0             |                                        |\n         2 -\u003e 3          : 0             |                                        |\n         4 -\u003e 7          : 0             |                                        |\n         8 -\u003e 15         : 0             |                                        |\n        16 -\u003e 31         : 0             |                                        |\n        32 -\u003e 63         : 0             |                                        |\n        64 -\u003e 127        : 3             |****************************************|\n       128 -\u003e 255        : 1             |*************                           |\n       256 -\u003e 511        : 0             |                                        |\n       512 -\u003e 1023       : 1             |*************                           |\n\nReceive SKB lengths (total 6 pkts) :\n      byte               : count         distribution\n         0 -\u003e 1          : 0             |                                        |\n         2 -\u003e 3          : 0             |                                        |\n         4 -\u003e 7          : 0             |                                        |\n         8 -\u003e 15         : 0             |                                        |\n        16 -\u003e 31         : 0             |                                        |\n        32 -\u003e 63         : 4             |****************************************|\n        64 -\u003e 127        : 1             |**********                              |\n       128 -\u003e 255        : 1             |**********                              |\n\n\nRecv CPU's distribution (total 6 pkts) :\nCPU   6: 6\n\nXmit CPU's distribution (total 5 pkts) :\nCPU   3: 2\nCPU   6: 3\n\n\nRecv queue distribution (total 6 pkts) :\nQueue   0: 6\n\n\n192.168.241.133:8080 -\u003e 192.168.241.1:61645 (TCP) (total 5 records) :\n        µs               : count         distribution\n         0 -\u003e 1          : 0             |                                        |\n         2 -\u003e 3          : 1             |****************************************|\n         4 -\u003e 7          : 0             |                                        |\n         8 -\u003e 15         : 1             |****************************************|\n        16 -\u003e 31         : 0             |                                        |\n        32 -\u003e 63         : 0             |                                        |\n        64 -\u003e 127        : 1             |****************************************|\n       128 -\u003e 255        : 1             |****************************************|\n       256 -\u003e 511        : 0             |                                        |\n       512 -\u003e 1023       : 0             |                                        |\n      1024 -\u003e 2047       : 0             |                                        |\n      2048 -\u003e 4095       : 0             |                                        |\n      4096 -\u003e 8191       : 0             |                                        |\n      8192 -\u003e 16383      : 1             |****************************************|\n```\n\n## Development\n\n`skbdist` requires the following dependencies:\n\n- `clang` and `llvm`: To compile eBPF program.\n- `libpcap.a`: To inject pcap-filter to eBPF program.\n\nBuild and run:\n\n```bash\ngo generate\ngo build -v\n./skbdist -h\n```\n\n## TODOs\n\n- [ ] Support non-CORE bpf on old kernels\n- [ ] Support filtering inner-VxLAN packets\n\n## Credits\n\n- [elibpcap](github.com/jschwinger233/elibpcap): A really cool library to inject pcap-filter into eBPF programs.\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasphaltt%2Fskbdist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasphaltt%2Fskbdist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasphaltt%2Fskbdist/lists"}