Performance Counters in Htop 3.0
Total Page:16
File Type:pdf, Size:1020Kb
Slide: [ ] Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Performance counters in htop 3.0 Hisham Muhammad @[email protected] https://hisham.hm Slide: [ 2 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command About me original author of htop, a project started in 2004 http://hisham.hm/htop/ lead dev of LuaRocks, package manager for Lua http://luarocks.org/ co-founder of the GoboLinux distribution http://gobolinux.org/ developer at Kong – FLOSS API gateway http://getkong.org/ (we’re hiring!) Slide: [ 3 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command What is htop an interactive process manager intended to be “a better top” by this all I originally meant was: scrolling! (versions of top improved a lot since!) Slide: [ 4 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Hello, htop! Slide: [ 5 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command htop beyond Linux Linux MacOS FreeBSD OpenBSD DragonFlyBSD Solaris (illumos) Slide: [ 6 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Then Apple released a broken kernel... Slide: [ 7 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command This has just arrived! Slide: [ 8 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command htop’s <3 belongs to Linux Having the crossplatform layer doesn’t mean a lowest common denominator Each platform can and has its own metrics Linuxdev-br 2017 gave me ideas... Slide: [ 9 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Metrics in htop I started with the default set of top Most people don't go beyond the default settings (A lot of people don't even know about tree view!) Slide: [ 10 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command htop has a lot more! hit F2 (or uppercase C) to enter Setup and play around: Slide: [ 11 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command I/O metrics inspired by iotop these have in fact been available in htop for years! IO_RATE IO_READ_RATE IO_WRITE_RATE IO_PRIORITY Slide: [ 12 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command I/O metrics Slide: [ 13 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Delay accounting contributed by André Carvalho PERCENT_CPU_DELAY PERCENT_IO_DELAY PERCENT_SWAP_DELAY requires libnl for Netlink support to learn more about delay accounting: https://andrestc.com/post/linux-delay-accounting/ Slide: [ 14 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Hardware Performance Counters low-overhead performance metrics managed by the Linux kernel available in userspace via perf-tools Slide: [ 15 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Using performance counters 1) perform a syscall to request a counter 2) syscall returns a file descriptor 3) periodically read the file descriptor be aware: fds and perf counters are a limited resource! based on tiptop by Erven Rohou and Antoine Naudin https://hal.inria.fr/hal-00639173 Slide: [ 16 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Performance counters in htop IPC Instructions per cycle MCYCLE Cycles (millions) MINSTR Instructions (millions) PERCENT_MISS Cache misses per 100 insns PERCENT_BMISS Branch mispr. per 100 insns L1DREADS L1 data cache reads (Ks) L1DRMISSES L1 data cache read misses L1DWRITES L1 data cache writes L1DWMISSES L1 data cache write misses Slide: [ 17 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Multiple screens making a larger number of metrics usable press [Tab] to switch screens required a larger change to the format of htoprc Slide: [ 18 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Demo time! Slide: [ 19 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Screenshot time: Perf Slide: [ 20 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Screenshot time: L1 Slide: [ 21 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Screenshot time: Screens Slide: [ 22 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Availability I/O metrics and delay accounting: htop 2.1.0 and up performance counters and multiple screens: htop 3.0.0beta5 Linux-only! (patches welcome!) Slide: [ 23 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command Thank you! https://hisham.hm/htop/ https://github.com/hishamhm/htop Slide: [ 24 ] Date: 2018-08-25 Talk: Perf counters in htop 3.0 Presenter: https://hisham.hm PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command What’s next New header meters? Per-screen headers? More perf counters? PS: check out the lua branch.