From nobody Sun Oct 5 00:10:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=suse.de Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1758128680786659.3463095331223; Wed, 17 Sep 2025 10:04:40 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 850FB4197B; Wed, 17 Sep 2025 13:04:39 -0400 (EDT) Received: from [172.19.199.10] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 17CD941B93; Wed, 17 Sep 2025 13:02:19 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id BFA2C41A0D; Wed, 17 Sep 2025 13:02:09 -0400 (EDT) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 90E0241A0C for ; Wed, 17 Sep 2025 13:02:05 -0400 (EDT) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E625621202; Wed, 17 Sep 2025 17:02:03 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8BFBC1368D; Wed, 17 Sep 2025 17:02:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id d5zlHovpymiyOwAAD6G6ig (envelope-from ); Wed, 17 Sep 2025 17:02:03 +0000 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1758128524; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lIjNgO2DI9rPAzWqYDwxqVbcO3liwVQ2OwP47WCmRUI=; b=yIF0RvbPazeilo2HSYvIWpUHouFqtQ8pvSYlCtr8JGAnK2uoK56QLQ5lUxovF0tWe7822W Vp3Ta8BlGaoMCvwlwOU8OVd7Y7H9Qaim0xDHk8OO0WXCnHABHhAaIvP2mVNQFbU7ficeCU ep3N7qxc4Ghs9F9QP3PZ539A4DgzK6M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1758128524; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lIjNgO2DI9rPAzWqYDwxqVbcO3liwVQ2OwP47WCmRUI=; b=8HIEFxjaUQ6Ci/ywgK2BiSUvukimgusNlrrDICNUdCmC05xYVsgJCuy32LGWr1A+U8D90R qioigXndehJa0ADQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Chj+Aciq; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=PkrbvWKD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1758128523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lIjNgO2DI9rPAzWqYDwxqVbcO3liwVQ2OwP47WCmRUI=; b=Chj+AciqS0ubTBg61o6xx9uBXa0NVh8Ysd4IoY20MiuOW5Gaac1BcqI0jkm6SgVNg5x/xF 2V+LVvi8JIPSqMIwrtWHZ3KSTWqc7Rdixhf/YiUlOumbhgZ/5PWG8KzGlN71tRVTaR1OX2 0sEiDwy4p8NBjQjR5DMHyqeOQiIAi5M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1758128523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lIjNgO2DI9rPAzWqYDwxqVbcO3liwVQ2OwP47WCmRUI=; b=PkrbvWKDojT+BTdRbbbfD0ACnIx0pSUnqygm4XzoLqZBkOQbXDU72YuNs1MgHXe+QMIrl5 QMwOkCnGyox1BDBQ== From: Claudio Fontana To: devel@lists.libvirt.org Subject: [PATCH] libvirt-host: VIR_NODE_CPU_STATS: clarify Linux, BSD differences Date: Wed, 17 Sep 2025 19:01:55 +0200 Message-Id: <20250917170155.13158-1-cfontana@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: E625621202 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action Message-ID-Hash: R7KO7PEV66ITF255HR7JRJ3R7I74L4DX X-Message-ID-Hash: R7KO7PEV66ITF255HR7JRJ3R7I74L4DX X-MailFrom: cfontana@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Claudio Fontana , Michal Privoznik X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (found 4 invalid signatures) X-ZM-MESSAGEID: 1758128683675116600 Content-Type: text/plain; charset="utf-8" the accounting choices are not necessarily intuitive, especially comparing Linux with BSD, so clarify the current state of things. Mark which counters are actually used on Linux and BSD, and how they are accumulated into the libvirt statistics. Signed-off-by: Claudio Fontana --- include/libvirt/libvirt-host.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h index 398b40c35a..4d4f1c02df 100644 --- a/include/libvirt/libvirt-host.h +++ b/include/libvirt/libvirt-host.h @@ -223,6 +223,9 @@ typedef enum { * Macro for the cumulative CPU time which was spent by the kernel, * since the node booting up (in nanoseconds). * + * Linux: this statistic includes kernel + irq + softirq time. + * BSD: this statistic includes only CP_SYS. CP_INTR is accounted separate= ly. + * * Since: 0.9.3 */ # define VIR_NODE_CPU_STATS_KERNEL "kernel" @@ -233,6 +236,8 @@ typedef enum { * The cumulative CPU time which was spent by user processes, * since the node booting up (in nanoseconds). * + * Linux, BSD: this statistic includes user + nice time. + * * Since: 0.9.3 */ # define VIR_NODE_CPU_STATS_USER "user" @@ -243,6 +248,8 @@ typedef enum { * The cumulative idle CPU time, * since the node booting up (in nanoseconds). * + * Linux, BSD + * * Since: 0.9.3 */ # define VIR_NODE_CPU_STATS_IDLE "idle" @@ -253,6 +260,8 @@ typedef enum { * The cumulative I/O wait CPU time, * since the node booting up (in nanoseconds). * + * Linux-only. + * * Since: 0.9.3 */ # define VIR_NODE_CPU_STATS_IOWAIT "iowait" @@ -263,6 +272,9 @@ typedef enum { * The cumulative interrupt CPU time, * since the node booting up (in nanoseconds). * + * BSD-only. + * Note that on Linux, interrupt CPU time is accounted as part of "kernel". + * * Since: 1.2.2 */ # define VIR_NODE_CPU_STATS_INTR "intr" @@ -273,6 +285,9 @@ typedef enum { * The cumulative CPU time spent running guest virtual CPUs, * since the node booting up (in nanoseconds). * + * Linux-only. + * Note that on BSD, guest CPU time is accounted as part of CP_SYS alias "= kernel" + * * Since: 11.8.0 */ # define VIR_NODE_CPU_STATS_GUEST "guest" --=20 2.35.3