qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v9 06/13] debug: add -d tb_stats to control TBStatistics coll


From: Alex Bennée
Subject: Re: [PATCH v9 06/13] debug: add -d tb_stats to control TBStatistics collection:
Date: Tue, 08 Oct 2019 16:49:21 +0100
User-agent: mu4e 1.3.5; emacs 27.0.50

Richard Henderson <address@hidden> writes:

> On 10/7/19 11:28 AM, Alex Bennée wrote:
>> From: "Vanderson M. do Rosario" <address@hidden>
>>
>>  -d tb_stats[[,level=(+all+jit+exec+time)][,dump_limit=<number>]]
>>
>> "dump_limit" is used to limit the number of dumped TBStats in
>> linux-user mode.
>>
>> [all+jit+exec+time] control the profilling level used
>> by the TBStats. Can be used as follow:
>>
>> -d tb_stats
>> -d tb_stats,level=jit+time
>> -d tb_stats,dump_limit=15
>> ...
>>
>> Signed-off-by: Vanderson M. do Rosario <address@hidden>
>> Message-Id: <address@hidden>
>> [AJB: fix authorship, reword title]
>> Signed-off-by: Alex Bennée <address@hidden>
>>
>> ---
>> AJB:
>>   - reword title
>>   - add stubs for enabling
>>   - move things across to tb-stats-flags.h
>> ---
>>  accel/tcg/tb-stats.c          |  5 +++++
>>  include/exec/gen-icount.h     |  1 +
>>  include/exec/tb-stats-flags.h | 29 +++++++++++++++++++++++++++++
>>  include/exec/tb-stats.h       | 16 +++-------------
>>  include/qemu/log.h            |  1 +
>>  stubs/Makefile.objs           |  1 +
>>  stubs/tb-stats.c              | 27 +++++++++++++++++++++++++++
>>  util/log.c                    | 35 +++++++++++++++++++++++++++++++++++
>>  8 files changed, 102 insertions(+), 13 deletions(-)
>>  create mode 100644 include/exec/tb-stats-flags.h
>>  create mode 100644 stubs/tb-stats.c
>>
>> diff --git a/accel/tcg/tb-stats.c b/accel/tcg/tb-stats.c
>> index f431159fd2..1c66e03979 100644
>> --- a/accel/tcg/tb-stats.c
>> +++ b/accel/tcg/tb-stats.c
>> @@ -193,3 +193,8 @@ uint32_t get_default_tbstats_flag(void)
>>  {
>>      return default_tbstats_flag;
>>  }
>> +
>> +void set_default_tbstats_flag(uint32_t flags)
>> +{
>> +    default_tbstats_flag = flags;
>> +}
>> diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h
>> index be006383b9..3987adfb0e 100644
>> --- a/include/exec/gen-icount.h
>> +++ b/include/exec/gen-icount.h
>> @@ -2,6 +2,7 @@
>>  #define GEN_ICOUNT_H
>>
>>  #include "qemu/timer.h"
>> +#include "tb-stats-flags.h"
>>
>>  /* Helpers for instruction counting code generation.  */
>>
>> diff --git a/include/exec/tb-stats-flags.h b/include/exec/tb-stats-flags.h
>> new file mode 100644
>> index 0000000000..8455073048
>> --- /dev/null
>> +++ b/include/exec/tb-stats-flags.h
>> @@ -0,0 +1,29 @@
>> +/*
>> + * QEMU System Emulator, Code Quality Monitor System
>> + *
>> + * We define the flags and control bits here to avoid complications of
>> + * including TCG/CPU information in common code.
>> + *
>> + * Copyright (c) 2019 Vanderson M. do Rosario <address@hidden>
>> + *
>> + * SPDX-License-Identifier: GPL-2.0-or-later
>> + */
>> +#ifndef TB_STATS_FLAGS
>> +#define TB_STATS_FLAGS
>> +
>> +#define TB_NOTHING    (1 << 0)
>
> Repeating my question about TB_NOTHING -- what is it?
>
>> +#define TB_EXEC_STATS (1 << 1)
>> +#define TB_JIT_STATS  (1 << 2)
>> +#define TB_JIT_TIME   (1 << 3)
>> +
>> +/* TBStatistic collection controls */
>> +void enable_collect_tb_stats(void);
>> +void disable_collect_tb_stats(void);
>> +void pause_collect_tb_stats(void);
>> +bool tb_stats_collection_enabled(void);
>> +bool tb_stats_collection_paused(void);
>> +
>> +uint32_t get_default_tbstats_flag(void);
>> +void set_default_tbstats_flag(uint32_t);
>
> Is a get/set really better than an exported variable?

It makes things easier for log.c which is used for multiple binaries
although I never actually used empty inlines instead having stubs. I'll
have to check if the tools define CONFIG_TCG anyway.

>
> Should we have created this header in the first place,
> rather than moving stuff here in patch 6?

Yes. I'll move it.

>
> Surely TB_ALL_STATS?
>
>> +                } else if (g_str_equal(*level_tmp, "all")) {
>> +                    flags |= TB_JIT_STATS | TB_EXEC_STATS | TB_JIT_TIME;
>
> Likewise.
>
>
> r~

Thanks,

--
Alex Bennée



reply via email to

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