From nobody Sun Nov 24 20:25:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1720790832; cv=none; d=zohomail.com; s=zohoarc; b=OWi9KAiGU7oOiGIV3dCqR46EeV199arjcGp+FbeDLmT//Zxyi3IXkdYHzGGIUGdpnqmvyPD8kCnXjxuwZUFT5+eV4Aa7bVDilZcnpdhemWpHgAzpIFlf7mWCOKVqorOfdOHVRI9uf4MXg4ORVDx8v3QMkiHtQduf9D/Er3gU04A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720790832; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Iff7MwXFHB5Wb/dYGR6Gzh5ZIQoOnBEqwIUmrBRHZBE=; b=PUFGpvRNx2BJOKZptB3SepHkfmQ40ZUv/eWiHCAysvnHe7t/tN6sKiJvwASZFiSMaGzueHq8HnkSvlV94T1Tp65hZSA2+uRWi+B5A13pRAvgX3xCgEy2Pwq78wUWtN4KpSlpouNtXTlpuO+G/t2iPZzvyAzmZKFvgv0/tf08fMg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1720790832535567.5591286624638; Fri, 12 Jul 2024 06:27:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSGI1-0005xw-8S; Fri, 12 Jul 2024 09:26:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSGHB-0002C7-C1 for qemu-devel@nongnu.org; Fri, 12 Jul 2024 09:25:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSGH8-0003l2-EU for qemu-devel@nongnu.org; Fri, 12 Jul 2024 09:25:29 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-591-NAbRZCydOC6Yg_3bqQFivA-1; Fri, 12 Jul 2024 09:25:24 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8DBA319560B3; Fri, 12 Jul 2024 13:25:23 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.56]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8405F1955F40; Fri, 12 Jul 2024 13:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720790725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Iff7MwXFHB5Wb/dYGR6Gzh5ZIQoOnBEqwIUmrBRHZBE=; b=DQEY/Ufq/wSLpaWu7dQnOqOURS+gD0oNlhnZQqFb08tOrWZW9lDkHP0iBTlBf4K3FVg8Su 92Rn/TuwV4DifwxRNBoYEKubongdKhv+f5no2NnTKp3QVyEdPzkwlC0eulv15NFIUuTa5a jEzwo+d3tg/zZES4dMjZbHjttM2A+5w= X-MC-Unique: NAbRZCydOC6Yg_3bqQFivA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Konstantin Kostiuk Subject: [PATCH v3 05/22] qga: move linux disk/cpu stats command impls to commands-linux.c Date: Fri, 12 Jul 2024 14:24:42 +0100 Message-ID: <20240712132459.3974109-6-berrange@redhat.com> In-Reply-To: <20240712132459.3974109-1-berrange@redhat.com> References: <20240712132459.3974109-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.138, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1720790834122116600 The qmp_guest_{diskstats,cpustats} command impls in commands-posix.c are surrounded by '#ifdef __linux__' so should instead live in commands-linux.c This also removes a "#ifdef CONFIG_LINUX" that was nested inside a "#ifdef __linux__". Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Konstantin Kostiuk Signed-off-by: Daniel P. Berrang=C3=A9 --- qga/commands-linux.c | 195 ++++++++++++++++++++++++++++++++++++++++++ qga/commands-posix.c | 199 ------------------------------------------- 2 files changed, 195 insertions(+), 199 deletions(-) diff --git a/qga/commands-linux.c b/qga/commands-linux.c index 084e6c9e85..c0e8bd4062 100644 --- a/qga/commands-linux.c +++ b/qga/commands-linux.c @@ -1594,3 +1594,198 @@ int64_t qmp_guest_set_vcpus(GuestLogicalProcessorLi= st *vcpus, Error **errp) =20 return processed; } + +#define MAX_NAME_LEN 128 +static GuestDiskStatsInfoList *guest_get_diskstats(Error **errp) +{ + GuestDiskStatsInfoList *head =3D NULL, **tail =3D &head; + const char *diskstats =3D "/proc/diskstats"; + FILE *fp; + size_t n; + char *line =3D NULL; + + fp =3D fopen(diskstats, "r"); + if (fp =3D=3D NULL) { + error_setg_errno(errp, errno, "open(\"%s\")", diskstats); + return NULL; + } + + while (getline(&line, &n, fp) !=3D -1) { + g_autofree GuestDiskStatsInfo *diskstatinfo =3D NULL; + g_autofree GuestDiskStats *diskstat =3D NULL; + char dev_name[MAX_NAME_LEN]; + unsigned int ios_pgr, tot_ticks, rq_ticks, wr_ticks, dc_ticks, fl_= ticks; + unsigned long rd_ios, rd_merges_or_rd_sec, rd_ticks_or_wr_sec, wr_= ios; + unsigned long wr_merges, rd_sec_or_wr_ios, wr_sec; + unsigned long dc_ios, dc_merges, dc_sec, fl_ios; + unsigned int major, minor; + int i; + + i =3D sscanf(line, "%u %u %s %lu %lu %lu" + "%lu %lu %lu %lu %u %u %u %u" + "%lu %lu %lu %u %lu %u", + &major, &minor, dev_name, + &rd_ios, &rd_merges_or_rd_sec, &rd_sec_or_wr_ios, + &rd_ticks_or_wr_sec, &wr_ios, &wr_merges, &wr_sec, + &wr_ticks, &ios_pgr, &tot_ticks, &rq_ticks, + &dc_ios, &dc_merges, &dc_sec, &dc_ticks, + &fl_ios, &fl_ticks); + + if (i < 7) { + continue; + } + + diskstatinfo =3D g_new0(GuestDiskStatsInfo, 1); + diskstatinfo->name =3D g_strdup(dev_name); + diskstatinfo->major =3D major; + diskstatinfo->minor =3D minor; + + diskstat =3D g_new0(GuestDiskStats, 1); + if (i =3D=3D 7) { + diskstat->has_read_ios =3D true; + diskstat->read_ios =3D rd_ios; + diskstat->has_read_sectors =3D true; + diskstat->read_sectors =3D rd_merges_or_rd_sec; + diskstat->has_write_ios =3D true; + diskstat->write_ios =3D rd_sec_or_wr_ios; + diskstat->has_write_sectors =3D true; + diskstat->write_sectors =3D rd_ticks_or_wr_sec; + } + if (i >=3D 14) { + diskstat->has_read_ios =3D true; + diskstat->read_ios =3D rd_ios; + diskstat->has_read_sectors =3D true; + diskstat->read_sectors =3D rd_sec_or_wr_ios; + diskstat->has_read_merges =3D true; + diskstat->read_merges =3D rd_merges_or_rd_sec; + diskstat->has_read_ticks =3D true; + diskstat->read_ticks =3D rd_ticks_or_wr_sec; + diskstat->has_write_ios =3D true; + diskstat->write_ios =3D wr_ios; + diskstat->has_write_sectors =3D true; + diskstat->write_sectors =3D wr_sec; + diskstat->has_write_merges =3D true; + diskstat->write_merges =3D wr_merges; + diskstat->has_write_ticks =3D true; + diskstat->write_ticks =3D wr_ticks; + diskstat->has_ios_pgr =3D true; + diskstat->ios_pgr =3D ios_pgr; + diskstat->has_total_ticks =3D true; + diskstat->total_ticks =3D tot_ticks; + diskstat->has_weight_ticks =3D true; + diskstat->weight_ticks =3D rq_ticks; + } + if (i >=3D 18) { + diskstat->has_discard_ios =3D true; + diskstat->discard_ios =3D dc_ios; + diskstat->has_discard_merges =3D true; + diskstat->discard_merges =3D dc_merges; + diskstat->has_discard_sectors =3D true; + diskstat->discard_sectors =3D dc_sec; + diskstat->has_discard_ticks =3D true; + diskstat->discard_ticks =3D dc_ticks; + } + if (i >=3D 20) { + diskstat->has_flush_ios =3D true; + diskstat->flush_ios =3D fl_ios; + diskstat->has_flush_ticks =3D true; + diskstat->flush_ticks =3D fl_ticks; + } + + diskstatinfo->stats =3D g_steal_pointer(&diskstat); + QAPI_LIST_APPEND(tail, diskstatinfo); + diskstatinfo =3D NULL; + } + free(line); + fclose(fp); + return head; +} + +GuestDiskStatsInfoList *qmp_guest_get_diskstats(Error **errp) +{ + return guest_get_diskstats(errp); +} + +GuestCpuStatsList *qmp_guest_get_cpustats(Error **errp) +{ + GuestCpuStatsList *head =3D NULL, **tail =3D &head; + const char *cpustats =3D "/proc/stat"; + int clk_tck =3D sysconf(_SC_CLK_TCK); + FILE *fp; + size_t n; + char *line =3D NULL; + + fp =3D fopen(cpustats, "r"); + if (fp =3D=3D NULL) { + error_setg_errno(errp, errno, "open(\"%s\")", cpustats); + return NULL; + } + + while (getline(&line, &n, fp) !=3D -1) { + GuestCpuStats *cpustat =3D NULL; + GuestLinuxCpuStats *linuxcpustat; + int i; + unsigned long user, system, idle, iowait, irq, softirq, steal, gue= st; + unsigned long nice, guest_nice; + char name[64]; + + i =3D sscanf(line, "%s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu", + name, &user, &nice, &system, &idle, &iowait, &irq, &sof= tirq, + &steal, &guest, &guest_nice); + + /* drop "cpu 1 2 3 ...", get "cpuX 1 2 3 ..." only */ + if ((i =3D=3D EOF) || strncmp(name, "cpu", 3) || (name[3] =3D=3D '= \0')) { + continue; + } + + if (i < 5) { + slog("Parsing cpu stat from %s failed, see \"man proc\"", cpus= tats); + break; + } + + cpustat =3D g_new0(GuestCpuStats, 1); + cpustat->type =3D GUEST_CPU_STATS_TYPE_LINUX; + + linuxcpustat =3D &cpustat->u.q_linux; + linuxcpustat->cpu =3D atoi(&name[3]); + linuxcpustat->user =3D user * 1000 / clk_tck; + linuxcpustat->nice =3D nice * 1000 / clk_tck; + linuxcpustat->system =3D system * 1000 / clk_tck; + linuxcpustat->idle =3D idle * 1000 / clk_tck; + + if (i > 5) { + linuxcpustat->has_iowait =3D true; + linuxcpustat->iowait =3D iowait * 1000 / clk_tck; + } + + if (i > 6) { + linuxcpustat->has_irq =3D true; + linuxcpustat->irq =3D irq * 1000 / clk_tck; + linuxcpustat->has_softirq =3D true; + linuxcpustat->softirq =3D softirq * 1000 / clk_tck; + } + + if (i > 8) { + linuxcpustat->has_steal =3D true; + linuxcpustat->steal =3D steal * 1000 / clk_tck; + } + + if (i > 9) { + linuxcpustat->has_guest =3D true; + linuxcpustat->guest =3D guest * 1000 / clk_tck; + } + + if (i > 10) { + linuxcpustat->has_guest =3D true; + linuxcpustat->guest =3D guest * 1000 / clk_tck; + linuxcpustat->has_guestnice =3D true; + linuxcpustat->guestnice =3D guest_nice * 1000 / clk_tck; + } + + QAPI_LIST_APPEND(tail, cpustat); + } + + free(line); + fclose(fp); + return head; +} diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 98aafc45f3..5da60e65ab 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -1195,205 +1195,6 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_in= fo(Error **errp) return info; } =20 -#define MAX_NAME_LEN 128 -static GuestDiskStatsInfoList *guest_get_diskstats(Error **errp) -{ -#ifdef CONFIG_LINUX - GuestDiskStatsInfoList *head =3D NULL, **tail =3D &head; - const char *diskstats =3D "/proc/diskstats"; - FILE *fp; - size_t n; - char *line =3D NULL; - - fp =3D fopen(diskstats, "r"); - if (fp =3D=3D NULL) { - error_setg_errno(errp, errno, "open(\"%s\")", diskstats); - return NULL; - } - - while (getline(&line, &n, fp) !=3D -1) { - g_autofree GuestDiskStatsInfo *diskstatinfo =3D NULL; - g_autofree GuestDiskStats *diskstat =3D NULL; - char dev_name[MAX_NAME_LEN]; - unsigned int ios_pgr, tot_ticks, rq_ticks, wr_ticks, dc_ticks, fl_= ticks; - unsigned long rd_ios, rd_merges_or_rd_sec, rd_ticks_or_wr_sec, wr_= ios; - unsigned long wr_merges, rd_sec_or_wr_ios, wr_sec; - unsigned long dc_ios, dc_merges, dc_sec, fl_ios; - unsigned int major, minor; - int i; - - i =3D sscanf(line, "%u %u %s %lu %lu %lu" - "%lu %lu %lu %lu %u %u %u %u" - "%lu %lu %lu %u %lu %u", - &major, &minor, dev_name, - &rd_ios, &rd_merges_or_rd_sec, &rd_sec_or_wr_ios, - &rd_ticks_or_wr_sec, &wr_ios, &wr_merges, &wr_sec, - &wr_ticks, &ios_pgr, &tot_ticks, &rq_ticks, - &dc_ios, &dc_merges, &dc_sec, &dc_ticks, - &fl_ios, &fl_ticks); - - if (i < 7) { - continue; - } - - diskstatinfo =3D g_new0(GuestDiskStatsInfo, 1); - diskstatinfo->name =3D g_strdup(dev_name); - diskstatinfo->major =3D major; - diskstatinfo->minor =3D minor; - - diskstat =3D g_new0(GuestDiskStats, 1); - if (i =3D=3D 7) { - diskstat->has_read_ios =3D true; - diskstat->read_ios =3D rd_ios; - diskstat->has_read_sectors =3D true; - diskstat->read_sectors =3D rd_merges_or_rd_sec; - diskstat->has_write_ios =3D true; - diskstat->write_ios =3D rd_sec_or_wr_ios; - diskstat->has_write_sectors =3D true; - diskstat->write_sectors =3D rd_ticks_or_wr_sec; - } - if (i >=3D 14) { - diskstat->has_read_ios =3D true; - diskstat->read_ios =3D rd_ios; - diskstat->has_read_sectors =3D true; - diskstat->read_sectors =3D rd_sec_or_wr_ios; - diskstat->has_read_merges =3D true; - diskstat->read_merges =3D rd_merges_or_rd_sec; - diskstat->has_read_ticks =3D true; - diskstat->read_ticks =3D rd_ticks_or_wr_sec; - diskstat->has_write_ios =3D true; - diskstat->write_ios =3D wr_ios; - diskstat->has_write_sectors =3D true; - diskstat->write_sectors =3D wr_sec; - diskstat->has_write_merges =3D true; - diskstat->write_merges =3D wr_merges; - diskstat->has_write_ticks =3D true; - diskstat->write_ticks =3D wr_ticks; - diskstat->has_ios_pgr =3D true; - diskstat->ios_pgr =3D ios_pgr; - diskstat->has_total_ticks =3D true; - diskstat->total_ticks =3D tot_ticks; - diskstat->has_weight_ticks =3D true; - diskstat->weight_ticks =3D rq_ticks; - } - if (i >=3D 18) { - diskstat->has_discard_ios =3D true; - diskstat->discard_ios =3D dc_ios; - diskstat->has_discard_merges =3D true; - diskstat->discard_merges =3D dc_merges; - diskstat->has_discard_sectors =3D true; - diskstat->discard_sectors =3D dc_sec; - diskstat->has_discard_ticks =3D true; - diskstat->discard_ticks =3D dc_ticks; - } - if (i >=3D 20) { - diskstat->has_flush_ios =3D true; - diskstat->flush_ios =3D fl_ios; - diskstat->has_flush_ticks =3D true; - diskstat->flush_ticks =3D fl_ticks; - } - - diskstatinfo->stats =3D g_steal_pointer(&diskstat); - QAPI_LIST_APPEND(tail, diskstatinfo); - diskstatinfo =3D NULL; - } - free(line); - fclose(fp); - return head; -#else - g_debug("disk stats reporting available only for Linux"); - return NULL; -#endif -} - -GuestDiskStatsInfoList *qmp_guest_get_diskstats(Error **errp) -{ - return guest_get_diskstats(errp); -} - -GuestCpuStatsList *qmp_guest_get_cpustats(Error **errp) -{ - GuestCpuStatsList *head =3D NULL, **tail =3D &head; - const char *cpustats =3D "/proc/stat"; - int clk_tck =3D sysconf(_SC_CLK_TCK); - FILE *fp; - size_t n; - char *line =3D NULL; - - fp =3D fopen(cpustats, "r"); - if (fp =3D=3D NULL) { - error_setg_errno(errp, errno, "open(\"%s\")", cpustats); - return NULL; - } - - while (getline(&line, &n, fp) !=3D -1) { - GuestCpuStats *cpustat =3D NULL; - GuestLinuxCpuStats *linuxcpustat; - int i; - unsigned long user, system, idle, iowait, irq, softirq, steal, gue= st; - unsigned long nice, guest_nice; - char name[64]; - - i =3D sscanf(line, "%s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu", - name, &user, &nice, &system, &idle, &iowait, &irq, &sof= tirq, - &steal, &guest, &guest_nice); - - /* drop "cpu 1 2 3 ...", get "cpuX 1 2 3 ..." only */ - if ((i =3D=3D EOF) || strncmp(name, "cpu", 3) || (name[3] =3D=3D '= \0')) { - continue; - } - - if (i < 5) { - slog("Parsing cpu stat from %s failed, see \"man proc\"", cpus= tats); - break; - } - - cpustat =3D g_new0(GuestCpuStats, 1); - cpustat->type =3D GUEST_CPU_STATS_TYPE_LINUX; - - linuxcpustat =3D &cpustat->u.q_linux; - linuxcpustat->cpu =3D atoi(&name[3]); - linuxcpustat->user =3D user * 1000 / clk_tck; - linuxcpustat->nice =3D nice * 1000 / clk_tck; - linuxcpustat->system =3D system * 1000 / clk_tck; - linuxcpustat->idle =3D idle * 1000 / clk_tck; - - if (i > 5) { - linuxcpustat->has_iowait =3D true; - linuxcpustat->iowait =3D iowait * 1000 / clk_tck; - } - - if (i > 6) { - linuxcpustat->has_irq =3D true; - linuxcpustat->irq =3D irq * 1000 / clk_tck; - linuxcpustat->has_softirq =3D true; - linuxcpustat->softirq =3D softirq * 1000 / clk_tck; - } - - if (i > 8) { - linuxcpustat->has_steal =3D true; - linuxcpustat->steal =3D steal * 1000 / clk_tck; - } - - if (i > 9) { - linuxcpustat->has_guest =3D true; - linuxcpustat->guest =3D guest * 1000 / clk_tck; - } - - if (i > 10) { - linuxcpustat->has_guest =3D true; - linuxcpustat->guest =3D guest * 1000 / clk_tck; - linuxcpustat->has_guestnice =3D true; - linuxcpustat->guestnice =3D guest_nice * 1000 / clk_tck; - } - - QAPI_LIST_APPEND(tail, cpustat); - } - - free(line); - fclose(fp); - return head; -} =20 #else /* defined(__linux__) */ =20 --=20 2.45.1