Change 9d2c9edd86 introduces
the new option of POSIX timer and makes MODE_CLOCK_NANOSLEEP
the default choice. But there are two places explicitly set
MODE_CLOCK_NANOSLEEP to the variable use_nanosleep in the code,
so the actual value of the variable after parsing depends on
the position of '-x' to '-U' and '-S'.
These command pairs result in different values in the variable:
'cyclictest -S -x' VS 'cyclictest -x -S'
'cyclictest -U -x' VS 'cyclictest -x -U'
This change ensures -x work regardless its position by removing
the two lines in these cases.
Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Most of time having '-M' option causes cyclictest won't exit after
a duration ('-D') expires, like this quick command on my machines:
sudo cyclictest -S -M -D2 -d0
This is because the main thread is blocked on waiting for the next
update of MAX, but the timer thread doesn't signal the main thread
before it quits.
Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
On a numa system we allocate a stack from the closest NUMA node
for each measurement thread. We need to touch those stack pages
to prevent them faulting when first run. Not a big deal on a
system with just a few cores, but overhead adds up with 32+ cores.
Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
It is recommended that clock_nanosleep should be used for real-time
wherever available. So, make sure that cyclictest runs clock_nanosleep
by default. Added an option to run POSIX timers. Removing the '-n'
option because it is redundant now.
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
We haven't tested/supported the old smi_detector module since the 2.6 kernel. Remove support for running it.
Signed-off-by: Clark Williams <williams@redhat.com>
- Fixed minor typo where part of he shebang was removed
Signed-off-by: John Kacur <jkacur@redhat.com>
- modify hwlatdetector.py to detect and use the ftrace hwlatdetector
- rewrite using base class for detector
Big rewrite where we create a base Detector class and use that
as the base class for Tracer and Hwlat classes.
Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
We decided it is more interesting, in our automated tests, to have a
higher tolerance to SMI as most of the test boxes are not optimized for
RT. On the other hand, we would like to know how big are the SMI
latencies on these boxes.
This commit adds the --hardlimit parameter, which defines the real
PASS/FAIL latency criteria. Latencies above --threshold will be
annotated, but the test may PASS if the observed latencies are smaller
than --hardlimit.
When --hardlimit is not informed, the value used for --threshold is also
used as the hard limit.
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
The short option 's' was originally intended to be the short form of
--system
Commit b35bc97cfd
which added the new option --secaligned broke this, by accidently
inserting the new option between the short form and long form.
Reported-by: Daniel Seemer <phaiax-cyclictest@invisibletower.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Fix spelling mistake, "that" should be "than" in the following message
For less that 2ms run times, you need to
have HRTICK enabled in debugfs/sched_features
Signed-off-by: John Kacur <jkacur@redhat.com>
Improve message if max latency is below threshold.
If the maximum latency is below the threshold for reporting, 0us is output.
This is confusing, and not accurate, so print the message "Below threshold"
instead.
Suggested-by: Jiri Kastner <jkastner@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Although the interval code was added the 'i' was missing from the getopt
list, and there was no help text for it either.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
- Add cyclicdeadline and deadline_test to the Makefile
- Conditionally define _GNU_SOURCE in the new programs
- Add the new programs to the .gitignore file
Signed-off-by: John Kacur <jkacur@redhat.com>
Add cyclicdeadline and deadline_test - these are two programs written by
Steven Rostedet to test the functionality and performance of
SCHED_DEADLINE
Signed-off-by: John Kacur <jkacur@redhat.com>
Cyclictest's SMI counter implementation is based on the turbostat
tool in the Linux kernel. This patch syncs cyclictest's has_smi_counter()
with turbostat's check.
From turbostat's commits:
cdc5727 tools/power turbostat: initial KBL support
ec53e59 tools/power turbostat: initial SKX support
e4085d5 tools/power turbostat: initial BXT support
[ John & Clark, I did it in the branch devel/v2.0, but we need ]
[ this in the 0.x and 1.x series as well. ]
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
- smidetect was long ago renamed to hwlatdetct, reflect this in hwlat.txt
- Fix a few spelling mistakes, and add a missing option
Signed-off-by: John Kacur <jkacur@redhat.com>
Fix a number of errors like procesor->processor, specifed->specified and
cylictest->cyclictest.
Note, Uwe Kleine-König <ukleinek@debian.org> pointed out some of these
spelling errors previously.
Signed-off-by: John Kacur <jkacur@redhat.com>
John,
This patch is against the devel/v0.98 branch. It turns off tracing in the tracemark() so that we don't lose information about what was going on when we hit the latency:
The current logic of using --tracemark and --notrace works for running
cyclictest with trace-cmd, but even if we are not doing any trace
manipulation in cyclictest, we still need to stop tracing when we hit a
breaktrace threshold (i.e. -b <n>).
Modify startup logic to hold open file descriptors for the tracemark file
*and* the tracing_on file. When we hit a threshold and call the tracemark()
function, write the marker to the trace buffers and then write a "0\n" to
the tracing_on file to turn off tracing, otherwise we lose the information
immediately prior to the point where we hit the latency.
Signed-off-by: Clark Williams <williams@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
We have done a good job keeping cyclictest help up-to-date, but we have
not been actively updating the man page.
There were many missing options, as well as options that don't exist
anymore. To be more precise, some short form options had been removed,
but there are still corresponding long-version options.
This patch contains a considerable amount of updates to the man-page to
keep it in sync, and in some cases it also updates the cyclictest help
where needed. For example, the cyclictest help options were not always
in the proper order. In some cases I changed the wording to make it more
closely correspond to the man page
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Clark Williams <williams@redhat.com>
The new --tracemark option can be used to run cyclictest under
trace-cmd.
This means we don't want cyclictest's built-in tracing to be used, so
this option is only compatible with --notrace.
Therefore turn --notrace on if --tracemark is invoked even if the user
doesn't explicitly request this.
Signed-off-by: John Kacur <jkacur@redhat.com>
Commit 3290f8412a changed
exit(-1) to exit(1) for many programs in rt-tests for consistency.
rt-migrate-test needs tri-state exit statuses, because of the way
some existing bash scripts consume it's results.
This could no-doubt be improved in the future, and there are some
inconsistencies in the exit statuses in this program alone, but as they
are not urgent to fix, and the current fix makes things worse, reverting
this for now.
Signed-off-by: John Kacur <jkacur@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
cyclictest will only write to /sys/kernel/debug/tracing/trace_maker
if it's also setup to do tracing. This conflicts with
running cyclictest under trace-cmd.
The --tracemark option tells cyclictest to write to the
trace_marker file even when it's not doing tracing.
It can be used like this:
# trace-cmd record [...] cyclictest [...] -bX --tracemark --notrace
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
A function added by a future commit will want to call
this code too.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
If you pass -b and --notrace to cyclictest today, it will
write to tracing_on when -b latency is reached.
Fix this by making tracing() check notrace.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
A function added by the next commit will want to call
this code too.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
The kernel uses only 8 bits of the status as a return
code, so this actually becomes 255 in the shell.
In any case, the most widely convension is exit(1)
for failures, so let's be consistent.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Add the description of the --smi comand line option of cyclictest.
"--smi Enable SMI count/detection on processors with SMI count support."
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Modify the sample reading code to return correct string data and to
catch exceptions in non-blocking mode correctly on python{2,3}
Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Use __future__ import of print_function and make sure all instances
of print are now functions rather than statements.
Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Originally the hwlat_detector was built as only a module and was
controlled by module parameters. The latest version uses debugfs
control files so there is no real need to force it to be a module.
The hwlatdetector script in rt-tests assumes that the hwlat_detector
code was built as a module. This patch adds logic to detect and
handle if hwlat_detector is a builtin.
Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
There was an easily fixed merge conflict in the option_values, using the
conflict as an opportunity to clean this up
Signed-off-by: John Kacur <jkacur@redhat.com>
These could be defined elsewhere, be careful when defining these
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Some buildsystems use androidabe, so an exact match will break in those
circumstances.
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Bionic is the libc implementation used in Android and should not be
confused with the architecture.
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
88af643971 (android: adjust target for android) introduced some really
ugly ifdefs to avoid calling into pthread_barrier_wait and
pthread_barrier_init.
This patch attempts to coalesce this into a single place and let the
compiler handle the linking so that cyclictest.c is untouched by evil
ifdefs.
It also combines NO_PTHREAD_BARRIER and NO_PTHREAD_SETAFFINITY into a
PTHREAD_BIONIC as it does not make much sense to keep them separated.
Compiled and tested on:
- x86_64 (v3.13 kernel)
- tilegx (v3.10 kernel)
- arm64 android (v3.10 kernel)
Note: this includes bionic.h unconditionally, so it makes most sense to
keep bionic.h in src/include/ (and not in src/arch/bionic/).
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Unfortunately c869f3cdcd wasn't sufficient
to fix #ifdef #else functionality for uclib, broken by the changes for
bionic.
In practice this probably didn't break anyone though, except possibly
for the new bionic code which probaly doesn't have too many adapters
(yet).
This should also help Henrik move the NO_PTHREAD_SETAFFINITY functionality to
the bionic file.
Signed-off-by: John Kacur <jkacur@redhat.com>
Create a linked-list of data, including a time stamp, that is
recorded everytime a latency measurement is above a given number (trigger).
This data is printed out at the end of a run. If we have
more spikes than we have allocated nodes in our list for, we stop
recording the data, but keep counting the number of spikes.
This introduces two new long options.
--spike=trigger, where the trigger is given in usec. Any time a
spike > trigger occurs we record the data.
--spike-nodes=num_of_nodes, is the amount of data we can record, the
default is 1024
Here is what a sample run looks like. (non-rt kernel)
su -c './cyclictest -t4 -p99 --spike=30 --duration=60'
Password:
policy: fifo: loadavg: 0.69 0.78 0.60 1/641 6420
T: 0 ( 6385) P:99 I:1000 C: 59996 Min: 2 Act: 2 Avg: 2 Max:
1476
T: 1 ( 6386) P:99 I:1500 C: 39999 Min: 1 Act: 2 Avg: 2 Max:
952
T: 2 ( 6387) P:99 I:2000 C: 29999 Min: 2 Act: 2 Avg: 3 Max:
504
T: 3 ( 6388) P:99 I:2500 C: 23999 Min: 1 Act: 2 Avg: 2 Max:
1423
T: 2 Spike: 504: TS: 490531620
T: 2 Spike: 270: TS: 526847386
T: 2 Spike: 51: TS: 527211167
T: 2 Spike: 44: TS: 528261160
T: 1 Spike: 31: TS: 528952631
T: 2 Spike: 32: TS: 529253148
T: 2 Spike: 52: TS: 529317169
T: 0 Spike: 1444: TS: 530049519
T: 1 Spike: 419: TS: 530049520
T: 0 Spike: 1476: TS: 530318551
T: 1 Spike: 952: TS: 530318553
T: 3 Spike: 1423: TS: 530318551
T: 0 Spike: 972: TS: 531532046
T: 0 Spike: 34: TS: 531987109
spikes = 14
Signed-off-by: John Kacur <jkacur@redhat.com>
- Clean this function up a bit before modifying it
- Don't use assignment in if statements
- Put spaces before open braces and parentheses
- Break lines up where possible that go over 80 chars
Signed-off-by: John Kacur <jkacur@redhat.com>
This was mistakenly included in the #ifdef in 88af643971 (android:
adjust target for android). Moved back into the correct #ifdef-entry.
Cc: Clark Williams <williams@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: Henrik Austad <haustad@cisco.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
- Make the Makefile more readable by moving android functionality to it's
own Makefile.
- Don't evaluate TARGETS until after including arch Makefiles
Signed-off-by: John Kacur <jkacur@redhat.com>
Tested-by: Henrik Austad <haustad@cisco.com>
- Add a man page to signaltest
- Improve the display_help in signaltest
- Add install of new man page to makefile
Signed-off-by: John Kacur <jkacur@redhat.com>
Although we have less strict rules than the linux kernel
some of the checkpatch complaints really do make the files better and
easier to read. Fix a few of these.
Signed-off-by: John Kacur <jkacur@redhat.com>
Call process_options beforeing checking priviledges so that
process_options can display help for a normal user as designed.
This was already fixed in cyclictest. I also tested everywhere else to
make sure this is now fixed everywhere.
I fixed some small white spaces problems at the same time.
Signed-off-by: John Kacur <jkacur@redhat.com>
Bionic (Android's libc implementation) lacks support for (amongst other
things) pthread_barriers and pthread_setaffinity. The former is removed
by ifdeffery, the latter is added as a per-android wrapper to
sched_setaffinity.
Signed-off-by: Henrik Austad <haustad@cisco.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
On Wed, Sep 16, 2015 at 01:05:51AM +0200, John Kacur wrote:
> On Mon, 31 Aug 2015, Josh Cartwright wrote:
> > From: Gratian Crisan <gratian.crisan@ni.com>
> >
> > Add an option '-J' or '--histfile' to dump the latency histogram to <path>
> > instead of stdout. This allows for live update of the current min, avg, and max
> > numbers while retaining the option to save histogram data for later analysis.
> >
> > Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
> > Signed-off-by: Josh Cartwright <joshc@ni.com>
[..]
>
> We worked really hard to remove the large amount of options, and we may
> have been over zealous in some cases (Carsten?).
Fair enough, cyclictest has way too many knobs. Regardless, we've at
least found this particular option useful.
> If I were to accept this patch, I would at least like you to remove
> the short form option, and just have it in the long form.
Here is a v2 with the short form -J dropped.
Thanks,
Josh
-- 8< --
From: Gratian Crisan <gratian.crisan@ni.com>
Subject: [PATCH v2] cyclictest: add option for dumping the histogram in a file
Add an option '--histfile' to dump the latency histogram to <path>
instead of stdout. This allows for live update of the current min, avg,
and max numbers while retaining the option to save histogram data for
later analysis.
Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Josh Cartwright <joshc@ni.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
These functions never return to their caller. Mark them as such to aide
in code generation and help out static analysis.
Signed-off-by: Josh Cartwright <joshc@ni.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
The fifothread is only created when use_fifo is set; having the thread
itself perform a check is redundant and unnecessary. Drop it.
Signed-off-by: Josh Cartwright <joshc@ni.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
On any sane platform sizeof(long) == sizeof(unsigned long), so this
does not actually fix a real bug, but the code should at least be
consistent.
Signed-off-by: Josh Cartwright <joshc@ni.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
We don't support building without numa libs anymore, although we of
course support running on machines without numa. Never-the-less I
created two versions of numa_on_and_available, one for if you build with
the unsupported NUMA=0 and one for if you build with NUMA=1, which is
the default.
I would prefer not to drop this function, since I think it cleanly
documents the fact that numa_available must be called before any other
numa library functions are defined.
As Josh Cartwright reported though, there was no need to call it from
main() since it was already tested in process_options(), so I tested it
there.
Tested by building with NUMA=0, NUMA=1 and with the non-standard
-Wimplicit-function-declaration
Reported-by: Josh Cartwright <joshc@ni.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Most functions in cyclictest were already 'static', with a few
exceptions. Fixup those exceptions, in the interest of consistency,
optimization, etc.
Signed-off-by: Josh Cartwright <joshc@ni.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
The childinfo_t union shares the 'long long error' member with a
'pthread_t threadid'. For a "sufficiently large" threadid, it's
possible that the error condition is incorrectly hit even though a valid
thread was created.
Stop conflating the error condition with legitimate thread/process
identifiers by modifying create_worker to explicitly return an error
code.
Inspired by a patch in OpenEmbedded authored by Song Li and Jesse Zhang.
Cc: Song.Li <Song.Li@windriver.com>
Cc: Jesse Zhang <sen.zhang@windriver.com>
Signed-off-by: Josh Cartwright <joshc@ni.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Put Back #ifndef _GNU_SOURCE
We define _GNU_SOURCE in our Makefile. I don't mind having it a second
time as documentation in the files, but we need to have the #ifdef to
prevent the compiler warning about it being redfined
Signed-off-by: John Kacur <jkacur@redhat.com>
- Change VERSION_STRING to VERSION to get the same version number as the
the rest of the suite
- Assume that VERSION is defined, instead of replacing it with a
nonsensical number
- Print the help option in the usage() function
Reported-by: DIXLOR <dixlor@gmail.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
The help text shows prio as the long option name for the process priority.
But it is actually priority.
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Adding _STRING doesn't add any extra meaning, but the extra length makes
the Makefile more unreadable than is necessary, so shorten this up
Signed-off-by: John Kacur <jkacur@redhat.com>
Coverage tools indicate that there are two spots where the function
low_priority() could exit without releasing the mutex.
Since the only error that pthread_barrier_wait is supposed to give is
EINVAL when the barrier is not an initialized barrier object, the
chances of this happinning seem remote. However, if we are going to
test for the error and potentially exit, then we should release the
mutex too.
Signed-off-by: John Kacur <jkacur@redhat.com>
cyclictest: Align measurement threads to the next full second
cyclictest starts the test threads at a random point in time. For
fully reproducible tests it is required to schedule the threads with a
specified offset from the timer tick. The influence of the tick can be
measured by running the test with offset = 0 and offset =
tickinterval/2.
To achieve this we rely on the fact, that the kernel starts the tick
at CLOCK_MONOTONIC time 0. So it's guaranteed that the tick timer
expires always every second (if the interval between the ticks defined
by CONFIG_HZ is a whole-number divider of a second). Setting the
global start time of the test threads to a full second (plus offset)
and the interval to the interval between the ticks, the threads are
scheduled with the specified offset to the tick.
Add a new option --secaligned which select this mode and modify the
--aligned option code to support this. The --secaligned and --aligned
options are mutually exclusive.
Signed-off-by Anna-Maria Gleixner <anna-maria@glx-um.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
The offset is specified in microseconds according to the
documentation, but, the microseconds to nanoseconds conversion is
missing so the effective offset has the unit of nanoseconds.
Signed-off-by: Anna-Maria Gleixner <anna-maria@glx-um.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
The calculated next wakeup time is already in the past, if the latency
is longer than the interval. Thereby latency is detected that does not
correspond to latency caused by the system but by cyclictest itself.
Force forward the next wakeup time past now.
Signed-off-by: Anna-Maria Gleixner <anna-maria@glx-um.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Teach cyclictest to recognize the major version 4 which we do have now.
Featurewise it should behave like the 3.0 series
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Change "quick" to quicker, so the help message reads
-c --check Stop if lower prio task is quicker than
higher (off)
Signed-off-by: John Kacur <jkacur@redhat.com>
Deadline tasks are not allowed to set smp affinity.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Having the date and time of compilation is hardly useful and is in the
way for reproducible building binaries.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
Make sure we get a value between 1 and 99 for --prio. Also change
print for invalid --loops from Warning to Error (if we call exit
then it's an error).
Signed-off-by: Clark Williams <williams@redhat.com>
The input parameters for run_interval and interval are specified on the
command line as millisecond values. Convert these to nanosecond values
before we use them.
Signed-off-by: Clark Williams <williams@redhat.com>
By default, static variables run_interval and interval assigned to
macros with corresponding uppercase name, RUN_INTERVAL and INTERVAL.
Later in code we should only use these variables to properly handle
options passed by user.
Signed-off-by: Boris Egorov <egorov@linux.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Program will crash if nr_runs is 0 due to dividing by it in
print_results(). Let's exit early instead.
Fixes: http://bugs.debian.org/716237
Signed-off-by: Boris Egorov <egorov@linux.com>
Signed-off-by: Clark Williams <williams@redhat.com>
ARM platforms have timing issues with pip_stress:
Hello,
pip_stress works out of the box on my x86 based laptop, but
doesn't work on ARM devices, returned 'no inversion incurred'.
Follow the comment to increase usleep value, 2500 worked for
pandaboard and 3000 worked for Beaglebone Black board.
I propose that increase the usleep value to 3500 from upstream,
so that we can use pip_stress right out of the box.
Rather than hardcode the usleep value used by pip_stress, I made
the command line option --usleep which takes a microsecond value
that defaults to 500us.
Reported-by: Chase Qi <chase.qi@linaro.org>
Signed-off-by: Clark Williams <clark.williams@gmail.com>
Currently, the scheduling class is configured on a global
level. It is possible to run the test either with SCHED_FIFO
or SCHED_RR. All threads run then with the same configuration
except sched_priority is different.
By storing the scheduling attributes per thread we will be able
to use different scheduler classes at the same time. The aim is
to use SCHED_DEADLINE for the high priority thread.
First thing to get there is to introduce low_sa, med_sa, high_sa
and admin_sa. They are configured using the global policy variable
on default. Either using SCHED_FIFO or SCHED_RR. The user
can though use --sched command line options to configure each
thread seperately. E.g.
Starting PI Stress Test
Number of thread groups: 1
Duration of test run: infinite
Number of inversions per group: unlimited
Admin thread SCHED_FIFO priority 4
1 groups of 3 threads will be created
High thread SCHED_DEADLINE runtime 100000 deadline 200000 period 200000
Med thread SCHED_FIFO priority 2
Low thread SCHED_FIFO priority 1
Current Inversions: 2446249
Stopping test
Terminated
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Until we have a proper libc implementation we maintain a simple
version of it. We this new API we are able to use SCHED_DEADLINE.
This is shamelessly stolen from Dario Faggioli's libdl.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Dario Faggioli <raistlin@linux.it>
In order to be able to use some of the rt-utils.h function we need
to get rid of our own info() & friends implementation.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
When I boot my 8 core i7 laptop with the maxcpus=4 kernel boot flag,
cyclictest -S runs 8 threads. This patch makes it only use the number
of online cpus instead.
Signed-off-by: Joakim Hernberg <jhernberg@alchemy.lu>
Signed-off-by: John Kacur <jkacur@redhat.com>
Some people running cyclictest on laptops don't want to automatically
take advantage of the trick that prevents the power management to
transistion to high cstates, since it eats up their battery power.
Allow them to suppress this feature with --laptop
This will result in power latency results of course.
Feature-requested-by: Joakim Hernberg <jhernberg@alchemy.lu>
Signed-off-by: John Kacur <jkacur@redhat.com>
At some point in the history of cyclictest, a number of short options
were removed and changed to long only options. However the display_help
was not updated to reflect this and indicates short options that
no longer exist. Fix this. I also found a long option that wasn't listed
at all and added that.
Signed-off-by: John Kacur <jkacur@redhat.com>
cyclictest can be run from other tools such as rteval
in order to get current status on long runs, SIGUSR1 is sent to
cyclictest and caught by function sighand()
This creates difficulties for rteval when parsing cyclictest output, so
change the output to stderr.
Note, a RFC was sent out on Apr.15 2014 entitled
"RFC: SIGUSR1 to stderr"
to: RT <linux-rt-users@vger.kernel.org>
cc: Carsten Emde <C.Emde@osadl.org>,
Thomas Gleixner <tglx@linutronix.de>,
Clark Williams <williams@redhat.com>
Since I didn't receive any replies, I'm assumin there are no objections
Signed-off-by: John Kacur <jkacur@redhat.com>
In set_latency_target() there are some paths that don't print an error
message even when a write of 0 to /dev/cpu_dma_latency fails.
This patch does the following
- always print an error message if the write to /dev/cpu_dma_latency
fails
- Fix the error check with the write call. (a return of 0 or -1 indicate
problems
- rename ret to err since this function is void and returns no value
- use err_msg_n instead of printf (which also prints to stderr)
Signed-off-by: John Kacur <jkacur@redhat.com>
In rt-tests we try to use const where appropriate for read-only, but
we need to tell the compiler we are intentionally discarding const
when calling library functions that expect char *
Signed-off-by: John Kacur <jkacur@redhat.com>
Ran 2to3 on hwlatdetect.py and checked in the result. Tested
on F20 system running 3.12.14-rt23 with both python2 and python3.
Signed-off-by: Clark Williams <clark.williams@gmail.com>
on ARM I'm seeing output like:
cyclicte-623 0....... 19619418us+: tracing_mark_write: hit latency threshold (2000 > 2097)
That's because of a format mismatch in
tracemark("hit latency threshold (%d > %d)", diff, tracelimit);
diff is a u64 and tracelimit an int. So on ARM the string is passed in r0,
tracelimit in r1 and diff in r2+r3. vsnprintf used in tracemark only
expects two ints passed and so only uses r1 and r2 yielding the permutation
in the output.
This patch also adds a gcc attribute to tracemark that helps catching
similar bugs. In this case just adding the attribute but not touching
the call site, would result in:
src/cyclictest/cyclictest.c: In function ‘timerthread’:
src/cyclictest/cyclictest.c:899:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘uint64_t’ [-Wformat]
---
Hello
after some chatting with Clark and John I dropped the c99 stuff and added the
attribute annotation.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Clark Williams <clark.williams@gmail.com>
Hello,
While playing around with hackbench I discovered that I would sometimes
get an enormous time reported, even if the run time would be less than a
second or so. The problem was that the struct timeval start was not
initialized until after all children have been created. But if the
program receives a signal before this is done, the start time is left
uninitialized.
I propose that in such situations an error message be displayed, like
the following patch does.
Please let me know if this is acceptable.
Regards,
/Ciprian
Signed-off-by: Clark Williams <williams@redhat.com>
e.g.
cyclictest -a4,6-8 -t5
will use 5 threads, assigned round-robin to the set of CPUs {4,6,7,8}.
CPU 4 will get threads 1 and 5, CPU 6 gets thread 2, CPU 7 gets thread 3, and
CPU 8 gets thread 4.
As explained in the updated manpage, libnuma >= v2 is required for these
arbitrary CPU sets. With libnuma v1, the -a option behaves as before. As
before, compiling without libnuma is supported. The command usage help is fixed
up at compile time to always show the correct usage of the -a option.
Also note that, since numa_parse_cpustring_all() wasn't available in early
libnuma v2 versions, we use numa_parse_cpustring(). This means you'll have to
use taskset in some cases (isolcpus kernel parameter) to add the desired CPUs to
the set of allowed cores, e.g.:
taskset -c4-6 cyclictest -a4-6
Tested with out libnuma (numactl), and with versions 1.0.2 and 2.0.9-rc3.
Signed-off-by: Aaron Fabbri <ajfabbri@gmail.com>
(cherry picked from commit 5375ab86e77881d8043e5e309bb8daf5a84cc05f)
Signed-off-by: Clark Williams <clark.williams@gmail.com>
These changes make the align option truly optional as claimed.
1. Rename disaligned to offset for readability.
2. Fix the aligned option so that if no optional argument is given,
the offset defaults to 0
3. Fix some white space problems as reported by checkpatch.pl in the kernel
Signed-off-by: John Kacur <jkacur@redhat.com>
This patch provides and additional -A/--align flag to cyclictest to align
thread wakeup times of all threads as closly defined as possible.
When running multiple threads in cyclictest (-S or -t # option) the threads
are launched in an unsynchronized manner. Basically the creation order and
time for thread creation determines the start time. For provoking a maximum
congestion situation (e.g. cache evictions) and to improve reproducibility
or run conditions the start time should be defined distances appart. The
well defined distance is implemented as a offset parameter to -A/--align
and will offset each threads start time by the parameter * the sequentially
assigned thread number (par->tnum), together with the -d0 (distance in the
intervals of the individual threads) this alignment option allows to get
the thread wakeup times as closely synchronized as possible.
The method to sync is simply that the thread with par->tnum == 0 is chosen
to set a globally shared timestamp, and all other threads use this timestamp
as their starting time rather than each calling clock_gettime() at startup.
To ensure synchronization of the thread startup the setting of the global
time is guarded by pthread_barriers.
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Reviewed-by: Andreas Platschek <andreas.platschek@opentech.at>
Signed-off-by: Clark Williams <clark.williams@gmail.com>
Change return value from option parsing to be enumerated type
rather than a character. Hopefully this will clean up the option
handling a bit and not confuse me when I come back to add yet
another option to cyclictest.
Signed-off-by: Clark Williams <clark.williams@gmail.com>
Commit ad27df7 ("Reimplement better child tracking and improve error
handling") changed the way of reporting pid/error after creating a
child. It will return an union which is a mix pid_t, pthread_t and a
signed long long for errors.
Now on 32bit x86 both pid_t and pthread_t are four byte in size and are
stored in the first 4 bytes. Now if the most significant bit of the long
long variable happens to be set by chance (because nobody really
initializes the variable here) then error variable will be negative. On
little endian machines the assignment of pid or threadid won't reset the
sign bit and you see this:
| Running in process mode with 10 groups using 40 file descriptors each (== 400 tasks)
| Each sender will pass 100 messages of 100 bytes
| 0 children started. Expected 40
| sending SIGTERM to all child processes
| signaling 0 worker threads to terminate
| Creating workers (error: Success)
A machine with proper endian handlig (that is big endian) would reset
the sign bit during the assignment of pid and I would not have to make
this patch :)
While here, I make create_worker() since it is not used outside of this
file.
Cc: David Sommerseth <davids@redhat.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Clark Williams <clark.williams@gmail.com>
Add the --notrace/-A option, intended to be used in conjunction
with the -b option. This will cause cyclictest to exit when a
threshold is hit, but will not perform any tracing operations,
allowing more sophisticated tracing to be done externally.
Signed-off-by: Clark Williams <clark.williams@gmail.com>
This code adds the -F/--fifo option to cyclictest. Using the
--fifo <path> option will cause cyclictest to create a named
fifo at <path> and will dump the current run statistics to that
fifo when it is opened an read.
Signed-off-by: Clark Williams <clark.williams@gmail.com>
Huge latencies are observed (close to 1 second) when certain
options are used in cyclictest.
The problem was 1st introduced at commit da4956cbca
("use interval on first loop instead of 1 second"). It removed
the 1 second first timing loop out of the main path in cyclictest
but left it in two other paths, namely the ones triggered by
these two options:
-r --relative use relative timer instead of absolute
-s --system use sys_nanosleep and sys_setitimer
which in turn causes the huge latencies of close to 1 second to
be reported by cyclictest with certain uses of those two options.
Here we extend the original commit to remove the 1 second
hardcoded timer values from the RELTIME and ITIMER options, by
simply using the actual interval provided instead.
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Cc: Clark Williams <williams@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Clean up cyclictest formatting:
Change leading spaces to tabs.
Align function parameters.
Place type of function on same line as function name.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
V3: Use src/lib/error.c functions instead of fprintf.
Fix printf format warnings for 32 bit vs 64 bit systems with cast.
One issue with using warn() and info() instead of fprintf is that
the compiler no longer warns about format mismatches.
Fix bad continuation line white space prefix.
Remove unused variable zero_diff.
cyclictest: ARM panda clock resolution will be ~30 usec unless
CONFIG_OMAP_32K_TIMER=n, resulting in a poor latency report.
This patch does _not_ fix the problem, it merely provides the
instrumentation to make it visible. The value of measured
resolution is useful information for any system.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
- Fixed up minor white space problem.
Signed-off-by: John Kacur <jkacur@redhat.com>
V3: unchanged from V2
cyclictest getopt_long() parameter clean up.
Clean up before following patch which will add a new option.
Some elements of long_options were not in alphabetical order.
Some elements of optstring were not in alphabetical order.
'-e', '--latency' was missing help text
short form of --duration ('D') was missing from optstring
Change a few instances of leading spaces to tabs.
Add white space to long_options to improve readability.
Some cases of the switch processing the result of
getopt_long() were not in alphabetical order.
Did _not_ clean up option value parsing and processing.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Conflicts:
src/cyclictest/cyclictest.c
Discovered while compiling with "hardening flags"
For Debian 7.0 (aka wheezy) packages it's recommended to use several
hardening flags, the default on amd64 being:
CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-z,relro
This patch doesn't fix all warnings but at least makes all programs compile
again by not using char *variables as printf format strings.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Add back call to the tracemark function but only if we're
using the breaktrace option and only when we actually hit
the breaktrace threshold.
Signed-off-by: Clark Williams <williams@redhat.com>
Currently if a non-root user requests a priority higher than the soft limit in
/etc/security/limits.conf
the call to sched_setscheduler will silently fail and the user will be running
with priority of 0. Cyclictest will not complain, and display the
requested priority resulting in seemingly poor results.
The following patch fixes this by doing two things.
1. If the requested priority is higher than the soft limit but lower than the
hard limit, it will raise the soft limit to the requested priority.
2. If the requested priority is higher than the hard limit, it will fail with a
warning.
The patch should not affect privileged users.
Reported-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Clark Williams <williams@redhat.com>
V2: use type casting instead of ugly constant in format string
Fix printf format string to fix compile warning for ARM 32 bit target.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: Clark Williams <williams@redhat.com>
When the --verbose option is selected, the first value for each thread is
incorrectly reported as zero.
This is because when collecting the first value, the index into stat->values is
incremented from zero to one before storing the value. But when printing the
values, the first value printed is stat->values[0], which has been initialized
to zero.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: Clark Williams <williams@redhat.com>
The '-a' option is always ignored if --smp or --numa is specified. Fix the
warning message to not depend on --smp or --numa occuring first.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Tested-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Avoid annoying warning message when tracing is not requested and the debug
file system is not available.
The same test already protects against calling event_enable_all().
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Clark Williams <williams@redhat.com>
This fixes a segfault on ARM when the '-a' option is used.
man sched_setaffinity says to use pthread_setaffinity_np() when using the
POSIX threads API.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Tested-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Start of an ongoing process to have error strategy where return is
checked and if error, exit with appropriate status.
Signed-off-by: Clark Williams <williams@redhat.com>
Check the status of sched_getaffinity and exit upon error.
CPU_ISSET only checks whether a cpu is in a mask, and not whether the
mask is valid. Checking the status ensures we aren't working with garbage
values.
This also removes the warning from gcc about the status variable being unused
as reported by Darren Hart.
Reported-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
The rt-migrate-test in the rt-tests is still using the old logdev
interface that requires the logdev patch. Ftrace has been introduced
into mainline Linux since 2.6.27 and has many more features than logdev.
The rt-migrate-test should interact with ftrace instead of logdev.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
HI !
minor bug in cyclictest but potential causing confusion on cyclictest
resuults when running as non-root user.
Setup:
if one sets the rtprio in /etc/security/limits.conf to something below
prio max - like:
@hofrat hard rtprio 10
@hofrat soft rtprio 10
but then starts cylictest with -p 80 cyclictest will not fuss and also
display priority 80 (as it uses par->prio in print_stat) but effectively
runs with prio 0 as the return value of sched_setscheduler is not being
checked in timerthread), resulting in semingly bad scheduling jitter values.
So maybe cyclictest should take the effective maximum schduling priority
of the user and not the scheduling policy maximum. Not sur if the check
in timerthread is actually really needed - but it should not hurt ither.
patch below (against current git) at "works for me" quality.
thx!
hofrat
Changed function name to set_latency_target() and added a
command line argument to allow passing in values other than
the default of zero microseconds.
Signed-off-by: Clark Williams <williams@redhat.com>
Use the /dev/cpu_dma_latency power management interface to hold the
system in idle=poll state while cyclictest is running. Look in the
kernel documenation: Documentation/power/pm_qos_interface.txt for
more information.
Signed-off-by: Clark Williams <williams@redhat.com>
added a signal_worker routine to send individual SIGTERM's to
worker threads (since sending via pid=0 seems to have issues).
Also added the -F/--fifo option to change the main thread to a
SCHED_FIFO realtime thread after creating the workers. This will
allow the mangagement thread to run when there are tons of workers.
Signed-off-by: Clark Williams <williams@redhat.com>
Modify signal handling logic so main can't receive sigterm when
reaping children
Also added THREAD_MODE and PROCESS_MODE defines to use rather than
bare constants 0 and 1.
Signed-off-by: Clark Williams <williams@redhat.com>
Before trying to parse /proc/mount, check for existance of directories
/sys/kernel/debug/tracing and /debug/tracing using stat(2).
Signed-off-by: Clark Williams <williams@redhat.com>
Only turn on ftrace_enabled if we're doing tracing that requires
the function tracer. Don't turn it on for event-based tracing. Also,
turn it off a the end of a run.
Signed-off-by: Clark Williams <williams@redhat.com>
If the tracemark_fd is >= 0, then we know we can write to the
trace_marker file. We only need to check that and not version of
the kernel or anything else at every instance of calling tracemark().
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
The -b argument is for stopping the cyclictest when it misses a wakup
by that # microseconds. Setting the tracing_thresh causes the latency tracer
to ignore any latency under tracing_thresh. These two meanings are completely
agnostic to each other, and should not be the same. We want the max latency,
that should be good enough. Not only those that are bigger than our missed
deadline. That misses most of our traces that we want.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-B is used to enable preemptirqsoff, but it also makes sense that one
could use both -I and -P together for the same thing.
Also rename the enum IRQPREEMPTOFF TO PREEMPTIRQSOFF to match the
tracer it represents and avoid confusion.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Events are available for all tracers, including function and latency
tracers. Do not treat them as a tracer. The -E option is agnostic to
the tracer options, and if it is set, then events will be enabled for
any tracer that is also set. If it is set by itself, then events will
be enabled with the nop tracer.
Also, the nop tracer is set before setting any of the tracers. This
makes the nop tracer the default as well as clears out the trace before
running the test.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
strncat writes up to n+1 chars when n is passed as 3rd argument. So when
doing
strncpy(filename, fileprefix, sizeof(filename));
strncat(filename, name, sizeof(filename) - strlen(fileprefix));
with strlen(fileprefix) + strlen(name) >= sizeof(filename) a buffer
overflow occurs. Addionally there is no check if filename is big enough.
So convert to memcpy and handle filename not being big enough.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
reworked the kernel versioning logic to handle the 3.0 kernel
and update the ftrace logic to deal with changes to the
debugfs tracing directory.
Signed-off-by: Clark Williams <williams@redhat.com>
Use setjmp/longjump to get the parent process back out of processing
loop and into forced kill mode for the child processes/threads.
Added function reset_worker_signals() so that workers (sender and
receiver) don't try to reap as well.
Signed-off-by: Clark Williams <williams@redhat.com>
When we try to run ftrace with cyclictest command of rt-test,
We view the error according to different kernel version.
We need to modify this hard coded interface.
* Directory name of each kernel version
2.6.24.7-rt23 /sys/kernel/debug/tracing/latency_hist/wakeup_latency/reset
2.6.31-rc9-rt9.1 /sys/kernel/debug/tracing/latency_hist/wakeup/reset
2.6.33.7.2-rt30 /sys/kernel/debug/tracing/latency_hist/wakeup/reset
* parsing verification: ./linux-2.6/scripts/checkpatch.pl --> OK
Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
Reviewed-by: John Kacur <jkacur@redhat.com>
Reviewed-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Clark Williams <williams@redhat.com>
To compare histograms of several SMP machines or to gain an
overview when cyclictest is running more than a single thread,
an overall histogram is required that contains a summary of
the individual thread latencies.
This patch adds this functionality and introduces the new
option -H/--histofall for this purpose.
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Clark Williams <williams@redhat.com>
Change type of faux sched_setaffinity to match headers.
Also add additional report info when dumping histogram.
Signed-off-by: Clark Williams <williams@redhat.com>
- don't rely on non-standard envvar PWD, use make's CURDIR instead
- allow overwriting KERNELDIR
- less repetition by conflating targets
- explicitly differentiate between kbuild and ordinary make part
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cleanup spurred by need to make the 'diff' variable in timerthread() to
be unsigned and 64-bits (rather than a signed 32-bit).
Signed-off-by: Clark Williams <williams@redhat.com>
Documented the --numa mode option to cyclictest in the man page.
Also updated the command summary to include the short options for
the --smp and --numa modes (-S and -U).
Signed-off-by: Clark Williams <williams@redhat.com>
When using a POSIX interval timer and an overrun occurs, a signal is always
lost. From then on cyclictest would report all measurements as increased by
N*period (where N is the number of overruns).
cyclictest can detect the overruns and adjust the expected time of the next
tick accordingly.
Reported-by: Marti Raudsepp <marti@juffo.org>
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: Clark Williams <williams@redhat.com>
After much thought, I decided to keep cyclictest's default scheduling
policy as SCHED_OTHER. My rationale is that if you don't specify a
priority on the command line you get the priorityless policy. If you
do specify a priority but no specific RT policy, we'll default to
SCHED_FIFO. So to get SCHED_RR you have to specify priorty and policy
name, for example:
# cyclictest --priority=90 --policy=rr
Yes, I realize that the vast majority of users will run it with a
realtime priority, but I just don't like picking a priority if it
wasn't specified. If you want a realtime policy, specify a priority.
Signed-off-by: Clark Williams <williams@redhat.com>
The call numa_node_to_cpus() in rt_numa_numa_node_of_cpu()
was failing because the cpumask buffer size was only 16 bytes
and it seems to require 32. Change the declaration to be 256
just for paranoia's sake.
Signed-off-by: Clark Williams <williams@redhat.com>
Since it's doing relative time sleeps probably not an issue, but
move to clock_nanosleep(CLOCK_MONOTONIC, 0,...) to be clear.
Signed-off-by: Clark Williams <williams@redhat.com>
This patch adds the program pmqtest to the rt-tests suite.
The test mechanism is the same as in ptsematest, svsematest
and friends, but it uses message queues to synchronize the
test threads. To test the - now hopefully fixed - kernel
problem that occurred when a timeout was specified, the
-T option is available.
On an 8-way machine, the test result may look like:
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Clark Williams <williams@redhat.com>
Somewhere between 2.6.24 and 2.6.33, the tracing_on field was
added to the debugfs tracing dir. If it exists use it to turn
tracing on and off; if not use tracing_enabled.
Signed-off-by: Clark Williams <williams@redhat.com>
Change enable/disable file to be tracing/tracing_on; enable the
options/latency-trace format for function tracing; add tracetype
CUSTOM for use with the -T/--tracer option.
Signed-off-by: Clark Williams <williams@redhat.com>
Add SMP testing option (-S, --smp) to svsematest, same as in
cyclictest.
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Acked-by: John Kacur <jkacur@redhat.com>
Add SMP testing option (-S, --smp) to ptsematest, same as in
cyclictest.
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Acked-by: John Kacur <jkacur@redhat.com>
The help message of cyclictest's -S option says that it equals -a -t -n -m -d0.
In reality, it only equals -a -t -n.
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Acked-by: John Kacur <jkacur@redhat.com>
If the policy is forced to SCHED_OTHER, since the priority no longer
fits into the SCHED_FIFO or SCHED_RR range, the policy display of
cyclictest is somewhat incorrect.
Display all policies.
Also make the variable policystr static; the condition
"if (!policystr)" is useless, otherwise.
In addition, place the priority logic before decrementing the priority;
a priority of 1 is incorrectly made SCHED_OTHER, otherwise.
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Acked-by: John Kacur <jkacur@redhat.com>
- Use symbolic names for scheduling policies, that is, don't assume
SCHED_RR is 2, use SCHED_RR instead, and so on.
- Fix the logic in handlepolicy(char *polname)
- remove the test with the unreachable line,
- make the default SCHED_FIFO if we don't recognize the
requested policy.
Signed-off-by: John Kacur <jkacur@redhat.com>
This reverts commit 582be2a52c.
Unfortunately this commit introduces a bug because the priority is not
retested, and this can result in reported priorities below 0.
For example,
sudo ./cyclictest -t3 -p1
policy: fifo: loadavg: 0.09 0.06 0.05 1/331 21732
T: 0 (21730) P: 1 I:1000 C: 593 Min: 34 Act: 155 Avg: 100 Max: 672
T: 1 (21731) P: 0 I:1500 C: 395 Min: 15 Act: 43 Avg: 72 Max: 853
T: 2 (21732) P:-1 I:2000 C: 297 Min: 21 Act: 57 Avg: 79 Max: 330
Notice that the last priority is reported as -1.
After reverting this commit, we get the correct expected behaviour.
sudo ./cyclictest -t3 -p1
policy: fifo: loadavg: 0.07 0.05 0.04 2/330 21754
T: 0 (21752) P: 1 I:1000 C: 11600 Min: 13 Act: 7072 Avg: 3593 Max: 7841
T: 1 (21753) P: 0 I:1500 C: 7737 Min: 12 Act: 1572 Avg: 516 Max: 2381
T: 2 (21754) P: 0 I:2000 C: 5804 Min: 12 Act: 53 Avg: 59 Max: 548
I think it can be argued that the original code is also clearer, although
that is somewhat subjective. With the original code I don't need to track
down exactly what "sameprio" means, and it is clear what is being tested.
Signed-off-by: John Kacur <jkacur@redhat.com>
The command name is already taken by a perl script working with CPAN
and a Python package installer.
While at it remove trailing whitespace from three lines in
src/pi_tests/pip_stress.c.
Closes: http://bugs.debian.org/572104
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Improved argument/option handling by using getopt_long(). Made more of the
parameters tunable as well. Hackbench now accepts the following arguments:
-P | --pipe Use pipe
-s | --datasize Number of bytes to pass from sender to receiver
(default 100 bytes)
-l | --loops Number of messages each sender will send
(default 100 rounds)
-g | --groups Number of groups with sender/receivers
(default 10 groups)
-f | --fds Number of file descriptors each group will use
(default 20*2)
-T | --threads Run using pthreads
-P | --process Run using fork()
Signed-off-by: David Sommerseth <davids@redhat.com>
This does much what earlier commits did before hackbench got updated
to the latest version in the previous commit.
Consider the following commits being "forward ported", feature wise:
4c39eff2130a72fcaadefbd80c495bbd588c92b8
Signed-off-by: David Sommerseth <davids@redhat.com>
Improved argument/option handling by using getopt_long(). Made more of the
parameters tunable as well. Hackbench now accepts the following arguments:
-P | --pipe Use pipe
-s | --datasize Number of bytes to pass from sender to receiver
(default 100 bytes)
-l | --loops Number of messages each sender will send
(default 100 rounds)
-g | --groups Number of groups with sender/receivers
(default 10 groups)
-f | --fds Number of file descriptors each group will use
(default 20*2)
-T | --threads Run using pthreads
-P | --process Run using fork()
Signed-off-by: David Sommerseth <davids@redhat.com>
This does much what earlier commits did before hackbench got updated
to the latest version in the previous commit.
Consider the following commits being "forward ported", feature wise:
4c39eff2130a72fcaadefbd80c495bbd588c92b8
Signed-off-by: David Sommerseth <davids@redhat.com>
Valgrind complained about usage of non-initialised data. The compiler
complained about the out_fds argument being unsigned int when calling
sender().
Signed-off-by: David Sommerseth <davids@redhat.com>
Instead of just exiting immediately the original version did, we now
count how many children who failed to exit properly and report it.
Signed-off-by: David Sommerseth <davids@redhat.com>
In commit 4c39eff213 a new approach for tracking
each child was implemented. But this implementation ignored the fact that each
group() call creates 2*num_fds children.
This patch refactors the previous attempt and will now track absolutely all
children. If fork() fails when called in group(), all spawned children will
now also be killed explicitly.
Signed-off-by: David Sommerseth <davids@redhat.com>
Quite often it's experienced in rteval that hackbench leaves some children
as zombies during closure. This is an attempt to keep an overview of the
status of each child separately. It's solved by having an array with all
sender and reciever children's pids and calling waitpid() on each of these
children pairs.
Signed-off-by: David Sommerseth <davids@redhat.com>
Fix code in check_privs() that passes NULL as parameter
to sched_setscheduler().
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Clark Williams <williams@redhat.com>
Add a workaround to hwlatdetect to deal with a broken block of
code in drivers/misc/smi_detector.ko, where whenever you enable
the module (write a 1 to debugfs/smi_detector/enable) the stats
initialization routine resets the threshold from whatever it was
set to to 1us. This workaround checks the threshold after enabling
the module and resets it to what we want.
Signed-off-by: Clark Williams <williams@redhat.com>
Remove the ret variable, the end lable and the goto. We already have
inconsistent exit points for the function, and the end lable wasn't strictly
for errors. Directly returning simplifies and shortens the code.
Signed-off-by: John Kacur <jkacur@redhat.com>
Separate the #ifdef LIBNUMA_API_VERSION of function rt_numa_numa_node_of_cpu,
it is slightly cleaner this way.
Signed-off-by: John Kacur <jkacur@redhat.com>
Added NUMA=1 to specfile build command line to enable NUMA
options. Added description of --numa option to usage output.
Signed-off-by: Clark Williams <williams@redhat.com>
use a variable to indicate that priorities should be equal
on all cpus when smp, numa or histogram options are specified.
Signed-off-by: Clark Williams <williams@redhat.com>
Runtime tests are not sufficient, cyclic tests needs to be compilable
on non-numa systems.
This separates numa functionality into rt_numa.h
Signed-off-by: John Kacur <jkacur@redhat.com>
added back reference to outpar label in allocation failure for
statistics array (got dropped in previous two commits).
Signed-off-by: Clark Williams <williams@redhat.com>
Modify cyclictest to have a --numa option which enables calls into
libnuma functions for binding threads to memory nodes.
Signed-off-by: Clark Williams <williams@redhat.com>
Added the --smp (-S) option which is short hand for setting
the options -t, -a, and -n and for not changing any specified
priority across processors.
Also changed many printfs to use either warn() or fatal()
Signed-off-by: Clark Williams <williams@redhat.com>
Added routines to print warning and fatal messages with appropriate
text prefixes (e.g. WARNING: and FATAL: )
Signed-off-by: Clark Williams <williams@redhat.com>
When reading the output from cyclictest with another program, the data is
buffered by default. This prevents nice 'live' display.
This patch adds an command line option to force the output to always be
unbuffered.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
Use check_privs() from the rt-utils library to make sure that the user is
running with real-time privileges for the pip test program.
Signed-off-by: John Kacur <jkacur@redhat.com>
This test is similar to pi_stress in that it purpursely triggers a priority-
inversion. However, instead of using pthreads it uses processes.
Since pthread_mutex_t are the only objects backed by priority inheritance
this is accomplished by having the processes use a pthread_mutex_t in
shared memory. See the header of pip.c for more information as well as the
code of course.
In addition this patch starts a src/include directory as a common place
to put header files.
Signed-off-by: John Kacur <jkacur@redhat.com>
Add error routines, similar to those found in Advanced Programming in the
UNIX Environment 2nd ed. for use by all rt test programs
Signed-off-by: John Kacur <jkacur@redhat.com>
classic_pi was the original proof of concept for a Priority
Inheritance mutex demonstration, but pi_stress does that much
better now.
Signed-off-by: Clark Williams <williams@redhat.com>
renamed the guard macros in rt-get_cpu.h and rt-utils.h to
have leading double underscores which takes them out of the
application namespace. Also changed a '.' in the rt-get_cpu.h
guard macro to an underscore.
Signed-off-by: Clark Williams <williams@redhat.com>
Add a get_cpu() function to the library.
Most platforms will simply use sched_getcpu()
However, if you have a glibc < 2.6 then
64-bits will use vsyscall for getcpu (if available).
32-bits will use getcpu() (if available)
Signed-off-by: John Kacur <jkacur@redhat.com>
- These changes simplify the Makefile. For example, notice that we no
longer need to specify the full path to the source file
- These changes also unify the Makefile, for example, every program
gets VERSION_STRING as an floating point number.
- Due to the above change I had to make a number of changes in the programs
that expected VERSION_STRING as a string.
- By unifying what we CFLAGS, to include -D_GNU_SOURCE, I had to remove
__USE_GNU which is reduncant in a number of files.
Signed-off-by: John Kacur <jkacur@redhat.com>
Somehow the last set of tests added got converted to DOS text
(CRLF line terminators). Change them back
Signed-off-by: Clark Williams <williams@redhat.com>
Add a .gitignore file in the backfire directory for generated files
that are created when making the kernel module.
Signed-off-by: John Kacur <jkacur@redhat.com>
from signaltest - because it doesn't have the fix that check_privs in
cyclictest has - to return the sched_priority to 0
This is a good example of why common functions should be put into libraries -
so all programs benefit from fixes.
Signed-off-by: John Kacur <jkacur@redhat.com>
This commit adds some output then the -b option is used to break on
exceeding a threshold. the thread id of the thread that exceeded the
threshold is printed for use when looking at the trace log.
Signed-off-by: Clark Williams <williams@redhat.com>
Add a second newline to the "Low thread priority" display line
so that updating number of inversions doesn't overwrite it.
Signed-off-by: Clark Williams <williams@redhat.com>
When using pthread_barrier_wait, it is important that barriers are called
the correct number of times. That is - the same number given as the count
when initializing the barrier.
There was a do-while loop around elevate_barrier in the med priority thread.
On most machines, it actually never looped.
On threads with enough processors (nehelam for example), there was a racy
situation in which the high priority thread could come out of the finish
barrier, and before it could set high_has_run = 0, the medium priority
thread would test the value and call the elevate barrier an extra time.
This patch removes the bogus loop and related state variables and fixes
the hang.
Signed-off-by: John Kacur <jkacur@redhat.com>
- Check whether quiet is set, before taking shutdown_mtx
- Add quiet to the help menu.
- Remove unused "signal" from struct options
Signed-off-by: John Kacur <jkacur@redhat.com>
- Use a pthread_mutex_t for the global variable shutdown.
- Remove the volatile qualifier from shutdown. (Since the original author
probably simply meant the variable should be atomic which we effectively
get through the mutex.
Signed-off-by: John Kacur <jkacur@redhat.com>
From f17765e52e248b3a738f5206cb4b97bdcc1a0204 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Tue, 1 Sep 2009 15:24:23 +0200
Subject: [PATCH] Add tags and TAGS to .gitignore
Add tags and TAGS to .gitignore, to prepare for a make tags option
"-" must be escaped ("\-") to be interpreted as minus, otherwise they
might be rendered as hyphen which makes it impossible to search for or
to cut'n'paste.
See http://lintian.debian.org/tags/hyphen-used-as-minus-sign.html for a
detailed explanation.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Note: the previous one sucked rockz, please try this one instead.
When running on a machine with not enough bandwidth it can be helpful to
only update the status when a new max is hit.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
so a normal user is able to take a look on the available options
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
if cyclictest is started with invalid arguments or $SOMETHING, then it
prints the help screen and the exit code is 0 which is wrong.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
moved policy display from individual threads to header with load average
did some sanity checking so that policy and priority match
Signed-off-by: Clark Williams <williams@redhat.com>
"cyclictest --help".
From: GeunSik Lim <leemgs1@gmail.com>
Reply-To: leemgs1@gmail.com
To: williams <williams@redhat.com>
Cc: linux-rt-users <linux-rt-users@vger.kernel.org>, tglx <tglx@linutronix.de>
When we use "#> cyclictest --help" command, we are confusing because of
random order of many options. Arrange alphabetically.
After Patch)
[root@fedora11 rt-tests]# ./cyclictest --help
cyclictest V 0.46
Usage:
cyclictest <options>
-a [NUM] --affinity run thread #N on processor #N, if possible
with NUM pin all threads to the processor NUM
-b USEC --breaktrace=USEC send break trace command when latency > USEC
-B --preemptirqs both preempt and irqsoff tracing (used with -b)
-c CLOCK --clock=CLOCK select clock
0 = CLOCK_MONOTONIC (default)
1 = CLOCK_REALTIME
-C --context context switch tracing (used with -b)
-d DIST --distance=DIST distance of thread intervals in us default=500
-D --duration=t specify a length for the test run
default is in seconds, but 'm', 'h', or 'd' maybe added
to modify value to minutes, hours or days
-E --event event tracing (used with -b)
-f --ftrace function trace (when -b is active)
-h --histogram=US dump a latency histogram to stdout after the run
(with same priority about many threads)
US is the max time to be be tracked in microseconds
-i INTV --interval=INTV base interval of thread in us default=1000
-I --irqsoff Irqsoff tracing (used with -b)
-l LOOPS --loops=LOOPS number of loops: default=0(endless)
-m --mlockall lock current and future memory allocations
-n --nanosleep use clock_nanosleep
-N --nsecs print results in ns instead of ms (default ms)
-o RED --oscope=RED oscilloscope mode, reduce verbose output by RED
-O TOPT --traceopt=TOPT trace option
-p PRIO --prio=PRIO priority of highest prio thread
-P --preemptoff Preempt off tracing (used with -b)
-q --quiet print only a summary on exit
-r --relative use relative timer instead of absolute
-s --system use sys_nanosleep and sys_setitimer
-t --threads one thread per available processor
-t [NUM] --threads=NUM number of threads:
without NUM, threads = max_cpus
without -t default = 1
-T TRACE --tracer=TRACER set tracing function
configured tracers: unavailable (debugfs not mounted)
-v --verbose output values on stdout for statistics
format: n:c:v n=tasknum c=count v=value in us
-w --wakeup task wakeup tracing (used with -b)
-W --wakeuprt rt task wakeup tracing (used with -b)
-y POLI --policy=POLI policy of realtime thread (1:FIFO, 2:RR)
format: --policy=1(default) or --policy=2
Signed-by-off: GeunSik Lim <geunsik.lim@samsung.com>
Signed-off-by: Clark Williams <williams@redhat.com>
users
From: GeunSik Lim <leemgs1@gmail.com>
To: williams <williams@redhat.com>
Cc: linux-rt-users <linux-rt-users@vger.kernel.org>, tglx <tglx@linutronix.de>
Current cyclictest support FIFO policy for static priority of
RT threads only. Append policy option to support FIFO or RR by user.
After this patch.
1) with FIFO about RT threads(default)
./cyclictest -t 5 -p 50
or ./cyclictest -t 5 -p 50 -y 1
or ./cyclictest -t 5 -p 50 --policy 1
2) with RR about RT threads(default)
./cyclictest -t 5 -p 50 -y 2
or ./cyclictest -t 5 -p 50 --policy 2
This is screenshot of threads using cyclictest & tuna utility after patch.
http://blogfiles6.naver.net/20090703_5/invain_1246588185266_sc7zEq_PNG/cyclictest-tuna-policy.PNG
Signed-off-by: GeunSik Lim <geunsik.lim@samsung.com>
Signed-off-by: Clark Williams <williams@redhat.com>
of many threads with -h
From: GeunSik Lim <leemgs1@gmail.com>
Reply-To: leemgs1@gmail.com
To: williams <williams@redhat.com>
Cc: linux-rt-users <linux-rt-users@vger.kernel.org>, tglx <tglx@linutronix.de>,
sdietrich@suse.de
If we run a many threads with -t option, "priority--" rt priority will assign
per thread in sequence. But, If we use -h option, all threads is same priority.
Append man page and cyclictest usage about the same priority of many threads
with -h option.
ex) cyclictest -t 5 -p 50 [enter] <-- without -h
ex) cyclictest -t 5 -p 50 -h 100 [enter] <-- with -h
Signed-off-by: GeunSik Lim <geunsik.lim@samsung.com>
Acked-by : Sven-Thorsten Dietrich <sdietrich@suse.de>
Signed-off-by: Clark Williams <williams@redhat.com>
Don't miss latency which exceed the histogram limit -
instead sample limit exceeding latency in the last bucket.
This is a leftover from cyclictest_histogram.patch:
-> Todo: Currently cyclictest does not report the number of samples
-> that exceeded the histogram max latency.
Handle OOM.
Signed-off-by: Daniel Gollub <dgollub@suse.de>
Reviewed-by: Sven-Thorsten Dietrich <sdietrich@suse.de>
--
This is useful when testing PREEMPT_NONE Kernels with cyclictest,
where latencies approaching 1 second can be observed.
Signed-off-by: Sven-Thorsten Dietrich <sdietrich@suse.de>
If clock_nanosleep() gets interrupted this could result in a negative
time diff from calcdiff().
With the histogram patch this leads to a segfault, since the time diff
is used as index for the histogram array:
Core was generated by `/usr/bin/cyclictest -n -q -p 99 -t 2 -i 500 -l
1000000 -h
20000'.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000402324 in timerthread (param=<value optimized out>)
at src/cyclictest/cyclictest.c:339
339 stat->hist_array[diff] += 1;
(gdb) p diff
$1 = -751974
Signed-off-by: Daniel Gollub <dgollub@suse.de>
Acked-by: Sven-Thorsten Dietrich <sdietrich@suse.de>
You might wonder if this wasn't already fixed. Yes it was (in
f16ec27fb3), but the change was undone by 3e04327f7f.
While at it add an .br which makes the paragraph look a bit nicer.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
This was noticed by GeunSik Lim.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: GeunSik Lim <leemgs1@gmail.com>
Cc: Luis Claudio R. Goncalves <lclaudio@uudg.org>
Cc: Clark Williams <williams@redhat.com>
Hello,
My first fix didn't took into account that long is 4 byte long on ARM. Therefor
I changed it to long long now, which works on my ARM board...
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Clark Williams <williams@redhat.com>
'-' chars are interpreted as hyphens by groff, not as minus signs. This
means that if you're using an UTF-8 locale searching for '-' to find
options doesn't work.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Hi Thomas,
The patch below removes the duplicate entry for the -m/--mlockall option from
the cyclictest manpage. Patch is againnst current HEAD of rt-tests.git
Cheers, Tobias
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This is patch to support wakeup & wakeup_rt tracing at the argument of
cyclictest additionally. Current cyclictest support three tracing
like PREEMPTOFF, IRQSOFF, PREEMPTIRQSOFF just.
This additional function will help wakeup related tracing
about sleep api [ex: nanosleep() , usleep] of cyclictest.
Practically speaking, wakeup(+wakeup-rt) tracing by steven rostedt is useful
in the linux based embedded product development.
After patching,
Fedora9#> cat /debug/tracing/available_tracers
syscall blk kmemtrace power branch function_graph mmiotrace wakeup_rt wakeup \
preemptirqsoff preemptoff irqsoff function sched_switch initcall nop
Fedora9#> cyclictest -t 5 -p 80 -b 1000 -w -D 10 [enter] <--- tracing wakeup
Fedora9#> cat /debug/tracing/trace
Fedora9#> cyclictest -t 5 -p 80 -b 1000 -W -D 10 [enter] <--- tracing wakeup-rt
Fedora9#> cat /debug/tracing/trace
Signed-off-by: GeunSik Lim <geunsik.lim@samsung.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Author: Lim,GeunSik <leemgs1@gmail.com>
Date: Tue Apr 21 16:03:56 2009 +0900
[PATCH] cyclictest: Remove duplicated description of cyclictest usage like -h.
We often utilize a various options with "#>cyclictest --help" command in the terminal environment.
When We run "#> cyclictest --help" command, We can show duplicated description about "-h" option
for latency histogram.
Unfortunatley, Some of the users is confusing because of two options about latency histogram.
[root@fedora9 invain]# ./cyclictest --help
cyclictest V 0.36
Usage:
cyclictest <options>
-a [NUM] --affinity run thread #N on processor #N, if possible
with NUM pin all threads to the processor NUM
-b USEC --breaktrace=USEC send break trace command when latency > USEC
-B --preemptirqs both preempt and irqsoff tracing (used with -b)
-c CLOCK --clock=CLOCK select clock
0 = CLOCK_MONOTONIC (default)
1 = CLOCK_REALTIME
-C --context context switch tracing (used with -b)
-d DIST --distance=DIST distance of thread intervals in us default=500
-E --event event tracing (used with -b)
-f --ftrace function trace (when -b is active)
-h H_MAX latency histogram size in us default 0 (off)
-i INTV --interval=INTV base interval of thread in us default=1000
................. [Middle Omission] ...................
-v --verbose output values on stdout for statistics
format: n:c:v n=tasknum c=count v=value in us
-D --duration=t specify a length for the test run
default is in seconds, but 'm', 'h', or 'd' maybe added
to modify value to minutes, hours or days
-h --histogram=US dump a latency histogram to stdout after the run
US is the max time to be be tracked in microseconds
For example,
-h H_MAX latency histogram size in us default 0 (off)
-h --histogram=US dump a latency histogram to stdout after the run
US is the max time to be be tracked in microseconds
As you see, We don't need "-h H_MAX . . . . . ." description.
So, I think that We have to remove old option about description of histogram function.
Signed-off-by: GeunSik Lim <leemgs1@gmail.com>
Author: Lim,GeunSik <leemgs1@gmail.com>
Date: Wed Apr 8 22:21:59 2009 +0900
[patch] cyclictest: bugfix getopt_long() for -C and -F.
We can not use -C option without --context option for tracing context switching.
ex) ./cyclictest -t 10 -m -b 100 -C
We can not use -E option without --event option for tracing events.
ex) ./cyclictest -t 10 -m -b 100 -E
Append -C and -E option on getopt_long() function to solve this problems.
Signed-off-by: GeunSik Lim <leemgs1@gmail.com>
Signed-off-by: Clark Williams <williams@redhat.com>
GeunSik Lim <leemgs1@gmail.com> found a problem with settracer()
in that it had a hardcoded limit to the number of tracers searched.
Unfortunately his patch found a bug in either fscanf or debugfs,
since it doesn't seem to return EOF at the end of input, so I reworked
the patch to read all the input and parse it using strtok.
Signed-off-by: Clark Williams <williams@redhat.com>
cyclictest results are presented in microseconds, although internal precision
uses nanosecond unit. This patch adds a command-line option for keeping the
nanoseconds precision. man page has also been update.
Signed-off-by: Luis Henriques <henrix@sapo.pt>
Signed-off-by: Clark Williams <williams@redhat.com>
The tracer setup happens in every thread, which is nonsense. First of
all it leads to a lot of irritating warnings because the things are
setup multiple times. The worst effect is that one tasks runs already
into the tracer stop condition and the next one reenables the tracer.
Move the tracer setup into the main thread and do it only once.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
Switching back to SCHED_OTHER in check_priv() fails due to the param
argument of sched_setscheduler() set to NULL.
Set the priority to 0 and hand in params.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
Cc: Clark Williams <williams@redhat.com>
Subject: [patch 2/2] cyclictest: support for latest mainline tracer
The tracer in mainline changed the interface another time. Make it
work again.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
Cc: Clark Williams <williams@redhat.com>
Subject: [patch 1/2] cyclictest: code cleanup
Started to grow whitespace and formatting sloppiness.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Luis Claudio Goncalves <lclaudio@uudg.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Luis Claudio Goncalves <lclaudio@uudg.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Luis Claudio Goncalves <lclaudio@uudg.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Problem: when running cyclic test, short options are not parsing
optional arguments correctly when followed by a space.
"-t3" works, but "-t 3" does not.
- Fix the processing of options with optional parameters, so that the user
can write -tNUM or -t NUM and it will work as expected. This was done
for the -t and -a options
- Modify the usage messages to correspond with the way the program makes use
of the options.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Data reduction (-o mode) did not work correctly with >1 threads.
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
I noticed I had a typo on sched_switch. I tested this on linux-tip tree
and it works there.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Darren Hart <dvhltc@us.ibm.com>
Cc: Subrata Modak <subrata@linux.vnet.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This patch has cyclictest work a bit better with ftrace. Some new options
have been added.
When -b is used:
-P : use the preemptoff tracer
-I : use the irqsoff tracer
-B : use preemptirqsoff tracer
If the above are not set, then it tries to use "events" tracer if it is
available (currently only available in the -rt kernel) and if that is not
set, it defaults to the sched-switch tracer.
-f will enabled the function tracer.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Darren Hart <dvhltc@us.ibm.com>
Cc: Subrata Modak <subrata@linux.vnet.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Not everyone mounts debugfs at /debug. This patch makes cyclictest search
for debugfs in the /proc/mounts directory.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Darren Hart <dvhltc@us.ibm.com>
Cc: Subrata Modak <subrata@linux.vnet.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
The appropriate cycle number of the maximum is now sent when in -o
mode. This is needed to more accurately determine the trace line that
is related to a particular latency.
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
The version check in cyclic test fails if proc isn't mounted or if OS
name isn't Linux (uClinux isn't uncommon). This patch fixes both
issues.
Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
CPU affinity isn't supported by all uClibc ports right now.
Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
as of uClibc-20080416 clock_nanosleep is still not implemented.
Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
When the output of the -v option is piped into another program and if
more data are sent than the other program can eat, data points get
lost. Since high latency values normally occur much less frequently
than average latency values, the connected program will miss many of
the high latency values, and the realtime capability of a given system
may appear much better than it is.
Therefore, the new option -o RED was introduced. This option causes
cyclictest to suppress every subsequent RED number of samples and
replace them with the maximum of the values encountered during that
sampling interval.
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
- Added support for the kernel tracer as of kernel 2.6.24
- Options mostly identical, irrespective of the kernel version
- Added check whether debug fs is mounted and tracing configured
- -v (verbose) option additionally makes tracing more verbose
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Add CPU affinitt option to cyclictest.
1. New option -a:
without argument to a cyclictest spreads the threads consecutive on
the available CPUs. On a quad core machine we get:
-a -t4 Thread #0 -> CPU #0
Thread #1 -> CPU #1
Thread #2 -> CPU #2
Thread #3 -> CPU #3
-a -t5 Thread #0 -> CPU #0
Thread #1 -> CPU #1
Thread #2 -> CPU #2
Thread #3 -> CPU #3
Thread #4 -> CPU #0
Adding a CPU number to the -a option all threads are pinned to
the given CPU:
-a3 -t4 Thread #0 -> CPU #3
Thread #1 -> CPU #3
Thread #2 -> CPU #3
Thread #3 -> CPU #3
2. extension of the -t option:
Without argument to -t cyclictest starts as many threads as CPUs are
available.
Signed-off-by: Carsten Emde <c.emde@osadl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>