From: Christopher Covington <cov@codeaurora.org>
To: qemu-devel@nongnu.org
Cc: Christopher Covington <cov@codeaurora.org>
Subject: [Qemu-devel] [RFC 1/2] icount: Print instruction count on exit
Date: Tue, 11 Aug 2015 11:08:31 -0400 [thread overview]
Message-ID: <1439305712-3957-2-git-send-email-cov@codeaurora.org> (raw)
In-Reply-To: <1439305712-3957-1-git-send-email-cov@codeaurora.org>
When -icount shift=n is in use, print the instruction count when
finished. In conjunction with the `time` command, this can be used to
calculate how many instructions per second QEMU TCG can translate and
execute. The output can also be used to double-check future facilities
such as exposing the instruction count to guest/target software
through interfaces such as an emulated Performance Monitors Unit.
Signed-off-by: Christopher Covington <cov@codeaurora.org>
---
cpus.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/cpus.c b/cpus.c
index a822ce3..b0bc8ec 100644
--- a/cpus.c
+++ b/cpus.c
@@ -511,6 +511,13 @@ void cpu_ticks_init(void)
vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
}
+static Notifier icount_exit_notifier;
+
+static void print_instruction_count(Notifier *notifier, void *data)
+{
+ printf("Executed %"PRId64" target instructions.\n", cpu_get_icount_raw());
+}
+
void configure_icount(QemuOpts *opts, Error **errp)
{
const char *option;
@@ -541,6 +548,8 @@ void configure_icount(QemuOpts *opts, Error **errp)
if (errno != 0 || *rem_str != '\0' || !strlen(option)) {
error_setg(errp, "icount: Invalid shift value");
}
+ icount_exit_notifier.notify = &print_instruction_count;
+ qemu_add_exit_notifier(&icount_exit_notifier);
use_icount = 1;
return;
} else if (icount_align_option) {
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2015-08-11 15:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 15:08 [Qemu-devel] RFC: Instruction Counting Debug Facilities Christopher Covington
2015-08-11 15:08 ` Christopher Covington [this message]
2015-08-11 15:08 ` [Qemu-devel] [RFC 2/2] qemu-log: Add in_icount option Christopher Covington
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=1439305712-3957-2-git-send-email-cov@codeaurora.org \
--to=cov@codeaurora.org \
--cc=qemu-devel@nongnu.org \
/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).