Commit Graph

528 Commits

Author SHA1 Message Date
Clark Williams 83adb67c79 cyclictest: allow break threshold without doing any tracing
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>
2013-03-13 19:36:29 -05:00
Clark Williams 1906cc53f5 cyclictest: add named fifo for statistics
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>
2013-03-13 16:53:53 -05:00
Jim Somerville 1b92da3083 cyclictest: finish removal of 1 second first loops
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>
2013-02-15 15:08:35 +01:00
John Kacur b2689a768a Makefile: Don't tag files in dir BUILD from rpm builds
Don't tag copies of files in BUILD created when building an rpm
Without this change tags finds both copies, eg: for tag cyclictest.c
  # pri kind tag               file
  1 F   F    cyclictest.c      BUILD/rt-tests/src/cyclictest/cyclictest.c
               1
  2 F   F    cyclictest.c      src/cyclictest/cyclictest.c

With this change, only the later one is found

Signed-off-by: John Kacur <jkacur@redhat.com>
2013-02-15 15:02:21 +01:00
Frank Rowand 7ffb5a6e20 rt-tests: NUMA optional for make rpm
version 2:
  - Add new placeholders in rt-tests.spec-in to make the replacements by
    "make rpm" more visible to future maintainers of rt-tests.spec-in
  - fix typo of my name in rt-tests.spec-in

rt-tests can be built without NUMA:

   make NUMA=0

But "make rpm" does not have a way to be successful without NUMA:

   build_rt-tests_0.85> make rpm
   for F in cyclictest signaltest pi_stress rt-migrate-test ptsematest sigwaittest svsematest pmqtest sendme pip_stress hackbench *.o .depend *.*~ *.orig *.rej rt-tests.spec *.d *.a  ChangeLog; do find -type f -name $F | xargs rm -f; done
   rm -f hwlatdetect
   rm -f tags
   rm -rf BUILD BUILDROOT RPMS SRPMS SPECS releases *.tar.gz rt-tests.spec tmp
   git log >ChangeLog
   mkdir -p releases
   mkdir -p tmp/rt-tests
   cp -r Makefile COPYING ChangeLog src tmp/rt-tests
   tar -C tmp -czf rt-tests-0.85.tar.gz rt-tests
   rm -f ChangeLog
   cp rt-tests-0.85.tar.gz releases
   sed s/__VERSION__/0.85/ <rt-tests.spec-in >rt-tests.spec
   rpmbuild -ba --define "_topdir /a/home/frowand/me/src/rt-tests/build_rt-tests_0.85" --define "_sourcedir /a/home/frowand/me/src/rt-tests/build_rt-tests_0.85/releases" --define "_builddir /a/home/frowand/me/src/rt-tests/build_rt-tests_0.85/BUILD"  rt-tests.spec
   error: Failed build dependencies:
           numactl-devel is needed by rt-tests-0.85-1.fc12.src
   make: *** [rpm] Error 1

The following patch allows the rpm to be built without NUMA, with the command:

   make NUMA=0 rpm

Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2013-02-15 14:54:43 +01:00
John Kacur cc7b99bf4e Makefile: Add BUILDROOT and SPECS to the dirs to remove for distclean
make rpm creates the dirs BUILDROOT and SPECS that are missed by distclean.
Gather all rpm related DIRS to the RPMDIRS and add that to distclean.

Signed-off-by: John Kacur <jkacur@redhat.com>
Reviewed-by: Frank Rowand <frank.rowand@am.sony.com>
Tested-by: Frank Rowand <frank.rowand@am.sony.com>
2013-02-15 14:46:35 +01:00
John Kacur d29d951dbe Makefile: Add tmp dir to distclean and "make release" call distclean
The files in the tmp dir are generated during make release.
These are the kind of generated files that should be removed for distclean,
So add tmp. make release can be slightly simplified by then depending
on distclean instead of clean.

