From: Richard Henderson <richard.henderson@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
cota@braap.org,
"Vanderson M. do Rosario" <vandersonmr2@gmail.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v9 04/13] accel: replacing part of CONFIG_PROFILER with TBStats
Date: Tue, 8 Oct 2019 09:58:55 -0400 [thread overview]
Message-ID: <34e53812-eeac-ebda-656d-0d5735311178@linaro.org> (raw)
In-Reply-To: <20191007152839.30804-5-alex.bennee@linaro.org>
On 10/7/19 11:28 AM, Alex Bennée wrote:
> +struct jit_profile_info {
> + uint64_t translations;
> + uint64_t aborted;
> + uint64_t ops;
> + unsigned ops_max;
> + uint64_t del_ops;
> + uint64_t temps;
> + unsigned temps_max;
> + uint64_t host;
> + uint64_t guest;
> + uint64_t search_data;
> +};
Hmm. Maybe better to define a single structure that you can share between the
collection here and the storage in TCGProfile?
Also, "host" and "guest" are not helpful names...
> + jpi->host += tbs->code.out_len;
> + jpi->guest += tbs->code.in_len;
... code_int_len and code_out_len are helpful names.
> @@ -1807,6 +1805,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
> tb->tb_stats = NULL;
> }
>
> +
> tcg_func_start(tcg_ctx);
>
> tcg_ctx->cpu = env_cpu(env);
Watch the random whitespace.
> +#define stat_per_translation(stat, name) \
> + (stat->translations.total ? stat->name / stat->translations.total : 0)
Does this really need to go in the header?
> +static void collect_jit_profile_info(void *p, uint32_t hash, void *userp)
> +{
> + struct jit_profile_info *jpi = userp;
> + TBStatistics *tbs = p;
> +
> + jpi->translations += tbs->translations.total;
> + jpi->ops += tbs->code.num_tcg_ops;
> + if (stat_per_translation(tbs, code.num_tcg_ops) > jpi->ops_max) {
> + jpi->ops_max = stat_per_translation(tbs, code.num_tcg_ops);
> + }
> + jpi->del_ops += tbs->code.deleted_ops;
> + jpi->temps += tbs->code.temps;
> + if (stat_per_translation(tbs, code.temps) > jpi->temps_max) {
> + jpi->temps_max = stat_per_translation(tbs, code.temps);
> + }
> + jpi->host += tbs->code.out_len;
> + jpi->guest += tbs->code.in_len;
> + jpi->search_data += tbs->code.search_out_len;
> +}
E.g.
unsigned long total = tbs->translations.total;
if (total) {
unsigned tmp;
tmp = tbs->code.num_tcg_ops / total;
jpi->ops_max = MAX(jpi->ops_max, tmp);
tmp = tbs->code.temps / total;
jpi->temps_max = MAX(jpi->temps_max, tmp);
}
It does occur to me to wonder why code.num_guest_inst etc are "unsigned" while
translations.total are "unsigned long", given that they are both accumulations
over many TBs.
r~
next prev parent reply other threads:[~2019-10-08 14:12 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 [this message]
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
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=34e53812-eeac-ebda-656d-0d5735311178@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=cota@braap.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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).