From patchwork Mon Oct 7 15:28:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 175349 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4444787ill; Mon, 7 Oct 2019 08:38:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjo7HEjL2ns+soYASJwQZesz5pbgECIcgTKaLYCZx2wBIS+S1J7UCJ244Y2X7PWyMknVVI X-Received: by 2002:a50:eb93:: with SMTP id y19mr29388877edr.94.1570462687000; Mon, 07 Oct 2019 08:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570462686; cv=none; d=google.com; s=arc-20160816; b=marJZlSE0AoItHbB4co0LNowg8JxsjZo48ALQ728fwm7st1PSApB/PWNn09mxxd/TA qJj6+PX3VJsrPliD9Bv2Ps9QsoaBB21orf2L5nnav237zrPZr5eSxvqMbZwIRZpUApvD Pf/LhjbQTjfkwfP1XiuiTonaSkAfokadtcFV8hrEAb6y3vezHGPwr/ADwymaN1CFTxF7 4NuvSQGTlXsSQr/fmoZvlRKcdq0WfP2EVDaE/RjeWqXRbD5ug/uuapfDt9JTBwZGedtq ciYv7ycnLXsQqroutO8XD7XmSXLUlPhjTol2zYltxzDceM66CeyZ/g1kXEz3KzHyXH1Q pCTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=WKb/0Q1Y5QzQgdMwznbijSAIlWY98BZFsAtX/2aCdlc=; b=si7d0ujk2RRcacy8KoibMgy/MmLmJY4341kuVLPKsTqH2UmljLv8kjMXOJaJ80cFPO EtY3ZAfYbShufl+NW/22Oo23/AdU3ArDlnyzQUfpAbSKL/LCWWLAy4wt6Pv1pxR7ASaj BglA1sKq1LsGAN2w9RK3D+6hnsnZ4vjpi66umrV0hj0kgE1E7PHRkCVhzNum49PZ2X3j oF3H8e4hKpIJpQ7xoWhuP7jG+PV1KaDyOv2Aq5P4PncxvS3DBQ0v3YpBW4ShLqSnrKsy JQpZhA5GOJ2ArZvi6YTrlhD07rENXVvQwoaeydmpEeDN4TXXVw8cCxFWEo2uZDsVfSl5 a63A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XvqgXoNY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 90si10288139edj.72.2019.10.07.08.38.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Oct 2019 08:38:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XvqgXoNY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHV5J-0000CE-1s for patch@linaro.org; Mon, 07 Oct 2019 11:38:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48890) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHUwK-0002a1-AC for qemu-devel@nongnu.org; Mon, 07 Oct 2019 11:28:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHUwH-00059r-EL for qemu-devel@nongnu.org; Mon, 07 Oct 2019 11:28:48 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:34719) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iHUwH-00059F-5z for qemu-devel@nongnu.org; Mon, 07 Oct 2019 11:28:45 -0400 Received: by mail-wr1-x441.google.com with SMTP id j11so10060489wrp.1 for ; Mon, 07 Oct 2019 08:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WKb/0Q1Y5QzQgdMwznbijSAIlWY98BZFsAtX/2aCdlc=; b=XvqgXoNYo+0uQDsuX9JYCGjh7Jvz9u9WK3VWwNqjE+ZDkNT0Aol2a8e/Morlr/Uexw lMIT2wKY1RCGFOe8uwBhAWFJUjAGLucx0/DxRguGo+dcqXjn6SbtZMNOw9ihZ3wQY+hO /58GRpv6TVcisMVxJ7aSyFoQc4zAWM4eYJBChk1FYsoE4jPX39xFpMrS2AmtSHbNNVvU f/GOWADAbWvWcFTCcHQh8ZsxXdJ5izp5jmJJ3/6LukFyr8gFbqULa4nISikfLYDrLt6c n8u0sMuzIy9vwX3Xos0Sc8lYZhNjPFq+MqwVDOXmZIOLHf60t3/Q1sTj8D1FlpJC7Ozd 4/hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WKb/0Q1Y5QzQgdMwznbijSAIlWY98BZFsAtX/2aCdlc=; b=OZA9lgB1xNDpqw8FPNz3F/ThaCYCYIayrwzb0B8msnfiDOOE36VE/S4fcIzplATbpr ZLhiiJ1wB6L3Qdt+D7KoJk6r871TVFVrEfN4+U4O3iuRBC7/mIDKMbXoNRHN2cSrnqmL gMNjGKq6rchLQ8gdH8NHmbT14nbJ8WMI4yfdcqjNuV3XSA+8mxsoDpA9bYzemPLKzKJh 38VySwmWqj0IMUzMRMh8Tvzt3GEq52ZKi4Re20xZsb9JjZRpKXtAUIhvH/09xo3WMKCD a2CSuScf2Ta1o+4E7LyASz3IcrxkMPJCZj+oDXikiT3aMCaQ5CO3iSs7ybmh7JskjSya pFsw== X-Gm-Message-State: APjAAAWPVEk546Jnm7HvDNvzuEjRVj0ITYXwSWGgWSJZLnGQ3k+Rm5Ka 7eZSyUlopgK1cBztUc6AwK6SZQ== X-Received: by 2002:adf:ecc6:: with SMTP id s6mr17854287wro.174.1570462123881; Mon, 07 Oct 2019 08:28:43 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f143sm31722083wme.40.2019.10.07.08.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 08:28:42 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 9BE9B1FF91; Mon, 7 Oct 2019 16:28:39 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v9 04/13] accel: replacing part of CONFIG_PROFILER with TBStats Date: Mon, 7 Oct 2019 16:28:30 +0100 Message-Id: <20191007152839.30804-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191007152839.30804-1-alex.bennee@linaro.org> References: <20191007152839.30804-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , cota@braap.org, "Vanderson M. do Rosario" , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Vanderson M. do Rosario" We add some of the statistics collected in the TCGProfiler into the TBStats, having the statistics not only for the whole emulation but for each TB. Then, we removed these stats from TCGProfiler and reconstruct the information for the "info jit" using the sum of all TBStats statistics. The goal is to have one unique and better way of collecting emulation statistics. Moreover, checking dynamiclly if the profiling is enabled showed to have an insignificant impact on the performance: https://wiki.qemu.org/Internships/ProjectIdeas/TCGCodeQuality#Overheads. Reviewed-by: Alex Bennée Signed-off-by: Vanderson M. do Rosario Message-Id: <20190829173437.5926-5-vandersonmr2@gmail.com> [AJB: fix authorship, use prof structure] Signed-off-by: Alex Bennée --- AJB: - moving profiler stuff under jit_stats lock - keep TCGProf as per-ctx staging post for values - delete max counters as can be interfered. --- accel/tcg/tb-stats.c | 95 ++++++++++++++++++++++++++++++++++ accel/tcg/translate-all.c | 11 ++-- include/exec/tb-stats.h | 11 ++++ tcg/tcg.c | 105 ++++---------------------------------- tcg/tcg.h | 9 ++-- 5 files changed, 125 insertions(+), 106 deletions(-) -- 2.20.1 diff --git a/accel/tcg/tb-stats.c b/accel/tcg/tb-stats.c index ee0506bff1..0e64c176b3 100644 --- a/accel/tcg/tb-stats.c +++ b/accel/tcg/tb-stats.c @@ -9,6 +9,10 @@ #include "qemu/osdep.h" #include "disas/disas.h" +#include "exec/exec-all.h" +#include "tcg.h" + +#include "qemu/qemu-print.h" #include "exec/tb-stats.h" @@ -18,6 +22,97 @@ enum TBStatsStatus { TB_STATS_RUNNING, TB_STATS_PAUSED, TB_STATS_STOPPED }; static enum TBStatsStatus tcg_collect_tb_stats; static uint32_t default_tbstats_flag; +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; +}; + +/* accumulate the statistics from all TBs */ +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; +} + +/* dump JIT statisticis using TCGProfile and TBStats */ +void dump_jit_profile_info(TCGProfile *s) +{ + if (!tb_stats_collection_enabled()) { + return; + } + + struct jit_profile_info *jpi = g_new0(struct jit_profile_info, 1); + + qht_iter(&tb_ctx.tb_stats, collect_jit_profile_info, jpi); + + if (jpi->translations) { + qemu_printf("translated TBs %" PRId64 "\n", jpi->translations); + qemu_printf("avg ops/TB %0.1f max=%d\n", + jpi->ops / (double) jpi->translations, jpi->ops_max); + qemu_printf("deleted ops/TB %0.2f\n", + jpi->del_ops / (double) jpi->translations); + qemu_printf("avg temps/TB %0.2f max=%d\n", + jpi->temps / (double) jpi->translations, jpi->temps_max); + qemu_printf("avg host code/TB %0.1f\n", + jpi->host / (double) jpi->translations); + qemu_printf("avg search data/TB %0.1f\n", + jpi->search_data / (double) jpi->translations); + + if (s) { + int64_t tot = s->interm_time + s->code_time; + qemu_printf("JIT cycles %" PRId64 " (%0.3f s at 2.4 GHz)\n", + tot, tot / 2.4e9); + qemu_printf("cycles/op %0.1f\n", + jpi->ops ? (double)tot / jpi->ops : 0); + qemu_printf("cycles/in byte %0.1f\n", + jpi->guest ? (double)tot / jpi->guest : 0); + qemu_printf("cycles/out byte %0.1f\n", + jpi->host ? (double)tot / jpi->host : 0); + qemu_printf("cycles/search byte %0.1f\n", + jpi->search_data ? (double)tot / jpi->search_data : 0); + if (tot == 0) { + tot = 1; + } + qemu_printf(" gen_interm time %0.1f%%\n", + (double)s->interm_time / tot * 100.0); + qemu_printf(" gen_code time %0.1f%%\n", + (double)s->code_time / tot * 100.0); + qemu_printf("optim./code time %0.1f%%\n", + (double)s->opt_time / (s->code_time ? s->code_time : 1) + * 100.0); + qemu_printf("liveness/code time %0.1f%%\n", + (double)s->la_time / (s->code_time ? s->code_time : 1) * 100.0); + qemu_printf("cpu_restore count %" PRId64 "\n", + s->restore_count); + qemu_printf(" avg cycles %0.1f\n", + s->restore_count ? (double)s->restore_time / s->restore_count : 0); + } + } + g_free(jpi); +} + void init_tb_stats_htable_if_not(void) { if (tb_stats_collection_enabled() && !tb_ctx.tb_stats.map) { diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 6fa9850a3a..84f759a829 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1780,8 +1780,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb_overflow: #ifdef CONFIG_PROFILER - /* includes aborted translations because of exceptions */ - atomic_set(&prof->tb_count1, prof->tb_count1 + 1); ti = profile_getclock(); #endif @@ -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); @@ -1828,7 +1827,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, } #ifdef CONFIG_PROFILER - atomic_set(&prof->tb_count, prof->tb_count + 1); atomic_set(&prof->interm_time, prof->interm_time + profile_getclock() - ti); ti = profile_getclock(); #endif @@ -1875,9 +1873,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, #ifdef CONFIG_PROFILER atomic_set(&prof->code_time, prof->code_time + profile_getclock() - ti); - atomic_set(&prof->code_in_len, prof->code_in_len + tb->size); - atomic_set(&prof->code_out_len, prof->code_out_len + gen_code_size); - atomic_set(&prof->search_out_len, prof->search_out_len + search_size); #endif #ifdef DEBUG_DISAS @@ -1951,7 +1946,11 @@ TranslationBlock *tb_gen_code(CPUState *cpu, ts->code.num_tcg_ops += prof->translation.nb_ops_pre_opt; ts->code.num_tcg_ops_opt += tcg_ctx->nb_ops; ts->code.spills += prof->translation.nb_spills; + ts->code.temps += prof->translation.temp_count; + ts->code.deleted_ops += prof->translation.del_op_count; + ts->code.in_len += tb->size; ts->code.out_len += tb->tc.size; + ts->code.search_out_len += search_size; ts->translations.total++; if (phys_page2 != -1) { diff --git a/include/exec/tb-stats.h b/include/exec/tb-stats.h index 566ae0d2be..c779d6a183 100644 --- a/include/exec/tb-stats.h +++ b/include/exec/tb-stats.h @@ -33,6 +33,9 @@ #define tb_stats_enabled(tb, JIT_STATS) \ (tb && tb->tb_stats && (tb->tb_stats->stats_enabled & JIT_STATS)) +#define stat_per_translation(stat, name) \ + (stat->translations.total ? stat->name / stat->translations.total : 0) + typedef struct TBStatistics TBStatistics; /* @@ -67,7 +70,13 @@ struct TBStatistics { unsigned num_tcg_ops; unsigned num_tcg_ops_opt; unsigned spills; + + /* CONFIG_PROFILE */ + unsigned temps; + unsigned deleted_ops; + unsigned in_len; unsigned out_len; + unsigned search_out_len; } code; struct { @@ -87,6 +96,8 @@ bool tb_stats_cmp(const void *ap, const void *bp); void init_tb_stats_htable_if_not(void); +void dump_jit_profile_info(TCGProfile *s); + #define TB_NOTHING (1 << 0) #define TB_EXEC_STATS (1 << 1) #define TB_JIT_STATS (1 << 2) diff --git a/tcg/tcg.c b/tcg/tcg.c index fa2fef9f1a..9c199c8a40 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1118,6 +1118,8 @@ void tcg_func_start(TCGContext *s) s->current_frame_offset = s->frame_start; s->prof.translation.nb_spills = 0; + s->prof.translation.del_op_count = 0; + s->prof.translation.temp_count = 0; #ifdef CONFIG_DEBUG_TCG s->goto_tb_issue_mask = 0; #endif @@ -2294,10 +2296,8 @@ void tcg_op_remove(TCGContext *s, TCGOp *op) QTAILQ_REMOVE(&s->ops, op, link); QTAILQ_INSERT_TAIL(&s->free_ops, op, link); s->nb_ops--; - -#ifdef CONFIG_PROFILER - atomic_set(&s->prof.del_op_count, s->prof.del_op_count + 1); -#endif + /* ? won't this end up op_opt - op = del_op_count ? */ + s->prof.translation.del_op_count++; } static TCGOp *tcg_op_alloc(TCGOpcode opc) @@ -3910,16 +3910,6 @@ void tcg_profile_snapshot(TCGProfile *prof, bool counters, bool table) if (counters) { PROF_ADD(prof, orig, cpu_exec_time); - PROF_ADD(prof, orig, tb_count1); - PROF_ADD(prof, orig, tb_count); - PROF_ADD(prof, orig, op_count); - PROF_MAX(prof, orig, op_count_max); - PROF_ADD(prof, orig, temp_count); - PROF_MAX(prof, orig, temp_count_max); - PROF_ADD(prof, orig, del_op_count); - PROF_ADD(prof, orig, code_in_len); - PROF_ADD(prof, orig, code_out_len); - PROF_ADD(prof, orig, search_out_len); PROF_ADD(prof, orig, interm_time); PROF_ADD(prof, orig, code_time); PROF_ADD(prof, orig, la_time); @@ -3997,26 +3987,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) TCGOp *op; s->current_tb = tb; - -#ifdef CONFIG_PROFILER - { - int n = 0; - - QTAILQ_FOREACH(op, &s->ops, link) { - n++; - } - atomic_set(&prof->op_count, prof->op_count + n); - if (n > prof->op_count_max) { - atomic_set(&prof->op_count_max, n); - } - - n = s->nb_temps; - atomic_set(&prof->temp_count, prof->temp_count + n); - if (n > prof->temp_count_max) { - atomic_set(&prof->temp_count_max, n); - } - } -#endif + /* save pre-optimisation op count */ + prof->translation.nb_ops_pre_opt = s->nb_ops; + prof->translation.temp_count = s->nb_temps; #ifdef DEBUG_DISAS if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP) @@ -4029,8 +4002,6 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) } #endif - /* save pre-optimisation op count */ - prof->translation.nb_ops_pre_opt = s->nb_ops; #ifdef CONFIG_DEBUG_TCG /* Ensure all labels referenced have been emitted. */ @@ -4210,70 +4181,16 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) return tcg_current_code_size(s); } -#ifdef CONFIG_PROFILER void tcg_dump_info(void) { + TCGProfile *s = NULL; +#ifdef CONFIG_PROFILER TCGProfile prof = {}; - const TCGProfile *s; - int64_t tb_count; - int64_t tb_div_count; - int64_t tot; - tcg_profile_snapshot_counters(&prof); s = &prof; - tb_count = s->tb_count; - tb_div_count = tb_count ? tb_count : 1; - tot = s->interm_time + s->code_time; - - qemu_printf("JIT cycles %" PRId64 " (%0.3f s at 2.4 GHz)\n", - tot, tot / 2.4e9); - qemu_printf("translated TBs %" PRId64 " (aborted=%" PRId64 - " %0.1f%%)\n", - tb_count, s->tb_count1 - tb_count, - (double)(s->tb_count1 - s->tb_count) - / (s->tb_count1 ? s->tb_count1 : 1) * 100.0); - qemu_printf("avg ops/TB %0.1f max=%d\n", - (double)s->op_count / tb_div_count, s->op_count_max); - qemu_printf("deleted ops/TB %0.2f\n", - (double)s->del_op_count / tb_div_count); - qemu_printf("avg temps/TB %0.2f max=%d\n", - (double)s->temp_count / tb_div_count, s->temp_count_max); - qemu_printf("avg host code/TB %0.1f\n", - (double)s->code_out_len / tb_div_count); - qemu_printf("avg search data/TB %0.1f\n", - (double)s->search_out_len / tb_div_count); - - qemu_printf("cycles/op %0.1f\n", - s->op_count ? (double)tot / s->op_count : 0); - qemu_printf("cycles/in byte %0.1f\n", - s->code_in_len ? (double)tot / s->code_in_len : 0); - qemu_printf("cycles/out byte %0.1f\n", - s->code_out_len ? (double)tot / s->code_out_len : 0); - qemu_printf("cycles/search byte %0.1f\n", - s->search_out_len ? (double)tot / s->search_out_len : 0); - if (tot == 0) { - tot = 1; - } - qemu_printf(" gen_interm time %0.1f%%\n", - (double)s->interm_time / tot * 100.0); - qemu_printf(" gen_code time %0.1f%%\n", - (double)s->code_time / tot * 100.0); - qemu_printf("optim./code time %0.1f%%\n", - (double)s->opt_time / (s->code_time ? s->code_time : 1) - * 100.0); - qemu_printf("liveness/code time %0.1f%%\n", - (double)s->la_time / (s->code_time ? s->code_time : 1) * 100.0); - qemu_printf("cpu_restore count %" PRId64 "\n", - s->restore_count); - qemu_printf(" avg cycles %0.1f\n", - s->restore_count ? (double)s->restore_time / s->restore_count : 0); -} -#else -void tcg_dump_info(void) -{ - qemu_printf("[TCG profiler not compiled]\n"); -} #endif + dump_jit_profile_info(s); +} #ifdef ELF_HOST_MACHINE /* In order to use this feature, the backend needs to do three things: diff --git a/tcg/tcg.h b/tcg/tcg.h index 31571289cf..5296f7c075 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -573,16 +573,13 @@ typedef struct TCGProfile { int nb_guest_insns; int nb_spills; int nb_ops_pre_opt; + + int del_op_count; + int temp_count; } translation; int64_t cpu_exec_time; - int64_t tb_count1; - int64_t tb_count; int64_t op_count; /* total insn count */ - int op_count_max; /* max insn per TB */ - int temp_count_max; - int64_t temp_count; - int64_t del_op_count; int64_t code_in_len; int64_t code_out_len; int64_t search_out_len;