Signed-off-by: John Kacur <jkacur@redhat.com>
Reviewed-by: Frank Rowand <frank.rowand@am.sony.com>
Tested-by: Frank Rowand <frank.rowand@am.sony.com>
2013-02-15 14:46:10 +01:00
John Kacur 0918c34eff Makefile: Don't tag tmp files created when making a release
Don't tag the copies of the source files placed in the tmp directory
during the creation of a release.
Without this change tags finds both copies, eg: for tag cyclictest.c
  # pri kind tag               file
  1 F C F    cyclictest.c      src/cyclictest/cyclictest.c
               1
  2 F   F    cyclictest.c      tmp/rt-tests/src/cyclictest/cyclictest.c
               1

With this change only the first one is found.

Signed-off-by: John Kacur <jkacur@redhat.com>
Reviewed-by: Frank Rowand <frank.rowand@am.sony.com>
Tested-by: Frank Rowand <frank.rowand@am.sony.com>
2013-02-15 14:45:44 +01:00
Frank Rowand 65c27472cc cyclictest: white space cleanup
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>
2013-01-30 17:56:05 +01:00
Clark Williams 210e625227 version bump to 0.85
Signed-off-by: Clark Williams <williams@redhat.com>
2012-11-13 16:02:04 -06:00
John Kacur 93e525fac1 Merge branch 'clrkwllms/work' into rt-tests-0.84-devel
Signed-off-by: John Kacur <jkacur@redhat.com>
2012-11-09 16:25:18 +01:00
Frank Rowand 9854a61da9 V3: cyclictest: report large measured clock latency
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>
2012-10-17 00:25:26 +02:00
Frank Rowand fcdef80f5f V3: cyclictest: clean up getopt_long() parameters
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
2012-10-17 00:24:59 +02:00
John Kacur 2400e5e3b5 rt-tests Makefile: Add CPPFLAGS to the pattern rule to generate dependencies
Signed-off-by: John Kacur <jkacur@redhat.com>
2012-10-17 00:22:33 +02:00
Uwe Kleine-König dfcef6e557 rt-tests Makefile: separate CFLAGS and CPPFLAGS
For compilation to work

        -D_GNU_SOURCE -Isrc/include

is needed to be passed to the compiler. For Debian packaging several
things are added but not these two from above. So be a bit more friendly
and add them unconditionally. There is no harm if they are included in
the user supplied CFLAGS and so passed twice.

Moreover be a bit more correct about CFLAGS/CPPFLAGS. Both should be
passed to the compiler with CFLAGS taking options for the compiler and
CPPFLAGS taking options for the preprocessor. This is also needed for
Debian packaging where the helper scripts set CPPFLAGS.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
2012-10-17 00:22:11 +02:00
Uwe Kleine-König 954e01fe14 rt-tests: have printf use %s format for strings
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>
2012-10-17 00:21:52 +02:00
John Kacur d63f567c64 rt-tests / gitignore: Exclude patches and .a libs too.
Minor fix to make working with git nicer.
Now that we're building a lib, we need to exclude it from git status output.
Do the same for patches we generate or apply.

Signed-off-by: John Kacur <jkacur@redhat.com>
2012-10-17 00:21:28 +02:00
Bhavesh Davda 992b905d42 cyclictest: histogram overflow instance tracking
Add feature to cyclictest histogram mode to track cycle counts every time a
sample overflows the histogram limit. This should help identify if there is a
timing pattern to jitters in cyclictest runs.

Example output (with -h 10):
 ...
 Histogram Overflows: 00001 00007 00000 00009 00004 00007 00000 00001
 Histogram Overflow at cycle number:
 Thread 0: 09964
 Thread 1: 00000 00004 00006 00008 00010 09962 11594
 Thread 2:
 Thread 3: 01169 04698 06782 09033 10299 11561 21517 28734 29532
 Thread 4: 11574 11580 11583 11586
 Thread 5: 00020 09448 13954 14954 18954 20587 24973
 Thread 6:
 Thread 7: 18950
 ...

