qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 6/6] monitor: adding start_stats to monitor


From: Alex Bennée
Subject: Re: [Qemu-devel] [PATCH v3 6/6] monitor: adding start_stats to monitor
Date: Thu, 04 Jul 2019 17:43:10 +0100
User-agent: mu4e 1.3.2; emacs 26.1

vandersonmr <address@hidden> writes:

> adding the option to start collecting the tb
> statistics later using the start_stats command.
>
> Signed-off-by: vandersonmr <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]