From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: vandersonmr <vandersonmr2@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v4 5/7] log: adding -d tb_stats to control tbstats
Date: Fri, 26 Jul 2019 17:20:36 +0100 [thread overview]
Message-ID: <87o91ghinf.fsf@linaro.org> (raw)
In-Reply-To: <20190720010235.32444-6-vandersonmr2@gmail.com>
vandersonmr <vandersonmr2@gmail.com> writes:
> Adding -d tb_stats:[limit:[all|jit|exec]] to control TBStatistics
> collection. "limit" is used to limit the number of TBStats in the
> linux-user dump. [all|jit|exec] control the profilling level used
> by the TBStats: all, only jit stats or only execution count stats.
>
> Signed-off-by: Vanderson M. do Rosario <vandersonmr2@gmail.com>
> ---
> include/qemu/log.h | 1 +
> util/log.c | 34 ++++++++++++++++++++++++++++++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/include/qemu/log.h b/include/qemu/log.h
> index 8cdfc268ca..93642603e5 100644
> --- a/include/qemu/log.h
> +++ b/include/qemu/log.h
> @@ -45,6 +45,7 @@ static inline bool qemu_log_separate(void)
> /* LOG_TRACE (1 << 15) is defined in log-for-trace.h */
> #define CPU_LOG_TB_OP_IND (1 << 16)
> #define CPU_LOG_TB_FPU (1 << 17)
> +#define CPU_LOG_TB_STATS (1 << 18)
>
> /* Lock output for a series of related logs. Since this is not needed
> * for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we
> diff --git a/util/log.c b/util/log.c
> index f81653d712..8109d19afb 100644
> --- a/util/log.c
> +++ b/util/log.c
> @@ -30,6 +30,7 @@ FILE *qemu_logfile;
> int qemu_loglevel;
> static int log_append = 0;
> static GArray *debug_regions;
> +int32_t max_num_hot_tbs_to_dump;
>
> /* Return the number of characters emitted. */
> int qemu_log(const char *fmt, ...)
> @@ -273,6 +274,8 @@ const QEMULogItem qemu_log_items[] = {
> { CPU_LOG_TB_NOCHAIN, "nochain",
> "do not chain compiled TBs so that \"exec\" and \"cpu\" show\n"
> "complete traces" },
> + { CPU_LOG_TB_STATS, "tb_stats[:limit:(all,jit,exec)]",
> + "show TBs statistics (until given a limit) ordered by their hotness.\n" },
> { 0, NULL, NULL },
> };
>
> @@ -294,6 +297,37 @@ int qemu_str_to_log_mask(const char *str)
> trace_enable_events((*tmp) + 6);
> mask |= LOG_TRACE;
> #endif
> + } else if (g_str_has_prefix(*tmp, "tb_stats")) {
> + if (g_str_has_prefix(*tmp, "tb_stats:") && (*tmp)[9] != '\0') {
> +
> + if (!g_ascii_isdigit(*((*tmp) + 9))) {
> + fprintf(stderr,
> + "should be a number follow by [all|jit|exec], as tb_stats:10:all\n");
> + exit(1);
> + }
> + /* get limit */
> + max_num_hot_tbs_to_dump = atoi((*tmp) + 9);
We probably want to handle -d tb_stats:[all|jit|exec] as well because we
might be doing interactive exploration for softmmu. I'd suggest
splitting the number processing off to a new patch and merging the exit
processing part of the later patches with it. As you don't have a HMP
for linux-user you can make the number required for linux-user or only
optional for softmmu.
> +
> + /* get profilling level */
> + char *s = (*tmp) + 9;
> + while (*s != '\0') {
> + if (*s++ == ':') {
> + break;
> + }
> + }
> + if (g_str_equal(s, "jit") == 0) {
> + set_default_tbstats_flag(TB_JIT_STATS);
> + } else if (g_str_equal(s, "exec") == 0) {
> + set_default_tbstats_flag(TB_EXEC_STATS);
> + } else {
> + set_default_tbstats_flag(TB_JIT_STATS | TB_EXEC_STATS);
> + }
If additional stats types get added we shall want to be additive:
-d host_tbs:jit,exec
> + } else {
> + set_default_tbstats_flag(TB_JIT_STATS | TB_EXEC_STATS);
> + }
> +
> + mask |= CPU_LOG_TB_STATS;
> + enable_collect_tb_stats();
> } else {
> for (item = qemu_log_items; item->mask != 0; item++) {
> if (g_str_equal(*tmp, item->name)) {
--
Alex Bennée
next prev parent reply other threads:[~2019-07-26 16:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-20 1:02 [Qemu-devel] [PATCH v4 0/7] Measure Tiny Code Generation Quality vandersonmr
2019-07-20 1:02 ` [Qemu-devel] [PATCH v4 1/7] accel: introducing TBStatistics structure vandersonmr
2019-07-26 11:56 ` Alex Bennée
2019-07-20 1:02 ` [Qemu-devel] [PATCH v4 2/7] accel: collecting TB execution count vandersonmr
2019-07-26 13:38 ` Alex Bennée
2019-07-20 1:02 ` [Qemu-devel] [PATCH v4 3/7] accel: collecting JIT statistics vandersonmr
2019-07-26 14:46 ` Alex Bennée
2019-07-20 1:02 ` [Qemu-devel] [PATCH v4 4/7] accel: replacing part of CONFIG_PROFILER with TBStats vandersonmr
2019-07-26 15:25 ` Alex Bennée
2019-07-20 1:02 ` [Qemu-devel] [PATCH v4 5/7] log: adding -d tb_stats to control tbstats vandersonmr
2019-07-26 16:20 ` Alex Bennée [this message]
2019-07-20 1:02 ` [Qemu-devel] [PATCH v4 6/7] monitor: adding tb_stats hmp command vandersonmr
2019-07-26 16:57 ` Alex Bennée
2019-07-20 1:02 ` [Qemu-devel] [PATCH v4 7/7] monitor: adding info tbs, tb, and coverset vandersonmr
2019-07-26 18:17 ` Alex Bennée
2019-07-29 11:01 ` Alex Bennée
2019-07-29 15:20 ` Alex Bennée
2019-07-26 12:51 ` [Qemu-devel] [PATCH v4 0/7] Measure Tiny Code Generation Quality Alex Bennée
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=87o91ghinf.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.