Signed-off-by: Bhavesh Davda <bhavesh@vmware.com>
Reviewed-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2012-10-17 00:19:23 +02:00
Bhavesh Davda 18cd9775e5 cyclictest: whitespace cleanup
Cosmetic whitespace cleanup

Signed-off-by: Bhavesh Davda <bhavesh@vmware.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2012-10-17 00:11:54 +02:00
Clark Williams 7667ff6946 add setup and call of tracemark function for breaktrace
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>
2012-08-30 15:54:02 -05:00
Clark Williams 857cdd5320 version bump to 0.84
Signed-off-by: Clark Williams <williams@redhat.com>
2012-05-09 09:38:00 -05:00
John Kacur 81c42e0162 rt-tests / cyclictest: Make cyclictest fail if it cannot run with requested priority.
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>
2012-05-09 09:22:07 -05:00
Frank Rowand 683a326a12 rt-tests: printf format compile warning
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>
2012-05-03 16:17:57 -05:00
Frank Rowand e43bee0158 rt-tests: incorrect first latency value for --verbose option
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>
2012-05-03 16:17:38 -05:00
Frank Rowand f4256bfde4 rt-tests: Makefile get machinetype from compiler instead of uname
Fix the machinetype check for cross-compiling.

This has been tested on an x86_64  Fedora host for an x86_64 target and
an ARM target.  Additional testing would be greatly appreciated.

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>
2012-05-03 16:17:38 -05:00
Frank Rowand 3c14034e3d rt-tests: cyclictest warn of interaction between '-a', '--smp', and '--numa'
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>
2012-05-03 16:17:38 -05:00
Frank Rowand b3593fbe8e rt-tests: cyclictest avoid unneeded warning
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>
2012-05-03 16:17:38 -05:00
Frank Rowand 0629f60b79 rt-tests: cyclictest segfault with '-a'
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>
2012-05-03 16:17:38 -05:00
Clark Williams d5c8f73345 Merge remote-tracking branch 'jkacur/rt-tests-0.83-devel' into work
Conflicts:
	Makefile
2012-03-26 13:40:01 -05:00
Clark Williams f2b344c958 change cyclictest measurement thread to check returns and exit on error
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>
2012-03-26 13:36:55 -05:00
Clark Williams c9870e6cba report number of samples written in hwlatdetect
Signed-off-by: Clark Williams <williams@redhat.com>
2012-03-26 13:25:51 -05:00
John Kacur e6bca755b8 install: Fix failed to create symbolic link hwlatdetect file exists
The following build error can occur if you have done a previous make install

if test -n "/usr/lib/python2.7/site-packages" ; then \
	install -D -m 755 src/hwlatdetect/hwlatdetect.py /usr/lib/python2.7/site-packages/hwlatdetect.py ; \
	ln -s /usr/lib/python2.7/site-packages/hwlatdetect.py "/usr/local/bin/hwlatdetect" ; \
fi
ln: failed to create symbolic link `/usr/local/bin/hwlatdetect': File exists
make: *** [install] Error 1

I initially wanted to fix the error by removing the symbolic link, with rm -rf
but Andrew Burgess pointed out that you can just use the
ln's -f (force) flag. I like that solution better.

Suggested-by: Andrew Burgess <aab@cichlid.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2012-03-26 15:05:14 +02:00
Clark Williams 95f2842745 Revert "cyclictest problem/bug as non-root"
This reverts commit 64e635bc51.
moving to the check-return-and-exit strategy

Signed-off-by: Clark Williams <williams@redhat.com>
2012-03-23 09:34:30 -05:00
Clark Williams 192a3adcd4 Merge remote-tracking branch 'jkacur/rt-tests-0.83-devel' into work 2012-03-23 09:18:47 -05:00
John Kacur 3ff3300ba0 install: Fix failed to create symbolic link hwlatdetect file exists
The following build error can occur if you have done a previous make install

if test -n "/usr/lib/python2.7/site-packages" ; then \
	install -D -m 755 src/hwlatdetect/hwlatdetect.py /usr/lib/python2.7/site-packages/hwlatdetect.py ; \
	ln -s /usr/lib/python2.7/site-packages/hwlatdetect.py "/usr/local/bin/hwlatdetect" ; \
fi
ln: failed to create symbolic link `/usr/local/bin/hwlatdetect': File exists
make: *** [install] Error 1

