qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: vandersonmr <vandersonmr2@gmail.com>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>,
	vandersonmr <vandersonmr2@gmail.com>,
	Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [Qemu-Devel][PATCH 3/3] Adding command line option to linux-user.
Date: Fri, 14 Jun 2019 10:53:31 -0300	[thread overview]
Message-ID: <20190614135332.12777-4-vandersonmr2@gmail.com> (raw)
In-Reply-To: <20190614135332.12777-1-vandersonmr2@gmail.com>

Added -execfreq to enable execution frequency counting and dump
all the TB's addresses and their execution frequency at the end
of the execution.

Signed-off-by: vandersonmr <vandersonmr2@gmail.com>
---
 linux-user/exit.c | 5 +++++
 linux-user/main.c | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/linux-user/exit.c b/linux-user/exit.c
index bdda720553..0c6a2f2d5b 100644
--- a/linux-user/exit.c
+++ b/linux-user/exit.c
@@ -26,8 +26,13 @@
 extern void __gcov_dump(void);
 #endif
 
+extern bool enable_freq_count;
+
 void preexit_cleanup(CPUArchState *env, int code)
 {
+    if (enable_freq_count) {
+        tb_dump_all_exec_freq();
+    }
 #ifdef TARGET_GPROF
         _mcleanup();
 #endif
diff --git a/linux-user/main.c b/linux-user/main.c
index 1bf7155670..ece2d8bd8b 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -388,6 +388,11 @@ static void handle_arg_trace(const char *arg)
     trace_file = trace_opt_parse(arg);
 }
 
+static void handle_arg_execfreq(const char *arg)
+{
+    enable_freq_count = true;
+}
+
 struct qemu_argument {
     const char *argv;
     const char *env;
@@ -439,6 +444,8 @@ static const struct qemu_argument arg_table[] = {
      "",           "Seed for pseudo-random number generator"},
     {"trace",      "QEMU_TRACE",       true,  handle_arg_trace,
      "",           "[[enable=]<pattern>][,events=<file>][,file=<file>]"},
+    {"execfreq",   "QEMU_EXEC_FREQ",   false,  handle_arg_execfreq,
+     "",           "enable and dump TB's execution frequency counting"},
     {"version",    "QEMU_VERSION",     false, handle_arg_version,
      "",           "display version information and exit"},
     {NULL, NULL, false, NULL, NULL, NULL}
-- 
2.22.0



  parent reply	other threads:[~2019-06-14 14:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-14 13:53 [Qemu-devel] [PATCH 0/3] Collecting TB Execution Frequency vandersonmr
2019-06-14 13:53 ` [Qemu-devel] [Qemu-Devel][PATCH 1/3] Adding an optional tb execution counter vandersonmr
2019-06-17  2:28   ` Richard Henderson
2019-06-17 10:01   ` Alex Bennée
2019-06-14 13:53 ` [Qemu-devel] [Qemu-Devel][PATCH 2/3] Saving counters between tb_flush events vandersonmr
2019-06-17  2:52   ` Richard Henderson
2019-06-17 10:00   ` Alex Bennée
2019-06-14 13:53 ` vandersonmr [this message]
2019-06-17  2:54   ` [Qemu-devel] [Qemu-Devel][PATCH 3/3] Adding command line option to linux-user Richard Henderson
2019-06-17 11:30   ` Alex Bennée
2019-06-14 16:01 ` [Qemu-devel] [PATCH 0/3] Collecting TB Execution Frequency no-reply
2019-06-17 10:17 ` Alex Bennée
2019-06-17 13:13 ` 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=20190614135332.12777-4-vandersonmr2@gmail.com \
    --to=vandersonmr2@gmail.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).