qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] time inside qemu
@ 2006-12-29 11:13 Màrius Montón
  0 siblings, 0 replies; 11+ messages in thread
From: Màrius Montón @ 2006-12-29 11:13 UTC (permalink / raw)
  To: Qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 850 bytes --]

Hi,

For my work on QEMU-SC, I need to stop time inside qemu.
I need it in order to simulate HW modules with SystemC simulator, and
meanwhile stop qemu time.
In this way, applications running on qem should see its time freeze, and
measurements of total time spent by application + specific HW be more
realistic (now, total time is the sum of SW + HW simulation )

Any starting point? I don't know what to look first!

Greetings,
-- 
Màrius Montón i Macián   marius.monton@uab.cat
<mailto:marius.monton@uab.cat>  http://cephis.uab.es
<http://www.mariusmonton.name>
Hardware Engineer
CEPHIS
Centre de Prototips i Solucions Hardware-Software
Dep. Microelectrònica i Sistemes Electrònics
ETSE - Universitat Autònoma de Barcelona (UAB) 	Phone: +34 935 813 534
Fax: +34 935 813 033
QC-2090D. ETSE. Campus UAB.
080193 Bellaterra



[-- Attachment #1.2: Type: text/html, Size: 1950 bytes --]

[-- Attachment #2: marius.monton.vcf --]
[-- Type: text/x-vcard, Size: 440 bytes --]

begin:vcard
fn;quoted-printable:M=C3=A0rius Mont=C3=B3n
n;quoted-printable;quoted-printable:Mont=C3=B3n;M=C3=A0rius
org;quoted-printable:CEPHIS;Microelectr=C3=B2nica i Sistemes Electronics
adr:Campus de la UAB;;QC-2090D, ETSE;Bellaterra;Barcelona;08193;Spain
email;internet:marius.monton@uab.es
title:HW Engineer
tel;work:+34935813534
tel;fax:+34935813033
x-mozilla-html:TRUE
url:http://cephis.uab.es
version:2.1
end:vcard



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

* [Qemu-devel] time inside qemu
@ 2006-12-29 16:22 Màrius Montón
  2006-12-29 17:43 ` Paul Brook
  0 siblings, 1 reply; 11+ messages in thread
From: Màrius Montón @ 2006-12-29 16:22 UTC (permalink / raw)
  To: Qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 850 bytes --]

Hi,

For my work on QEMU-SC, I need to stop time inside qemu.
I need it in order to simulate HW modules with SystemC simulator, and
meanwhile stop qemu time.
In this way, applications running on qem should see its time freeze, and
measurements of total time spent by application + specific HW be more
realistic (now, total time is the sum of SW + HW simulation )

Any starting point? I don't know what to look first!

Greetings,
-- 
Màrius Montón i Macián   marius.monton@uab.cat
<mailto:marius.monton@uab.cat>  http://cephis.uab.es
<http://www.mariusmonton.name>
Hardware Engineer
CEPHIS
Centre de Prototips i Solucions Hardware-Software
Dep. Microelectrònica i Sistemes Electrònics
ETSE - Universitat Autònoma de Barcelona (UAB) 	Phone: +34 935 813 534
Fax: +34 935 813 033
QC-2090D. ETSE. Campus UAB.
080193 Bellaterra



[-- Attachment #1.2: Type: text/html, Size: 1950 bytes --]

[-- Attachment #2: marius.monton.vcf --]
[-- Type: text/x-vcard, Size: 440 bytes --]

begin:vcard
fn;quoted-printable:M=C3=A0rius Mont=C3=B3n
n;quoted-printable;quoted-printable:Mont=C3=B3n;M=C3=A0rius
org;quoted-printable:CEPHIS;Microelectr=C3=B2nica i Sistemes Electronics
adr:Campus de la UAB;;QC-2090D, ETSE;Bellaterra;Barcelona;08193;Spain
email;internet:marius.monton@uab.es
title:HW Engineer
tel;work:+34935813534
tel;fax:+34935813033
x-mozilla-html:TRUE
url:http://cephis.uab.es
version:2.1
end:vcard



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

* Re: [Qemu-devel] time inside qemu
  2006-12-29 16:22 [Qemu-devel] time inside qemu Màrius Montón
@ 2006-12-29 17:43 ` Paul Brook
  2006-12-29 17:53   ` Màrius Montón
  2006-12-31 14:52   ` Markus Schiltknecht
  0 siblings, 2 replies; 11+ messages in thread
From: Paul Brook @ 2006-12-29 17:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Màrius Montón

On Friday 29 December 2006 16:22, Màrius Montón wrote:
> Hi,
>
> For my work on QEMU-SC, I need to stop time inside qemu.
> I need it in order to simulate HW modules with SystemC simulator, and
> meanwhile stop qemu time.
> In this way, applications running on qem should see its time freeze, and
> measurements of total time spent by application + specific HW be more
> realistic (now, total time is the sum of SW + HW simulation )

qemu is not cycle accurate or even deterministic.

Fabrice was working on some code to make it deterministic, but he never posted 
the code.

Paul

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

* Re: [Qemu-devel] time inside qemu
  2006-12-29 17:43 ` Paul Brook
@ 2006-12-29 17:53   ` Màrius Montón
  2006-12-29 18:10     ` Paul Brook
  2007-04-16 21:59     ` Eduardo Felipe
  2006-12-31 14:52   ` Markus Schiltknecht
  1 sibling, 2 replies; 11+ messages in thread
From: Màrius Montón @ 2006-12-29 17:53 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 1458 bytes --]

Hi,

As I understand, OSes running inside qemu "have" notion of time: (its
date and time works, time(1) command works, etc.).
My question is about how qemu manages time. I need to stop and start
again this "virtual-time".

I just tried with cpu_disable_ticks() and cpu_enable_ticks(). It seems
to work partially: at least now system date and time are out of sync..

Màrius

Paul Brook wrote:
> On Friday 29 December 2006 16:22, Màrius Montón wrote:
>   
>> Hi,
>>
>> For my work on QEMU-SC, I need to stop time inside qemu.
>> I need it in order to simulate HW modules with SystemC simulator, and
>> meanwhile stop qemu time.
>> In this way, applications running on qem should see its time freeze, and
>> measurements of total time spent by application + specific HW be more
>> realistic (now, total time is the sum of SW + HW simulation )
>>     
>
> qemu is not cycle accurate or even deterministic.
>
> Fabrice was working on some code to make it deterministic, but he never posted 
> the code.
>
> Paul
>
>   

-- 
Màrius Montón i Macián   marius.monton@uab.cat
<mailto:marius.monton@uab.cat>  http://cephis.uab.es
<http://www.mariusmonton.name>
Hardware Engineer
CEPHIS
Centre de Prototips i Solucions Hardware-Software
Dep. Microelectrònica i Sistemes Electrònics
ETSE - Universitat Autònoma de Barcelona (UAB) 	Phone: +34 935 813 534
Fax: +34 935 813 033
QC-2090D. ETSE. Campus UAB.
080193 Bellaterra



[-- Attachment #1.2: Type: text/html, Size: 2749 bytes --]

[-- Attachment #2: marius.monton.vcf --]
[-- Type: text/x-vcard, Size: 440 bytes --]

begin:vcard
fn;quoted-printable:M=C3=A0rius Mont=C3=B3n
n;quoted-printable;quoted-printable:Mont=C3=B3n;M=C3=A0rius
org;quoted-printable:CEPHIS;Microelectr=C3=B2nica i Sistemes Electronics
adr:Campus de la UAB;;QC-2090D, ETSE;Bellaterra;Barcelona;08193;Spain
email;internet:marius.monton@uab.es
title:HW Engineer
tel;work:+34935813534
tel;fax:+34935813033
x-mozilla-html:TRUE
url:http://cephis.uab.es
version:2.1
end:vcard



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

* Re: [Qemu-devel] time inside qemu
  2006-12-29 17:53   ` Màrius Montón
@ 2006-12-29 18:10     ` Paul Brook
  2007-04-16 14:41       ` Marius Monton
  2007-04-16 21:59     ` Eduardo Felipe
  1 sibling, 1 reply; 11+ messages in thread
From: Paul Brook @ 2006-12-29 18:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Màrius Montón

On Friday 29 December 2006 17:53, Màrius Montón wrote:
> Hi,
>
> As I understand, OSes running inside qemu "have" notion of time: (its
> date and time works, time(1) command works, etc.).
> My question is about how qemu manages time. I need to stop and start
> again this "virtual-time".

qemu doesn't maintain virtual time, it just uses the real host time.

> I just tried with cpu_disable_ticks() and cpu_enable_ticks(). It seems
> to work partially: at least now system date and time are out of sync..

I suspect you'll find that for anything other than very coarse user (ie. user 
stop/continue) these are effectively useless.

Any benchmark/performance measurements you make inside qemu are meaningless. 
qemu performance bears no relation whatsoever to the performance 
characteristics of real hardware.

Paul

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

* Re: [Qemu-devel] time inside qemu
  2006-12-29 17:43 ` Paul Brook
  2006-12-29 17:53   ` Màrius Montón
@ 2006-12-31 14:52   ` Markus Schiltknecht
  1 sibling, 0 replies; 11+ messages in thread
From: Markus Schiltknecht @ 2006-12-31 14:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Màrius Montón

Hi,

Paul Brook wrote:
> qemu is not cycle accurate or even deterministic.

Is there anything that's cycle accurate at all?

Regards

Markus

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

* Re: [Qemu-devel] time inside qemu
  2006-12-29 18:10     ` Paul Brook
@ 2007-04-16 14:41       ` Marius Monton
  2007-04-16 15:12         ` Paul Brook
  0 siblings, 1 reply; 11+ messages in thread
From: Marius Monton @ 2007-04-16 14:41 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 2164 bytes --]

That's true, and I don't care about it. I'd like to get a method to
stop/start time inside qemu in order to simulate execution of large
pieces of hw out of qemu (look at qemu-systemc project).
If qemu is freeze  meanwhile a systemc simulation is in progress
(simulating a HW device of system), time should be freeze also.
In this way, execution time of a program inside qemu should appear
shorter when using accelerator HW than only SW application. I know these
times are not reals, but it should be enough to estimate correctness and
execution time on real platforms.

Does a way to stop/start time inside qemu?

Thanks,

Màrius

En/na Paul Brook ha escrit:
> On Friday 29 December 2006 17:53, Màrius Montón wrote:
>   
>> Hi,
>>
>> As I understand, OSes running inside qemu "have" notion of time: (its
>> date and time works, time(1) command works, etc.).
>> My question is about how qemu manages time. I need to stop and start
>> again this "virtual-time".
>>     
>
> qemu doesn't maintain virtual time, it just uses the real host time.
>
>   
>> I just tried with cpu_disable_ticks() and cpu_enable_ticks(). It seems
>> to work partially: at least now system date and time are out of sync..
>>     
>
> I suspect you'll find that for anything other than very coarse user (ie. user 
> stop/continue) these are effectively useless.
>
> Any benchmark/performance measurements you make inside qemu are meaningless. 
> qemu performance bears no relation whatsoever to the performance 
> characteristics of real hardware.
>
>   

> Paul
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
>   

-- 
Màrius Montón i Macián   marius.monton@uab.cat
<mailto:marius.monton@uab.cat>  http://cephis.uab.es
<http://www.mariusmonton.name>
Hardware Engineer
CEPHIS
Centre de Prototips i Solucions Hardware-Software
Dep. Microelectrònica i Sistemes Electrònics
ETSE - Universitat Autònoma de Barcelona (UAB) 	Phone: +34 935 813 534
Fax: +34 935 813 033
QC-2090D. ETSE. Campus UAB.
080193 Bellaterra



[-- Attachment #1.2: Type: text/html, Size: 3828 bytes --]

[-- Attachment #2: marius.monton.vcf --]
[-- Type: text/x-vcard, Size: 350 bytes --]

begin:vcard
fn;quoted-printable:M=C3=A0rius Mont=C3=B3n
n;quoted-printable;quoted-printable:Mont=C3=B3n;M=C3=A0rius
org:CEPHIS-UAB
adr:Campus de la Autonoma;;QC-2090D. ETSE;Bellaterra;Barcelona;08193;Spain
email;internet:marius.monton@uab.cat
title:System Engineer
tel;work:+34935813534
url:http://cephis.uab.cat
version:2.1
end:vcard



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

* Re: [Qemu-devel] time inside qemu
  2007-04-16 14:41       ` Marius Monton
@ 2007-04-16 15:12         ` Paul Brook
  2007-04-17 14:05           ` Marius Monton
  0 siblings, 1 reply; 11+ messages in thread
From: Paul Brook @ 2007-04-16 15:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marius Monton

On Monday 16 April 2007 15:41, Marius Monton wrote:
> > Any benchmark/performance measurements you make inside qemu are
> > meaningless. qemu performance bears no relation whatsoever to the
> > performance characteristics of real hardware.
>
> That's true, and I don't care about it. I'd like to get a method to
> stop/start time inside qemu in order to simulate execution of large
> pieces of hw out of qemu (look at qemu-systemc project).
> If qemu is freeze  meanwhile a systemc simulation is in progress
> (simulating a HW device of system), time should be freeze also.
> In this way, execution time of a program inside qemu should appear
> shorter when using accelerator HW than only SW application. I know these
> times are not reals, but it should be enough to estimate correctness and
> execution time on real platforms.

You're deluding yourself. I simply don't believe you can get any meaningful 
performance measurements out of qemu. You certainly can't use it to evaluate 
the correctness of time sensitive algorithms.

qemu execution times can easily be orders of magnitude different from real 
hardware. i.e. if you have two operations that take the same amount of time 
to execute on real hardware, one of those operations may take many times 
longer than the other inside qemu.

If nothing else you're entirely at the mercy of the host OS process scheduler 
and signal delivery. The emulated CPU may stall for an arbitrary time at any 
point.

Paul

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

* Re: [Qemu-devel] time inside qemu
  2006-12-29 17:53   ` Màrius Montón
  2006-12-29 18:10     ` Paul Brook
@ 2007-04-16 21:59     ` Eduardo Felipe
  1 sibling, 0 replies; 11+ messages in thread
From: Eduardo Felipe @ 2007-04-16 21:59 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

Hi,

> I just tried with cpu_disable_ticks() and cpu_enable_ticks(). It seems to
> work partially: at least now system date and time are out of sync..
>

Maybe a more accurate way to do this is mimicking "stop" and "continue"
monitor commands:

vm_stop(EXCP_INTERRUPT);
[SystemC simulation]
vm_start();

This just takes SystemC emulation time out of the equation. You cannot make
any reliable performance measure of qemu's translated code, as already
mentioned, but the former may be enough for your requirements.

Regards,
Eduardo Felipe

[-- Attachment #2: Type: text/html, Size: 813 bytes --]

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

* Re: [Qemu-devel] time inside qemu
  2007-04-16 15:12         ` Paul Brook
@ 2007-04-17 14:05           ` Marius Monton
  2007-04-17 14:22             ` Paul Brook
  0 siblings, 1 reply; 11+ messages in thread
From: Marius Monton @ 2007-04-17 14:05 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 2693 bytes --]



En/na Paul Brook ha escrit:
> On Monday 16 April 2007 15:41, Marius Monton wrote:
>   
>>> Any benchmark/performance measurements you make inside qemu are
>>> meaningless. qemu performance bears no relation whatsoever to the
>>> performance characteristics of real hardware.
>>>       
>> That's true, and I don't care about it. I'd like to get a method to
>> stop/start time inside qemu in order to simulate execution of large
>> pieces of hw out of qemu (look at qemu-systemc project).
>> If qemu is freeze  meanwhile a systemc simulation is in progress
>> (simulating a HW device of system), time should be freeze also.
>> In this way, execution time of a program inside qemu should appear
>> shorter when using accelerator HW than only SW application. I know these
>> times are not reals, but it should be enough to estimate correctness and
>> execution time on real platforms.
>>     
>
> You're deluding yourself. I simply don't believe you can get any meaningful 
> performance measurements out of qemu. You certainly can't use it to evaluate 
> the correctness of time sensitive algorithms.
>
> qemu execution times can easily be orders of magnitude different from real 
> hardware. i.e. if you have two operations that take the same amount of time 
> to execute on real hardware, one of those operations may take many times 
> longer than the other inside qemu.
>   
It's possible, but I think that roughly speaking, more code implies more
time:

code (a) : for (int i = 0; i< 1000000; i++) c[i] = a[i] * b[i];

code (b) : for (int i = 0; i< 1000; i++) for(int  j = 0; j < b[i]; j++)
c[i] += a[i];

code (c) : for (int i = 0; i< 1000; i++) c[i] = HW_MUL(a[i], b[i]);

I'm sure that code (b) will execute much longer that code (a) inside
qemu (sure that different that in real platform), and I'd like to
compute executing time for code (c) in some way.
So, how can I trap time information/calculation inside qemu?
>  
> If nothing else you're entirely at the mercy of the host OS process scheduler 
> and signal delivery. The emulated CPU may stall for an arbitrary time at any 
> point.
>
>   
Sure, but this can be avoided using multiple simulations and calculating
arithmetic mean for execution time.
> Paul
>
>   

-- 
Màrius Montón i Macián   marius.monton@uab.cat
<mailto:marius.monton@uab.cat>  http://cephis.uab.es
<http://www.mariusmonton.name>
Hardware Engineer
CEPHIS
Centre de Prototips i Solucions Hardware-Software
Dep. Microelectrònica i Sistemes Electrònics
ETSE - Universitat Autònoma de Barcelona (UAB) 	Phone: +34 935 813 534
Fax: +34 935 813 033
QC-2090D. ETSE. Campus UAB.
080193 Bellaterra



[-- Attachment #1.2: Type: text/html, Size: 4260 bytes --]

[-- Attachment #2: marius.monton.vcf --]
[-- Type: text/x-vcard, Size: 350 bytes --]

begin:vcard
fn;quoted-printable:M=C3=A0rius Mont=C3=B3n
n;quoted-printable;quoted-printable:Mont=C3=B3n;M=C3=A0rius
org:CEPHIS-UAB
adr:Campus de la Autonoma;;QC-2090D. ETSE;Bellaterra;Barcelona;08193;Spain
email;internet:marius.monton@uab.cat
title:System Engineer
tel;work:+34935813534
url:http://cephis.uab.cat
version:2.1
end:vcard



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

* Re: [Qemu-devel] time inside qemu
  2007-04-17 14:05           ` Marius Monton
@ 2007-04-17 14:22             ` Paul Brook
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Brook @ 2007-04-17 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marius Monton

> code (a) : for (int i = 0; i< 1000000; i++) c[i] = a[i] * b[i];
>
> code (b) : for (int i = 0; i< 1000; i++) for(int  j = 0; j < b[i]; j++)
> c[i] += a[i];
>
> code (c) : for (int i = 0; i< 1000; i++) c[i] = HW_MUL(a[i], b[i]);
>
> I'm sure that code (b) will execute much longer that code (a) inside
> qemu (sure that different that in real platform), and I'd like to
> compute executing time for code (c) in some way.
> So, how can I trap time information/calculation inside qemu?

You can't.

As I've said before, any performance measurements you make inside qemu are 
completely meaningless.

You may be able to say that executing 1000 iterations takes longer than 10 
iterations of the same loop, but you didn't need a simulator to tell you 
that. Also, there's a good chance qemu will take almost exactly the same time 
to execute them because the execution time will be dominated by the 
translation time for the first iteration.

You can not compare the cost of (say) add v.s. multiply, or of two different 
multiply instructions. The timings for the individual instructions (or any 
particular sequence of instructions) bear no relation whatsoever to the 
timings for the same sequence on real hardware.

I'm repeating myself now, so I intend this to my my last response to this 
thread.

Paul

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

end of thread, other threads:[~2007-04-17 14:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-29 16:22 [Qemu-devel] time inside qemu Màrius Montón
2006-12-29 17:43 ` Paul Brook
2006-12-29 17:53   ` Màrius Montón
2006-12-29 18:10     ` Paul Brook
2007-04-16 14:41       ` Marius Monton
2007-04-16 15:12         ` Paul Brook
2007-04-17 14:05           ` Marius Monton
2007-04-17 14:22             ` Paul Brook
2007-04-16 21:59     ` Eduardo Felipe
2006-12-31 14:52   ` Markus Schiltknecht
  -- strict thread matches above, loose matches on Subject: below --
2006-12-29 11:13 Màrius Montón

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).