qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Subject: [Qemu-devel] [PULL 17/19] profiler: Reenable built-in profiler
Date: Wed, 18 Mar 2015 12:25:04 +0100	[thread overview]
Message-ID: <1426677906-51657-18-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1426677906-51657-1-git-send-email-pbonzini@redhat.com>

From: Alexey Kardashevskiy <aik@ozlabs.ru>

2ed1ebcf6 "timer: replace time() with QEMU_CLOCK_HOST" broke compile
when configured with --enable-profiler. Turned out the profiler has been
broken for a while.

This does s/qemu_time/tcg_time/ as the profiler only works in a TCG mode.
This also fixes the compile error.

This changes profile_getclock() to return nanoseconds rather than
CPU ticks as the "profile" HMP command prints seconds and there is no
platform-independent way to get ticks-per-second rate.
Since TCG is quite slow and get_clock() returns nanoseconds (fine
enough), this should not affect precision much.

This removes unused qemu_time_start and tlb_flush_time.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-Id: <1426478258-29961-1-git-send-email-aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 cpus.c               | 2 +-
 include/qemu/timer.h | 5 ++---
 monitor.c            | 6 +++---
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/cpus.c b/cpus.c
index 1ce90a1..314df16 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1353,7 +1353,7 @@ static int tcg_cpu_exec(CPUArchState *env)
     }
     ret = cpu_exec(env);
 #ifdef CONFIG_PROFILER
-    qemu_time += profile_getclock() - ti;
+    tcg_time += profile_getclock() - ti;
 #endif
     if (use_icount) {
         /* Fold pending instructions back into the
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index eba8b21..e5bd494 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -999,11 +999,10 @@ static inline int64_t cpu_get_real_ticks (void)
 #ifdef CONFIG_PROFILER
 static inline int64_t profile_getclock(void)
 {
-    return cpu_get_real_ticks();
+    return get_clock();
 }
 
-extern int64_t qemu_time, qemu_time_start;
-extern int64_t tlb_flush_time;
+extern int64_t tcg_time;
 extern int64_t dev_time;
 #endif
 
diff --git a/monitor.c b/monitor.c
index 42116a9..65a63df 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1975,7 +1975,7 @@ static void hmp_info_numa(Monitor *mon, const QDict *qdict)
 
 #ifdef CONFIG_PROFILER
 
-int64_t qemu_time;
+int64_t tcg_time;
 int64_t dev_time;
 
 static void hmp_info_profile(Monitor *mon, const QDict *qdict)
@@ -1983,8 +1983,8 @@ static void hmp_info_profile(Monitor *mon, const QDict *qdict)
     monitor_printf(mon, "async time  %" PRId64 " (%0.3f)\n",
                    dev_time, dev_time / (double)get_ticks_per_sec());
     monitor_printf(mon, "qemu time   %" PRId64 " (%0.3f)\n",
-                   qemu_time, qemu_time / (double)get_ticks_per_sec());
-    qemu_time = 0;
+                   tcg_time, tcg_time / (double)get_ticks_per_sec());
+    tcg_time = 0;
     dev_time = 0;
 }
 #else
-- 
2.3.0

  parent reply	other threads:[~2015-03-18 11:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18 11:24 [Qemu-devel] [PULL 00/19] Misc bugfixes for 2.3.0-rc1 Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 01/19] nbd: Fix overflow return value Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 02/19] util/uri: Add overflow check to rfc3986_parse_port Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 03/19] qemu-nbd: Detect unused partitions by system == 0 Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 04/19] nbd: Fix nbd_establish_connection()'s return value Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 05/19] nbd: Pass return value from nbd_handle_list() Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 06/19] nbd: Handle blk_getlength() failure Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 07/19] qemu-nbd: fork() can fail Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 08/19] nbd: Fix potential signed overflow issues Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 09/19] nbd: Set block size to BDRV_SECTOR_SIZE Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 10/19] nbd: Fix nbd_receive_options() Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 11/19] nbd: Fix interpretation of the export flags Paolo Bonzini
2015-03-18 11:24 ` [Qemu-devel] [PULL 12/19] nbd: Drop unexpected data for NBD_OPT_LIST Paolo Bonzini
2015-03-18 11:25 ` [Qemu-devel] [PULL 13/19] coroutine-io: Return -errno in case of error Paolo Bonzini
2015-03-18 11:25 ` [Qemu-devel] [PULL 14/19] build: pass .d file name to scripts/make_device_config.sh, fix makefile target Paolo Bonzini
2015-03-18 11:25 ` [Qemu-devel] [PULL 15/19] virtio-scsi: Fix assert in virtio_scsi_push_event Paolo Bonzini
2015-03-18 11:25 ` [Qemu-devel] [PULL 16/19] kvm: fix ioeventfd endianness on bi-endian architectures Paolo Bonzini
2015-03-23  8:50   ` Greg Kurz
2015-03-18 11:25 ` Paolo Bonzini [this message]
2015-03-18 11:25 ` [Qemu-devel] [PULL 18/19] virtio-scsi-dataplane: fix memory leak in virtio_scsi_vring_init Paolo Bonzini
2015-03-18 11:25 ` [Qemu-devel] [PULL 19/19] exec: Respect as_tranlsate_internal length clamp Paolo Bonzini
2015-03-19 11:12 ` [Qemu-devel] [PULL 00/19] Misc bugfixes for 2.3.0-rc1 Peter Maydell

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=1426677906-51657-18-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aik@ozlabs.ru \
    --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).