From: Mike Galbraith <efault@gmx.de>
To: Indian Mogul <indian_mogul@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: CPU Loading
Date: Fri, 27 Oct 2006 07:26:28 +0000 [thread overview]
Message-ID: <1161933988.6102.28.camel@Homer.simpson.net> (raw)
In-Reply-To: <20061027053731.57351.qmail@web54511.mail.yahoo.com>
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;
}
next prev parent reply other threads:[~2006-10-27 6:54 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 [this message]
2006-10-27 21:36 ` Indian Mogul
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=1161933988.6102.28.camel@Homer.simpson.net \
--to=efault@gmx.de \
--cc=indian_mogul@yahoo.com \
--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