adding the option to start collecting the tb statistics later using the start_stats command.
Signed-off-by: vandersonmr <vanderson...@gmail.com> --- hmp-commands.hx | 15 +++++++++++++++ monitor/misc.c | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index bfa5681dd2..616b9f7388 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1885,6 +1885,21 @@ STEXI @findex qemu-io Executes a qemu-io command on the given block device. +ETEXI + + { + .name = "start_stats", + .args_type = "", + .params = "", + .help = "(re)start recording tb statistics", + .cmd = hmp_tbstats_start, + }, + +STEXI +@item start_stats +@findex +(Re)start recording tb statistics + ETEXI { diff --git a/monitor/misc.c b/monitor/misc.c index 1fb4d75871..d39a048fd7 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -469,6 +469,21 @@ static void hmp_info_jit(Monitor *mon, const QDict *qdict) dump_drift_info(); } +static void hmp_tbstats_start(Monitor *mon, const QDict *qdict) +{ + if (!tcg_enabled()) { + error_report("TB information is only available with accel=tcg"); + return; + } + if (qemu_loglevel_mask(CPU_LOG_HOT_TBS)) { + error_report("TB information already being recorded"); + return; + } + qht_init(&tb_ctx.tb_stats, tb_stats_cmp, CODE_GEN_HTABLE_SIZE, + QHT_MODE_AUTO_RESIZE); + qemu_set_log(qemu_loglevel | CPU_LOG_HOT_TBS); +} + static void hmp_info_tbs(Monitor *mon, const QDict *qdict) { int n; -- 2.22.0