[haiku-development] Re: On timeslices and cycles

On Fri, 13 Mar 2009 09:38:26 -0300
André Braga <meianoite@xxxxxxxxx> wrote:
> Em 13/03/2009, às 07:28, Christian Packmann  
> <Christian.Packmann@xxxxxx> escreveu:
> > I can think of two approaches for this:
> > 1. the ability to set CPU affinity for a thread, so that an  
> > application developer can select the CPUs/thread layout on a CPU  
> > himself.
> > 2. adding a flag to thread spawning routines which indicate if a  
> > thread is memory-bound, CPU-bound or general (i.e., a mixture of  
> > both).
> 
> I don't know the first thing about performance counters, except that  
> they exist. With this disclaimer in place, can't they be used to  
> derive the behaviour of a thread in this regard? Like if it spent a  
> lot of time waiting for memory or if it actually taxed the CPU with  
> calculations.

It depends entirely on the available counters for the particular CPU in
question. A variety of CPUs can note the number of cycles spent waiting
for memory operations, the number of cycles spent executing
instructions, number of cycles halted due to various stalls, etc.

However they're not particularly fine grained measurements, are limited
in number concurrently measurable, and can be somewhat tricky to
interpret at times. 

That said, you could get a reasonable idea, and it could be interesting
to investigate what this sort of feature buys you!

- Danny

Other related posts: