Message ID | 20190702210017.4275-6-vandersonmr2@gmail.com |
---|---|
State | New |
Headers | show |
Series | None | expand |
vandersonmr <vandersonmr2@gmail.com> writes: > adding the option to start collecting the tb > statistics later using the start_stats command. > > Signed-off-by: vandersonmr <vandersonmr2@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", Maybe tb_stats? with an inferred "start" or a "reset" option? And then an extensible set of options to expand what we record. > + .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; > + } As mentioned before lets have an internal flags for this. > + 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); I suspect we want to safe work this so we can a) flush existing tb stats for a reset and b) ensure we do a tb_flush() when we enable stats (otherwise we won't collect anything). > +} > + > static void hmp_info_tbs(Monitor *mon, const QDict *qdict) > { > int n; -- Alex Bennée
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;
adding the option to start collecting the tb statistics later using the start_stats command. Signed-off-by: vandersonmr <vandersonmr2@gmail.com> --- hmp-commands.hx | 15 +++++++++++++++ monitor/misc.c | 15 +++++++++++++++ 2 files changed, 30 insertions(+)