qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Basic block statistics
@ 2003-11-11 13:14 Johan Rydberg
  2003-11-11 13:44 ` Johan Rydberg
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Rydberg @ 2003-11-11 13:14 UTC (permalink / raw)
  To: qemu-devel

Hi,

I hacked QEMU to dump some statistics regarding the length of
the basic blocks with respect of their length.  I booted the
Debian image suppblied by Leigh Dyer til the login prompt.

It seems that the avg basic block length is ~ 5 insns.  This seems 
as a reasonable number for C code.  

What is a bit supprising to me  is that only ~ 0.3 % of these blocks 
has internal loops (the CTI insn at the end has the first insn in the 
BB as target).  If you treat basic blocks that has just includes 
a single insn with a rep/repz prefix, the amount of basic blocks that
contain loops increases to ~ 2.38 %.  

I have yet not figured out a way to alter QEMU to see how much of
the execution time these blocks consume.  Say that the ~2.38% of
the blocks consume 10% of the time, it might be worth doing extra
optmizations on then.  Fabrice, do you know how I could hack QEMU
to get this kind of information?

-- 
Johan Rydberg, Free Software Developer, Sweden
http://rtmk.sf.net | http://www.nongnu.org/guss/

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

* Re: [Qemu-devel] Basic block statistics
  2003-11-11 13:14 [Qemu-devel] Basic block statistics Johan Rydberg
@ 2003-11-11 13:44 ` Johan Rydberg
  2003-11-11 14:18   ` Fabrice Bellard
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Rydberg @ 2003-11-11 13:44 UTC (permalink / raw)
  To: qemu-devel

Johan Rydberg <jrydberg@night.trouble.net> wrote: (Yes, I did)

: I have yet not figured out a way to alter QEMU to see how much of
: the execution time these blocks consume.  Say that the ~2.38% of
: the blocks consume 10% of the time, it might be worth doing extra
: optmizations on then.  Fabrice, do you know how I could hack QEMU
: to get this kind of information?

I disabled chaining and counted each invoking of basic blocks, and
maintained a separate counter for those blocks that contain internal
loops.  Booting the Debian image to the login prompt gave that the
blocks with internal loops stod for 33.7% of all invoked blocks.
Can anyone verify this? (by hacking QEMU yourself, both verifying
the numbers and that I collect the statistics correctly)  It should
not take more than 20 minutes all together.

Assume that the values are correct.  Then optimization of the blocks
that contain loops could result in a rather huge performance boost.
You could for example try to move register stores and loads out of
the it and just work with host registers in the actual loop.

-- 
Johan Rydberg, Free Software Developer, Sweden
http://rtmk.sf.net | http://www.nongnu.org/guss/

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

* Re: [Qemu-devel] Basic block statistics
  2003-11-11 13:44 ` Johan Rydberg
@ 2003-11-11 14:18   ` Fabrice Bellard
  0 siblings, 0 replies; 3+ messages in thread
From: Fabrice Bellard @ 2003-11-11 14:18 UTC (permalink / raw)
  To: qemu-devel

Johan Rydberg wrote:
> Johan Rydberg <jrydberg@night.trouble.net> wrote: (Yes, I did)
> 
> : I have yet not figured out a way to alter QEMU to see how much of
> : the execution time these blocks consume.  Say that the ~2.38% of
> : the blocks consume 10% of the time, it might be worth doing extra
> : optmizations on then.  Fabrice, do you know how I could hack QEMU
> : to get this kind of information?
> 
> I disabled chaining and counted each invoking of basic blocks, and
> maintained a separate counter for those blocks that contain internal
> loops.  Booting the Debian image to the login prompt gave that the
> blocks with internal loops stod for 33.7% of all invoked blocks.
> Can anyone verify this? (by hacking QEMU yourself, both verifying
> the numbers and that I collect the statistics correctly)  It should
> not take more than 20 minutes all together.

I would have done about the same to get the stats :-) I read that wabi 
was able to optimize these kind of loops, so I guess it is really 
interesting.

> Assume that the values are correct.  Then optimization of the blocks
> that contain loops could result in a rather huge performance boost.
> You could for example try to move register stores and loads out of
> the it and just work with host registers in the actual loop.

I don't have time yet to optimize QEMU, but I'll think about that. Of 
course if someone does the patch I will accept it !

Fabrice.

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

end of thread, other threads:[~2003-11-11 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-11 13:14 [Qemu-devel] Basic block statistics Johan Rydberg
2003-11-11 13:44 ` Johan Rydberg
2003-11-11 14:18   ` Fabrice Bellard

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