From: Indian Mogul <indian_mogul@yahoo.com>
To: Mike Galbraith <efault@gmx.de>, linux-kernel@vger.kernel.org
Subject: Re: CPU Loading
Date: Fri, 27 Oct 2006 14:36:21 -0700 (PDT) [thread overview]
Message-ID: <20061027213622.89417.qmail@web54511.mail.yahoo.com> (raw)
In-Reply-To: <1161933988.6102.28.camel@Homer.simpson.net>
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 <efault@gmx.de> 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)
prev parent reply other threads:[~2006-10-27 21:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-27 5:37 Indian Mogul
2006-10-27 7:26 ` Mike Galbraith
2006-10-27 21:36 ` Indian Mogul [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061027213622.89417.qmail@web54511.mail.yahoo.com \
--to=indian_mogul@yahoo.com \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome