From nobody Wed Nov 5 14:27:34 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534873185954290.00834395450374; Tue, 21 Aug 2018 10:39:45 -0700 (PDT) Received: from localhost ([::1]:55129 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsAd6-0002vl-H2 for importer@patchew.org; Tue, 21 Aug 2018 13:39:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsA4n-0002II-S2 for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:04:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsA4W-0006oj-Fr for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:04:11 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:40649) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fsA4V-00067s-HC for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:03:59 -0400 Received: by mail-wm0-x229.google.com with SMTP id y9-v6so3497250wma.5 for ; Tue, 21 Aug 2018 10:03:32 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-184-244.clienti.tiscali.it. [78.12.184.244]) by smtp.gmail.com with ESMTPSA id v6-v6sm2608955wmc.43.2018.08.21.10.03.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Aug 2018 10:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=h6WS9z0kHssG/NkCgZ50dpTkDMH3lY2uw2EuPlq3yYA=; b=jjzJ45FfDNsU+lyCOkSSgzi8yDDtM1f8DTBAAa2lEaZDWSBL74XY7Xm8wtaX9gF5Dp AFzsQPuzNQfG34i9wqfbs2U+BbiK3Id3DgeowlrcHr2u5QIBZISjvbk1F9jzglY0lGMl cGc4cNozQ3WcLLv9w9JiovGH1QDpjAr6RzrAnQMlcrZTYwtQnZ8a1waXmVGZmJe61e0r Cg79TOvEoKnMaEKnTr/r+UqWb5t4GmsCw/MhOI1EVgT5EAsFxUACh1IjBnB+GZp9sdWl gthnjzVue9G/MIJXjJt/Jq3ZEb1CV07mxC6y/SS5XM+SyUUmw7OeP/w0jXgVb6nT0qj7 +6Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=h6WS9z0kHssG/NkCgZ50dpTkDMH3lY2uw2EuPlq3yYA=; b=knm8QW5Tgk1V3G7DS0gZvw9gAhdMhw0IgAJHR4bP4iH5/7eV1gXqWAdj6lfWOqO2X1 nYErsxwpuLjsCVZYTTKUBvVkl6cfxfpb6YABT6Y/YdpNmG6+LS9hVgmIxVAQ0SqWe82F rPny58MBzJW/IEjyFceOJlGHjrykNGgg8D/M/geCBKswOLzjpEhWqixQeYH3SG4P2PZ8 Ne6wF1Rpm+6NadRdifqkIJ2QTiWT1UYezB4v3oCSWUKNkcED66jhAUqlQEtwDeLQ+65P aLgp2NuI6Cj9wNmgFTe5sDqAJOokWJk3m/uo0wmmuoooXmHgbz4e8UPqRvVbWDN4c2rO wkIw== X-Gm-Message-State: APzg51A0SlulfgqVN/8hLNKzOab88lSWkC3YpQm0Ch/0vYPz/T56L0WQ PW52j3thaP+oZylvRUZJYTGKwClu X-Google-Smtp-Source: ANB0VdY17vnX/LasQISqn/TBoxYOMNPHo+DeoZjop9LuAO70J8VmyDxBVDBPI4gWEJ6hvEJOEjaMYA== X-Received: by 2002:a1c:e595:: with SMTP id c143-v6mr131725wmh.85.1534871011098; Tue, 21 Aug 2018 10:03:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 19:01:58 +0200 Message-Id: <1534870966-9287-27-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1534870966-9287-1-git-send-email-pbonzini@redhat.com> References: <1534870966-9287-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::229 Subject: [Qemu-devel] [PULL 26/74] hmp-commands-info: add sync-profile X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Emilio G. Cota" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" The command introduced here is just for developers. This means that: - the info displayed and the output format could change in the future - the command is only meant to be used from HMP, not from QMP Sample output: (qemu) sync-profile sync-profile is off (qemu) info sync-profile Type Object Call site Wait Time (s) Count Average = (us) ---------------------------------------------------------------------------= ---- ---------------------------------------------------------------------------= ---- (qemu) sync-profile on (qemu) sync-profile sync-profile is on (qemu) info sync-profile 15 Type Object Call site Wait Time (s) = Count Average (us) ---------------------------------------------------------------------------= ------------------- condvar 0x55a01813ced0 cpus.c:1165 91.38235 = 2842 32154.24 BQL mutex 0x55a0171b7140 cpus.c:1434 12.56490 = 5787 2171.23 BQL mutex 0x55a0171b7140 accel/tcg/cpu-exec.c:432 7.75846 = 2844 2728.01 BQL mutex 0x55a0171b7140 accel/tcg/cputlb.c:870 5.09889 = 2884 1767.99 BQL mutex 0x55a0171b7140 accel/tcg/cpu-exec.c:529 3.46140 = 3254 1063.74 BQL mutex 0x55a0171b7140 accel/tcg/cputlb.c:804 0.76333 = 8655 88.20 BQL mutex 0x55a0171b7140 cpus.c:1466 0.60893 = 2941 207.05 BQL mutex 0x55a0171b7140 util/main-loop.c:236 0.00894 = 6425 1.39 mutex [ 3] util/qemu-timer.c:520 0.00342 = 50611 0.07 mutex [ 2] util/qemu-timer.c:426 0.00254 = 31336 0.08 mutex [ 3] util/qemu-timer.c:234 0.00107 = 19275 0.06 mutex 0x55a0171d9960 vl.c:763 0.00043 = 6425 0.07 mutex 0x55a0180d1bb0 monitor.c:458 0.00015 = 1603 0.09 mutex 0x55a0180e4c78 chardev/char.c:109 0.00002 = 217 0.08 mutex 0x55a0180d1bb0 monitor.c:448 0.00001 = 162 0.08 ---------------------------------------------------------------------------= ------------------- (qemu) info sync-profile -m 15 Type Object Call site Wait Time (s) = Count Average (us) ---------------------------------------------------------------------------= ------------------- condvar 0x55a01813ced0 cpus.c:1165 95.11196 = 3051 31174.03 BQL mutex 0x55a0171b7140 accel/tcg/cpu-exec.c:432 7.92108 = 3052 2595.37 BQL mutex 0x55a0171b7140 cpus.c:1434 13.38253 = 6210 2155.00 BQL mutex 0x55a0171b7140 accel/tcg/cputlb.c:870 5.09901 = 3093 1648.57 BQL mutex 0x55a0171b7140 accel/tcg/cpu-exec.c:529 4.21123 = 3468 1214.31 BQL mutex 0x55a0171b7140 cpus.c:1466 0.60895 = 3156 192.95 BQL mutex 0x55a0171b7140 accel/tcg/cputlb.c:804 0.76337 = 9282 82.24 BQL mutex 0x55a0171b7140 util/main-loop.c:236 0.00944 = 6889 1.37 mutex 0x55a01813ce80 tcg/tcg.c:397 0.00000 = 24 0.15 mutex 0x55a0180d1bb0 monitor.c:458 0.00018 = 1922 0.09 mutex [ 2] util/qemu-timer.c:426 0.00266 = 32710 0.08 mutex 0x55a0180e4c78 chardev/char.c:109 0.00002 = 260 0.08 mutex 0x55a0180d1bb0 monitor.c:448 0.00001 = 187 0.08 mutex 0x55a0171d9960 vl.c:763 0.00047 = 6889 0.07 mutex [ 3] util/qemu-timer.c:520 0.00362 = 53377 0.07 ---------------------------------------------------------------------------= ------------------- (qemu) info sync-profile -m -n 15 Type Object Call site Wait Time (s) = Count Average (us) ---------------------------------------------------------------------------= ------------------- condvar 0x55a01813ced0 cpus.c:1165 101.39331 = 3398 29839.12 BQL mutex 0x55a0171b7140 accel/tcg/cpu-exec.c:432 7.92112 = 3399 2330.43 BQL mutex 0x55a0171b7140 cpus.c:1434 14.28280 = 6922 2063.39 BQL mutex 0x55a0171b7140 accel/tcg/cputlb.c:870 5.77505 = 3445 1676.36 BQL mutex 0x55a0171b7140 accel/tcg/cpu-exec.c:529 5.66139 = 3883 1457.99 BQL mutex 0x55a0171b7140 cpus.c:1466 0.60901 = 3519 173.06 BQL mutex 0x55a0171b7140 accel/tcg/cputlb.c:804 0.76351 = 10338 73.85 BQL mutex 0x55a0171b7140 util/main-loop.c:236 0.01032 = 7664 1.35 mutex 0x55a0180e4f08 util/qemu-timer.c:426 0.00041 = 901 0.45 mutex 0x55a01813ce80 tcg/tcg.c:397 0.00000 = 24 0.15 mutex 0x55a0180d1bb0 monitor.c:458 0.00022 = 2319 0.09 mutex 0x55a0180e4c78 chardev/char.c:109 0.00003 = 306 0.08 mutex 0x55a0180e4f08 util/qemu-timer.c:520 0.00068 = 8565 0.08 mutex 0x55a0180d1bb0 monitor.c:448 0.00002 = 215 0.08 mutex 0x55a0180e4f78 util/qemu-timer.c:426 0.00247 = 34224 0.07 ---------------------------------------------------------------------------= ------------------- (qemu) sync-profile reset (qemu) info sync-profile -m 2 Type Object Call site Wait Time (s) Co= unt Average (us) ---------------------------------------------------------------------------= ----------------- condvar 0x55a01813ced0 cpus.c:1165 2.78756 = 99 28157.12 BQL mutex 0x55a0171b7140 accel/tcg/cputlb.c:870 0.33054 = 102 3240.55 ---------------------------------------------------------------------------= ----------------- (qemu) sync-profile off (qemu) sync-profile sync-profile is off (qemu) sync-profile reset (qemu) info sync-profile Type Object Call site Wait Time (s) Count Average = (us) ---------------------------------------------------------------------------= ---- ---------------------------------------------------------------------------= ---- Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Emilio G. Cota Signed-off-by: Paolo Bonzini --- hmp-commands-info.hx | 22 ++++++++++++++++++++++ monitor.c | 11 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 70639f6..cbee8b9 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -300,6 +300,28 @@ Show dynamic compiler opcode counters ETEXI =20 { + .name =3D "sync-profile", + .args_type =3D "mean:-m,no_coalesce:-n,max:i?", + .params =3D "[-m] [-n] [max]", + .help =3D "show synchronization profiling info, up to max en= tries " + "(default: 10), sorted by total wait time. (-m: sort= by " + "mean wait time; -n: do not coalesce objects with th= e " + "same call site)", + .cmd =3D hmp_info_sync_profile, + }, + +STEXI +@item info sync-profile [-m|-n] [@var{max}] +@findex info sync-profile +Show synchronization profiling info, up to @var{max} entries (default: 10), +sorted by total wait time. + -m: sort by mean wait time + -n: do not coalesce objects with the same call site +When different objects that share the same call site are coalesced, the "O= bject" +field shows---enclosed in brackets---the number of objects being coalesced. +ETEXI + + { .name =3D "kvm", .args_type =3D "", .params =3D "", diff --git a/monitor.c b/monitor.c index a1999e3..94f6735 100644 --- a/monitor.c +++ b/monitor.c @@ -1454,6 +1454,17 @@ static void hmp_info_opcount(Monitor *mon, const QDi= ct *qdict) } #endif =20 +static void hmp_info_sync_profile(Monitor *mon, const QDict *qdict) +{ + int64_t max =3D qdict_get_try_int(qdict, "max", 10); + bool mean =3D qdict_get_try_bool(qdict, "mean", false); + bool coalesce =3D !qdict_get_try_bool(qdict, "no_coalesce", false); + enum QSPSortBy sort_by; + + sort_by =3D mean ? QSP_SORT_BY_AVG_WAIT_TIME : QSP_SORT_BY_TOTAL_WAIT_= TIME; + qsp_report((FILE *)mon, monitor_fprintf, max, sort_by, coalesce); +} + static void hmp_info_history(Monitor *mon, const QDict *qdict) { int i; --=20 1.8.3.1