From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXMB2-0005kE-5X for qemu-devel@nongnu.org; Sun, 15 Mar 2015 23:58:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXMAz-0004Qe-0G for qemu-devel@nongnu.org; Sun, 15 Mar 2015 23:58:52 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:46415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXMAy-0004QB-CJ for qemu-devel@nongnu.org; Sun, 15 Mar 2015 23:58:48 -0400 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Mar 2015 13:58:42 +1000 Received: from d23relay10.au.ibm.com (d23relay10.au.ibm.com [9.190.26.77]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 7B9CA2CE8050 for ; Mon, 16 Mar 2015 14:58:39 +1100 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t2G3wUpq43319492 for ; Mon, 16 Mar 2015 14:58:39 +1100 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t2G3w54k001931 for ; Mon, 16 Mar 2015 14:58:05 +1100 From: Alexey Kardashevskiy Date: Mon, 16 Mar 2015 14:57:38 +1100 Message-Id: <1426478258-29961-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH qemu] profiler: Reenable built-in profiler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , Paolo Bonzini , Alexander Graf , Peter Maydell 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 --- On 03/10/2015 10:54 PM, Paolo Bonzini wrote:> > s/qemu_time/tcg_time/, but if Peter is not using it and Fabrice broke > it, might as well remove it. > > Paolo Which Peter did you mean here, Paolo? --- 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 c86a89e..4e67774 100644 --- a/monitor.c +++ b/monitor.c @@ -1974,7 +1974,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) @@ -1982,8 +1982,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.0.0