qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	cota@braap.org,
	"Vanderson M. do Rosario" <vandersonmr2@gmail.com>,
	qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v9 06/13] debug: add -d tb_stats to control TBStatistics collection:
Date: Tue, 08 Oct 2019 16:49:21 +0100	[thread overview]
Message-ID: <87imozi6f2.fsf@linaro.org> (raw)
In-Reply-To: <174fe11d-e3f5-011b-0beb-b3c237d0d9e6@linaro.org>


Richard Henderson <richard.henderson@linaro.org> writes:

> On 10/7/19 11:28 AM, Alex Bennée wrote:
>> From: "Vanderson M. do Rosario" <vandersonmr2@gmail.com>
>>
>>  -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 <vandersonmr2@gmail.com>
>> Message-Id: <20190829173437.5926-7-vandersonmr2@gmail.com>
>> [AJB: fix authorship, reword title]
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>
>> ---
>> 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 <vandersonmr2@gmail.com>
>> + *
>> + * 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	other threads:[~2019-10-08 15:50 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 15:28 [PATCH v9 00/13] TCG code quality tracking and perf integration Alex Bennée
2019-10-07 15:28 ` [PATCH v9 01/13] accel/tcg: introduce TBStatistics structure Alex Bennée
2019-10-08 12:35   ` Richard Henderson
2019-12-13 11:14     ` Alex Bennée
2019-10-07 15:28 ` [PATCH v9 02/13] accel: collecting TB execution count Alex Bennée
2019-10-08 13:10   ` Richard Henderson
2019-10-07 15:28 ` [PATCH v9 03/13] accel: collecting JIT statistics Alex Bennée
2019-10-08 13:38   ` Richard Henderson
2019-12-13 11:51     ` Alex Bennée
2019-10-07 15:28 ` [PATCH v9 04/13] accel: replacing part of CONFIG_PROFILER with TBStats Alex Bennée
2019-10-08 13:58   ` Richard Henderson
2019-10-07 15:28 ` [PATCH v9 05/13] accel: adding TB_JIT_TIME and full replacing CONFIG_PROFILER Alex Bennée
2019-10-08 15:25   ` Richard Henderson
2019-12-13 21:49     ` Alex Bennée
2019-12-16 20:34       ` Richard Henderson
2019-10-07 15:28 ` [PATCH v9 06/13] debug: add -d tb_stats to control TBStatistics collection: Alex Bennée
2019-10-08 15:34   ` Richard Henderson
2019-10-08 15:49     ` Alex Bennée [this message]
2019-10-07 15:28 ` [PATCH v9 07/13] monitor: adding tb_stats hmp command Alex Bennée
2019-10-08 15:48   ` Richard Henderson
2019-10-07 15:28 ` [PATCH v9 08/13] tb-stats: reset the tracked TBs on a tb_flush Alex Bennée
2019-10-08 18:00   ` Richard Henderson
2019-10-08 19:18     ` Alex Bennée
2019-10-07 15:28 ` [PATCH v9 09/13] Adding info [tb-list|tb] commands to HMP (WIP) Alex Bennée
2019-10-08 18:50   ` Richard Henderson
2019-10-08 19:36     ` Alex Bennée
2019-10-09  9:44   ` Dr. David Alan Gilbert
2019-10-07 15:28 ` [PATCH v9 10/13] tb-stats: dump hot TBs at the end of the execution Alex Bennée
2019-10-08 19:05   ` Richard Henderson
2019-10-07 15:28 ` [PATCH v9 11/13] accel/tcg: adding integration with linux perf Alex Bennée
2019-10-08 19:33   ` Richard Henderson
2019-10-07 15:28 ` [PATCH v9 12/13] tb-stats: adding TBStatistics info into perf dump Alex Bennée
2019-10-08 19:46   ` Richard Henderson
2019-10-07 15:28 ` [PATCH v9 13/13] configure: remove the final bits of --profiler support Alex Bennée
2019-10-08 19:39   ` Richard Henderson
2019-10-07 18:14 ` [PATCH v9 00/13] TCG code quality tracking and perf integration no-reply
2019-10-07 18:47 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imozi6f2.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=cota@braap.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=rth@twiddle.net \
    --cc=vandersonmr2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).