aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hmp-commands-info.hx22
-rw-r--r--monitor.c11
2 files changed, 33 insertions, 0 deletions
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 70639f656a..cbee8b944d 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -300,6 +300,28 @@ Show dynamic compiler opcode counters
ETEXI
{
+ .name = "sync-profile",
+ .args_type = "mean:-m,no_coalesce:-n,max:i?",
+ .params = "[-m] [-n] [max]",
+ .help = "show synchronization profiling info, up to 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)",
+ .cmd = 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 "Object"
+field shows---enclosed in brackets---the number of objects being coalesced.
+ETEXI
+
+ {
.name = "kvm",
.args_type = "",
.params = "",
diff --git a/monitor.c b/monitor.c
index a1999e396c..94f673511b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1454,6 +1454,17 @@ static void hmp_info_opcount(Monitor *mon, const QDict *qdict)
}
#endif
+static void hmp_info_sync_profile(Monitor *mon, const QDict *qdict)
+{
+ int64_t max = qdict_get_try_int(qdict, "max", 10);
+ bool mean = qdict_get_try_bool(qdict, "mean", false);
+ bool coalesce = !qdict_get_try_bool(qdict, "no_coalesce", false);
+ enum QSPSortBy sort_by;
+
+ sort_by = 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;