{"id":437,"date":"2020-10-04T20:09:24","date_gmt":"2020-10-04T19:09:24","guid":{"rendered":"https:\/\/blog.thomarite.uk\/?p=437"},"modified":"2020-10-24T18:39:48","modified_gmt":"2020-10-24T17:39:48","slug":"bpf-linux","status":"publish","type":"post","link":"https:\/\/blog.thomarite.uk\/index.php\/2020\/10\/04\/bpf-linux\/","title":{"rendered":"BPF &#8211; Linux"},"content":{"rendered":"\n<p>Last time I tried BPF was via an Ubuntu VM prepared for BPF. But this week checking another <a href=\"https:\/\/codeburst.io\/how-bpftrace-can-help-you-to-resolve-any-bug-in-production-ced4d93b1c6e\">article<\/a>, I realised that I can run BPF natively in my laptop!!!<\/p>\n\n\n\n<p>So aptitude did the job installing the package, and didn&#8217;t have to install a new kernel or patch, so super easy and I can see it is working as based in the article:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># apt depends bpftrace\nbpftrace\nDepends: libbpfcc (>= 0.12.0)\nDepends: libc6 (>= 2.27)\nDepends: libclang1-9 (>= 1:9~svn359771-1~)\nDepends: libgcc-s1 (>= 3.0)\nDepends: libllvm9 (>= 1:9~svn298832-1~)\nDepends: libstdc++6 (>= 5.2)\n#\n#\n# dpkg -l | grep bpftrace\nii bpftrace 0.11.0-1 amd64 high-level tracing language for Linux eBPF\n#\n# uname -a\nLinux athens 5.8.0-1-amd64 #1 SMP Debian 5.8.7-1 (2020-09-05) x86_64 GNU\/Linux\n#\n#\n# bpftrace -e 'software:faults:1 { @[comm] = count(); }'\nAttaching 1 probe\u2026\n^C\n@[BatteryStatusNo]: 1\n@[slack]: 52\n@[Xorg]: 139\n@[VizCompositorTh]: 455\n@[Chrome_IOThread]: 463\n@[ThreadPoolForeg]: 1305\n@[CompositorTileW]: 2272\n@[Compositor]: 3789\n@[Chrome_ChildIOT]: 4610\n@[chrome]: 8020\n#<\/pre>\n\n\n\n<p>And run the same <a href=\"https:\/\/gist.github.com\/cuongld2\/48a95b9c2e05f9cfcefaa0b12ccd5f69\">script<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># bpftrace bpftrace-example.bt\nAttaching 2 probes\u2026\nSampling CPU at 99hz\u2026 Hit Ctrl-C to end.\n^C\n@cpu:\n[0, 1) 33 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|\n[1, 2) 23 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |\n[2, 3) 31 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |\n[3, 4) 23 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |\n#<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Now I really need to play with it in my own system, no excuse...<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Last time I tried BPF was via an Ubuntu VM prepared for BPF. But this week checking another article, I realised that I can run BPF natively in my laptop!!! So aptitude did the job installing the package, and didn&#8217;t have to install a new kernel or patch, so super easy and I can see &hellip; <a href=\"https:\/\/blog.thomarite.uk\/index.php\/2020\/10\/04\/bpf-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;BPF &#8211; Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-437","post","type-post","status-publish","format-standard","hentry","category-unix"],"_links":{"self":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/comments?post=437"}],"version-history":[{"count":1,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/437\/revisions"}],"predecessor-version":[{"id":438,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/437\/revisions\/438"}],"wp:attachment":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/media?parent=437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/categories?post=437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/tags?post=437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}