From: Srivatsa Vaddagiri <vatsa@in.ibm.com>
To: "Dmitry Adamushko" <dmitry.adamushko@gmail.com>
Cc: "Ingo Molnar" <mingo@elte.hu>, "Con Kolivas" <kernel@kolivas.org>,
"Mike Galbraith" <efault@gmx.de>,
"Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: Definition of fairness (was Re: [patch] CFS scheduler, -v11)
Date: Thu, 10 May 2007 22:11:58 +0530 [thread overview]
Message-ID: <20070510164158.GB9173@in.ibm.com> (raw)
In-Reply-To: <b647ffbd0705091224m75bf8caawa0019ecfe8bf82e7@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 281 bytes --]
On Wed, May 09, 2007 at 09:24:17PM +0200, Dmitry Adamushko wrote:
> One quick observation.
>
> Isn't it important for both processes to have the same "loops_per_ms" value?
Good catch.
I have modified the testcase based on this observation (using
setitimer).
--
Regards,
vatsa
[-- Attachment #2: cpuhog.c --]
[-- Type: text/plain, Size: 1764 bytes --]
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
volatile int time_elapsed;
int run_length = 52; // in milliseconds
int sleep_length = 24; // in milliseconds
int epoch_time = 5; // in seconds
void alrm_handler(int signo)
{
time_elapsed = 1;
}
main(int argc, char *argv[])
{
double prevusage = 0;
struct itimerval timer;
time_t prevtime;
if (argc > 1) {
run_length = atoi(argv[1]);
if (argc > 2)
sleep_length = atoi(argv[2]);
if (argc > 3)
epoch_time = atoi(argv[3]);
}
signal(SIGVTALRM, alrm_handler);
memset(&timer, 0, sizeof(timer));
timer.it_value.tv_sec = run_length / 1000;
timer.it_value.tv_usec = (run_length % 1000) * 1000;
printf ("run time = %d ms (%d sec + %d usec), sleep time = %d ms,"
" epoch time = %d s\n", run_length, timer.it_value.tv_sec,
timer.it_value.tv_usec, sleep_length, epoch_time);
prevtime = time(NULL);
while (1) {
time_t curtime, deltatime;
struct rusage stats;
int rc;
rc = setitimer(ITIMER_VIRTUAL, &timer, NULL);
if (rc < 0) {
perror("setitimer");
exit(1);
}
time_elapsed = 0;
while (!time_elapsed)
;
usleep(sleep_length * 1000);
curtime = time(NULL);
deltatime = curtime - prevtime;
if (deltatime >= epoch_time) {
double curusage, deltausage;
getrusage(0, &stats);
curusage = stats.ru_utime.tv_sec +
stats.ru_utime.tv_usec * 1e-6 +
stats.ru_stime.tv_sec +
stats.ru_stime.tv_usec * 1e-6;
deltausage = curusage - prevusage;
printf ("Obtained %3.2f seconds of execution time in"
" %d elapsed seconds \n", deltausage, deltatime);
prevtime = curtime;
prevusage = curusage;
}
}
}
next prev parent reply other threads:[~2007-05-10 16:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-08 15:04 [patch] CFS scheduler, -v11 Ingo Molnar
2007-05-09 15:46 ` Kasper Sandberg
2007-05-11 11:07 ` Ingo Molnar
2007-05-09 18:02 ` Definition of fairness (was Re: [patch] CFS scheduler, -v11) Srivatsa Vaddagiri
2007-05-09 19:24 ` Dmitry Adamushko
2007-05-10 16:41 ` Srivatsa Vaddagiri [this message]
2007-05-09 20:24 ` William Lee Irwin III
2007-05-10 17:13 ` Srivatsa Vaddagiri
2007-05-10 18:55 ` William Lee Irwin III
2007-05-10 4:22 ` David Schwartz
2007-05-10 8:51 ` Mike Galbraith
2007-05-10 20:02 ` Ingo Molnar
2007-05-10 19:54 ` Ting Yang
2007-05-10 16:59 ` [patch] CFS scheduler, -v11 Christian
2007-05-10 17:10 ` Kasper Sandberg
2007-05-10 18:51 ` Christian
2007-05-10 19:45 ` Ingo Molnar
2007-05-10 20:05 ` Ingo Molnar
2007-05-11 12:01 ` Christian
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=20070510164158.GB9173@in.ibm.com \
--to=vatsa@in.ibm.com \
--cc=dmitry.adamushko@gmail.com \
--cc=efault@gmx.de \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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