Date: Fri, 19 May 2023 17:29:37 +0000 From: jbo@insane.engineer To: "hackers@freebsd.org" <hackers@freebsd.org> Subject: Retrieving CPU steal time Message-ID: <JgCv0CymhTa2ZYxq2ri6fORyB-3XuP36xIvNpD6inOw2DF-qRfc9yQr_gcFyUeoiqnOizj1O1XWuni9ctm7WUkcaxA_6psNsWf6-_kBLRQk=@insane.engineer>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Moin, I took it upon myself to improve FreeBSD support for x11/polybar (a status bar thingy). Out-of-the-box, displaying the CPU load is not supported on FreeBSD. Upstream defines this structure for recording CPU load: https://github.com/polybar/polybar/blob/master/include/modules/cpu.hpp#L11 I've turned to the kern.cp_time(s) sysctl to retrieve the CPU load. This provides me with the fields for user, nice, system and idle. However, I'm not sure what to do about the 'steal' time which Linux uses to report CPU time spent in virtual environments. Is there an equivalent on FreeBSD? Best regards, ~ jbo [-- Attachment #2 --] <div style="font-family: Arial, sans-serif; font-size: 14px;">Moin,</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">I took it upon myself to improve FreeBSD support for x11/polybar (a status bar thingy).</div><div style="font-family: Arial, sans-serif; font-size: 14px;">Out-of-the-box, displaying the CPU load is not supported on FreeBSD.</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">Upstream defines this structure for recording CPU load: <span><a target="_blank" rel="noreferrer nofollow noopener" href="https://github.com/polybar/polybar/blob/master/include/modules/cpu.hpp#L11">https://github.com/polybar/polybar/blob/master/include/modules/cpu.hpp#L11</a></span><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">I've turned to the kern.cp_time(s) sysctl to retrieve the CPU load. This provides me with the fields for user, nice, system and idle. However, I'm not sure what to do about the 'steal' time which Linux uses to report CPU time spent in virtual environments.</div><div style="font-family: Arial, sans-serif; font-size: 14px;">Is there an equivalent on FreeBSD?</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">Best regards,</div><div style="font-family: Arial, sans-serif; font-size: 14px;">~ jbo<br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div> <div class="protonmail_signature_block protonmail_signature_block-empty" style="font-family: Arial, sans-serif; font-size: 14px;"> <div class="protonmail_signature_block-user protonmail_signature_block-empty"> </div> <div class="protonmail_signature_block-proton protonmail_signature_block-empty"> </div> </div>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?JgCv0CymhTa2ZYxq2ri6fORyB-3XuP36xIvNpD6inOw2DF-qRfc9yQr_gcFyUeoiqnOizj1O1XWuni9ctm7WUkcaxA_6psNsWf6-_kBLRQk=>
