From: Ingo Molnar <mingo@elte.hu>
To: Serge Noiraud <serge.noiraud@bull.net>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: PREEMPT_RT and latency_trace
Date: Fri, 8 Jul 2005 15:58:28 +0200 [thread overview]
Message-ID: <20050708135828.GA5355@elte.hu> (raw)
In-Reply-To: <1120826951.6225.167.camel@ibiza.btsn.frna.bull.fr>
[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]
* Serge Noiraud <serge.noiraud@bull.net> wrote:
> Hi,
>
> I have a big dilemna on one machine :
> I run a task with RT priority which make a loop to mesure the system
> perturbation.
> It works well except on one machine.
> On a multi-cpu, If I run the program on cpu 1, I get 23us. It's OK.
> If I run the same program on cpu 0, I get 17373us !
> If I do :
> # echo 0 >/proc/sys/kernel/preempt_max_latency
you can start/stop tracing from userspace too. Then you'll see what
happens. See the attached trace-it.c code. After having activated
user-triggered tracing, do something like this in your testcode:
for (;;) {
gettimeofday(0, 1);
gettimeofday(0, 0);
}
this should measure the maximum userspace delay on that CPU. You can
also read the TSC in the inner loop to validate the kernel tracer:
for (;;) {
gettimeofday(0, 1);
t0 = rdtsc();
t1 = rdtsc();
gettimeofday(0, 0);
if (t1-t0 > max)
print_max();
}
(you should not measure the trace start/stop functions themselves, they
can take alot of time when a maximum-latency event happens.)
Ingo
[-- Attachment #2: trace-it.c --]
[-- Type: text/plain, Size: 1183 bytes --]
/*
* Copyright (C) 1999, Ingo Molnar <mingo@redhat.com>
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
#include <linux/unistd.h>
int main (int argc, char **argv)
{
int ret;
if (getuid() != 0) {
fprintf(stderr, "needs to run as root.\n");
exit(1);
}
ret = system("cat /proc/sys/kernel/mcount_enabled >/dev/null 2>/dev/null");
if (ret) {
fprintf(stderr, "CONFIG_LATENCY_TRACING not enabled?\n");
exit(1);
}
system("echo 1 > /proc/sys/kernel/trace_all_cpus");
system("echo 1 > /proc/sys/kernel/trace_enabled");
system("echo 0 > /proc/sys/kernel/trace_freerunning");
system("echo 0 > /proc/sys/kernel/trace_print_at_crash");
system("echo 1 > /proc/sys/kernel/trace_user_triggered");
system("echo 0 > /proc/sys/kernel/trace_verbose");
system("echo 0 > /proc/sys/kernel/preempt_max_latency");
system("echo 0 > /proc/sys/kernel/preempt_thresh");
system("[ -e /proc/sys/kernel/wakeup_timing ] && echo 0 > /proc/sys/kernel/wakeup_timing");
system("echo 1 > /proc/sys/kernel/mcount_enabled");
gettimeofday(0, 1);
usleep(100000);
gettimeofday(0, 0);
system("cat /proc/latency_trace");
return 0;
}
next prev parent reply other threads:[~2005-07-08 13:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-08 12:49 PREEMPT_RT and latency_trace Serge Noiraud
2005-07-08 13:40 ` Daniel Walker
2005-07-08 13:58 ` Ingo Molnar [this message]
2005-07-11 5:03 ` Ingo Molnar
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=20050708135828.GA5355@elte.hu \
--to=mingo@elte.hu \
--cc=linux-kernel@vger.kernel.org \
--cc=serge.noiraud@bull.net \
/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