Thanks for the code snippet.. One more question. I
want to load the cpu with x% load & take
measurements. For eg, cpu_burn <x> should load the CPU
with x% occupancy.. Is there a way this could be
done? Any program / pointers greatly appreciated..
Thanks,
IM
--- Mike Galbraith <[email protected]> wrote:
> On Thu, 2006-10-26 at 22:37 -0700, Indian Mogul
> wrote:
>
> > How can I load the CPU such that the scheduling
> time
> > slice is insuffucent for mplayer to playout the
> video?
> > To the mplayer the system thus appears "slow" ?
>
> :) unusual request.
>
> The proglet below, which someone posted a while
> back, should meet your
> needs nicely. Fire up a few copies in the
> background with args like
> 5000 6000 7000 8000 9000.., and mplayer should
> become decidedly unhappy.
>
> The scheduler round robin schedules tasks which it
> has classified as
> interactive (tasks which sleep somewhat regularly
> basically) at a higher
> rate than their timeslice to reduce latency, but the
> more tasks
> circulating at the same priority (or above) as
> mplayer, the bigger the
> latency hit mplayer will take.
>
> -Mike
>
> #include <stdlib.h>
> #include <unistd.h>
>
> static void burn_cpu(unsigned int x)
> {
> static char buf[1024];
> int i;
>
> for (i=0; i < x; ++i)
> buf[i%sizeof(buf)] = (x-i)*3;
> }
>
> int main(int argc, char **argv)
> {
> unsigned long burn;
> if (argc != 2)
> return 1;
> burn = (unsigned long)atoi(argv[1]);
> while(1) {
> burn_cpu(burn*1000);
> usleep(1);
> }
> return 0;
> }
>
>
>
____________________________________________________________________________________
Low, Low, Low Rates! Check out Yahoo! Messenger's cheap PC-to-Phone call rates
(http://voice.yahoo.com)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]