All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Revert "timer: replace time() with QEMU_CLOCK_HOST"
@ 2015-03-10  2:43 Alexey Kardashevskiy
  2015-03-10 11:05 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Kardashevskiy @ 2015-03-10  2:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Paolo Bonzini, Pavel Dovgalyuk

This reverts commit 2ed1ebcf65edf6757d8904000889ce52cc0a9d1b
as it breaks compile when configured with --enable-profiler:

/home/alexey/p/qemu/vl.c:710:15: error: 'qemu_time' redeclared as different kind of symbol
 static time_t qemu_time(void)
               ^
In file included from /home/alexey/p/qemu/include/block/aio.h:23:0,
                 from /home/alexey/p/qemu/include/hw/hw.h:13,
                 from /home/alexey/p/qemu/vl.c:62:
/home/alexey/p/qemu/include/qemu/timer.h:1005:16: note: previous declaration of 'qemu_time' was here
 extern int64_t qemu_time, qemu_time_start;
                ^

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---


I could rename qemu_time() but could not think of any nice and simple name
instead so here is revert :)


---
 vl.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/vl.c b/vl.c
index b47e223..0e59688 100644
--- a/vl.c
+++ b/vl.c
@@ -707,17 +707,13 @@ void vm_start(void)
 /***********************************************************/
 /* real time host monotonic timer */
 
-static time_t qemu_time(void)
-{
-    return qemu_clock_get_ms(QEMU_CLOCK_HOST) / 1000;
-}
-
 /***********************************************************/
 /* host time/date access */
 void qemu_get_timedate(struct tm *tm, int offset)
 {
-    time_t ti = qemu_time();
+    time_t ti;
 
+    time(&ti);
     ti += offset;
     if (rtc_date_offset == -1) {
         if (rtc_utc)
@@ -745,7 +741,7 @@ int qemu_timedate_diff(struct tm *tm)
     else
         seconds = mktimegm(tm) + rtc_date_offset;
 
-    return seconds - qemu_time();
+    return seconds - time(NULL);
 }
 
 static void configure_rtc_date_offset(const char *startdate, int legacy)
@@ -783,7 +779,7 @@ static void configure_rtc_date_offset(const char *startdate, int legacy)
                             "'2006-06-17T16:01:21' or '2006-06-17'\n");
             exit(1);
         }
-        rtc_date_offset = qemu_time() - rtc_start_date;
+        rtc_date_offset = time(NULL) - rtc_start_date;
     }
 }
 
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Revert "timer: replace time() with QEMU_CLOCK_HOST"
  2015-03-10  2:43 [Qemu-devel] [PATCH] Revert "timer: replace time() with QEMU_CLOCK_HOST" Alexey Kardashevskiy
@ 2015-03-10 11:05 ` Paolo Bonzini
  2015-03-10 11:49   ` Alexey Kardashevskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2015-03-10 11:05 UTC (permalink / raw)
  To: Alexey Kardashevskiy, qemu-devel; +Cc: Pavel Dovgalyuk



On 10/03/2015 03:43, Alexey Kardashevskiy wrote:
> This reverts commit 2ed1ebcf65edf6757d8904000889ce52cc0a9d1b
> as it breaks compile when configured with --enable-profiler:
> 
> /home/alexey/p/qemu/vl.c:710:15: error: 'qemu_time' redeclared as different kind of symbol
>  static time_t qemu_time(void)
>                ^
> In file included from /home/alexey/p/qemu/include/block/aio.h:23:0,
>                  from /home/alexey/p/qemu/include/hw/hw.h:13,
>                  from /home/alexey/p/qemu/vl.c:62:
> /home/alexey/p/qemu/include/qemu/timer.h:1005:16: note: previous declaration of 'qemu_time' was here
>  extern int64_t qemu_time, qemu_time_start;
>                 ^
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> 
> 
> I could rename qemu_time() but could not think of any nice and simple name
> instead so here is revert :)

ENABLE_PROFILER is a bit broken in many ways:

1) half of it only works for TCG, but doesn't say this anywhere.

2) the division by get_ticks_per_sec() doesn't work since the unit of
measurement is clock cycles rather than nanoseconds.  (Broken since 2006).

3) you really can get the same information from "top" now that we have
VCPU threads.

4) It declares non-existing extern variables qemu_time_start and
tlb_flush_time, the latter of which has never existed _at all_.

But let's fix it.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Revert "timer: replace time() with QEMU_CLOCK_HOST"
  2015-03-10 11:05 ` Paolo Bonzini
@ 2015-03-10 11:49   ` Alexey Kardashevskiy
  2015-03-10 11:54     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Kardashevskiy @ 2015-03-10 11:49 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Pavel Dovgalyuk

On 03/10/2015 10:05 PM, Paolo Bonzini wrote:
>
>
> On 10/03/2015 03:43, Alexey Kardashevskiy wrote:
>> This reverts commit 2ed1ebcf65edf6757d8904000889ce52cc0a9d1b
>> as it breaks compile when configured with --enable-profiler:
>>
>> /home/alexey/p/qemu/vl.c:710:15: error: 'qemu_time' redeclared as different kind of symbol
>>   static time_t qemu_time(void)
>>                 ^
>> In file included from /home/alexey/p/qemu/include/block/aio.h:23:0,
>>                   from /home/alexey/p/qemu/include/hw/hw.h:13,
>>                   from /home/alexey/p/qemu/vl.c:62:
>> /home/alexey/p/qemu/include/qemu/timer.h:1005:16: note: previous declaration of 'qemu_time' was here
>>   extern int64_t qemu_time, qemu_time_start;
>>                  ^
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>>
>>
>> I could rename qemu_time() but could not think of any nice and simple name
>> instead so here is revert :)
>
> ENABLE_PROFILER is a bit broken in many ways:
>
> 1) half of it only works for TCG, but doesn't say this anywhere.
>
> 2) the division by get_ticks_per_sec() doesn't work since the unit of
> measurement is clock cycles rather than nanoseconds.  (Broken since 2006).
>
> 3) you really can get the same information from "top" now that we have
> VCPU threads.
>
> 4) It declares non-existing extern variables qemu_time_start and
> tlb_flush_time, the latter of which has never existed _at all_.
>
> But let's fix it.

Sure! Who/how? :) Or fixing means removing it? I am not using it, it is in 
my configure invoke script for ages.


-- 
Alexey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Revert "timer: replace time() with QEMU_CLOCK_HOST"
  2015-03-10 11:49   ` Alexey Kardashevskiy
@ 2015-03-10 11:54     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-03-10 11:54 UTC (permalink / raw)
  To: Alexey Kardashevskiy, qemu-devel; +Cc: Pavel Dovgalyuk



On 10/03/2015 12:49, Alexey Kardashevskiy wrote:
> Sure! Who/how? :)

s/qemu_time/tcg_time/, but if Peter is not using it and Fabrice broke
it, might as well remove it.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-10 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-10  2:43 [Qemu-devel] [PATCH] Revert "timer: replace time() with QEMU_CLOCK_HOST" Alexey Kardashevskiy
2015-03-10 11:05 ` Paolo Bonzini
2015-03-10 11:49   ` Alexey Kardashevskiy
2015-03-10 11:54     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.