Fix the error by removing the symbolic link.

Signed-off-by: John Kacur <jkacur@redhat.com>
2012-03-23 02:15:31 +01:00
John Kacur 6f2665250e Move info, warn, and fatal functions to error.[ch]
Move warning, error and fatal function to the error files.
This is a first step in cleaning up rt-tests.

Signed-off-by: John Kacur <jkacur@redhat.com>
2012-03-23 02:15:19 +01:00
John Kacur fb7ef61416 Makefile: Introduce a static library
Introduce a static libray.
Currently it contains the functions in rt-utils.c error.c and rt-get_cpu.c

Signed-off-by: John Kacur <jkacur@redhat.com>
2012-03-23 02:15:19 +01:00
Darren Hart d276bb4b2d Makefile: Support user supplied CFLAGS and LDFLAGS
Accept user supplied CFLAGS and LDFLAGS, overwriting the
Makefile supplied versions. This can cause the build to
fail if the user does not provide at least what the Makefile
defines, but so be it.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
CC: Clark Williams <williams@redhat.com>
CC: John Kacur <jkacur@redhat.com>
CC: Denys Dmytriyenko <denis@denix.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
2012-03-23 02:15:19 +01:00
John Kacur 9eef81de2f pi_stress: Check the status of sched_getaffinity
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>
2012-03-23 02:15:19 +01:00
Steven Rostedt b52b383192 rt-tests: Update rt-migrate-test to use ftrace infrastructure
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>
2012-03-23 02:15:19 +01:00
John Kacur d7cd65d54c gitignore: differentiate between program names and directories
Many rt-test programs including cyclictest have directories with the
same name as the generated binaries. Tell .gitignore to only ignore
the program names and not the directories by using a slash prefix.

Signed-off-by: John Kacur <jkacur@redhat.com>
2012-03-23 02:15:19 +01:00
Clark Williams 2819d683a3 Merge branch 'master' into work 2012-02-13 12:37:49 -06:00
Nicholas Mc Guire 64e635bc51 cyclictest problem/bug as non-root
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
2012-02-13 09:57:14 -06:00
Clark Williams 1d632c3bf9 Merge https://github.com/flosse/rt-tests into work 2011-11-10 22:53:02 -06:00
Clark Williams 15c6d81986 [cyclictest] added priority spreading option --priospread
Add option to spread priorities across measurement threads in
decending order.

Signed-off-by: Clark Williams <williams@redhat.com>
2011-11-10 22:50:37 -06:00
Markus Kohlhase 4803d56d39 added description from osadl.org 2011-10-24 04:05:26 +02:00
Clark Williams 5f1e84f8b0 version bump to 0.83
Signed-off-by: Clark Williams <williams@redhat.com>
2011-09-26 14:53:10 -05:00
Clark Williams cb15404503 Modified Makefile to be smarter about turning on/off NUMA compile
Combined Uwe Kleine-König and Frank Rowand's suggestions into a
Makefile modification that tries to be smart about turning on
NUMA, while allowing it to be explicitly enabled/disabled via
command line options

Signed-off-by: Clark Williams <williams@redhat.com>
2011-09-26 14:49:36 -05:00
Clark Williams e1fab5b280 version bump to 0.82
Signed-off-by: Clark Williams <williams@redhat.com>
2011-09-21 09:37:38 -05:00
Clark Williams 6ea14c157e fix print that causes histogram processing error in cyclictest
Signed-off-by: Clark Williams <williams@redhat.com>
2011-09-21 09:37:15 -05:00