1/******************************************************************************/ 2/* */ 3/* Copyright (c) International Business Machines Corp., 2007 */ 4/* */ 5/* This program is free software; you can redistribute it and/or modify */ 6/* it under the terms of the GNU General Public License as published by */ 7/* the Free Software Foundation; either version 2 of the License, or */ 8/* (at your option) any later version. */ 9/* */ 10/* This program is distributed in the hope that it will be useful, */ 11/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 12/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ 13/* the GNU General Public License for more details. */ 14/* */ 15/* You should have received a copy of the GNU General Public License */ 16/* along with this program; if not, write to the Free Software */ 17/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ 18/* */ 19/******************************************************************************/ 20 21OO_DESCRIPTION.txt 22================== 23 24The contents of the LTP/testcases/realtime/ directory: 25 26doc - Documentation 27include - Header files which are to be included in the tests 28lib - c library files for the real-time tests 29scripts - Set up and parsing scripts needed to run the tests 30logs - All test logs are stored in this directory 31config - autotools configure support 32confugure.ac - Top level autotools configure script 33COPYING - GPL license 34GNUmakefile.am - Top level automake makefile 35README - How to build and run the tests 36 37 38Below is the decription of what each testcase tests. 39 40func/async_handler testcases : 41============================= 42async_handler.c: 43- Measures latencies involved in asynchronous event handlers. Specifically it 44 measures the latency of the pthread_cond_signal call until signalled thread 45 is scheduled. 46 47async_handler_jk.c: 48- Mimics an async event handler in a real-time JVM. An async event server 49 thread is created that goes to sleep waiting to be woken up to do some 50 work. A user thread is created that simulates the firing of an event by 51 signalling the async handler thread to do some work. 52 53async_handler_tsc.c: 54- Is similar to the above two i.e. it measures latencies involved in 55 asynchronous event handlers. This test measures time in terms of CPU 56 timestamp clock(TSC), for pthread_cond_signal latency. 57 58 59func/gtod_latency testcases : 60============================= 61gtod_infinite.c: 62- Designed to run forever. It must manually be killed so it is 63 not suited to be part of functional validation suite of tests. It is 64 designed to look for 'delays' between two calls to clock_gettime() 65 66gtod-latency.c: 67- Simple program to measure the time between several pairs of calls to 68 gettimeofday(). It provides the additional capability to produce graphical 69 output as a histogram or a scatter graph. 70 71 72func/matrix_mult testcases : 73============================ 74matrix_mult.c: 75- Compares running sequential matrix multiplication routines to running them 76 in parallel in order to judge multiprocessor performance. 77 Test runs for 100 iterations and calculates the average time. 78 79 80func/measurement testcases : 81============================ 82preempt_timing.c: 83- Measures the preemption delays that may be encountered by realtime apps. 84 The program runs with the scheduling policy of SCHED_FIFO at a maximum 85 SCHED_FIFO priority. It is bound to a single processor and its address space 86 is locked as well. It makes successive calls to the gettimeofday() function 87 (via inlined assembly to read the TSC). The value returned between two such 88 consecutive calls is reported as the latency. The maximum, minimum and 89 average delays are reported for x pairs of such calls. 90 91rdtsc-latency.c: 92- Measures the time between several pairs of calls to rdtsc(); rdtsc counts 93 the timestamp clock 94 95 96func/periodic_cpu_load testcases : 97================================== 98periodic_cpu_load.c: 99- Measures variation in computational execution time at various periods and 100 priorities. This provides the timing information at different CPU loads. 101 102periodic_cpu_load_single.c: 103- Measures variation in computational execution time at specified period 104 priority and loop. 105 106 107func/pi-tests testcases : 108========================= 109testpi-0.c: 110- Tests whether the priority inheritance feature is present in kernel 111 112testpi-1.c: 113- Priority inheritance under two different scenarios. It checks whether the 114 presence of priority inheritance allows higher priority threads to make more 115 progress than in absence of the same. 116 117testpi-2.c: 118- Introduces a noise thread in above test and checks if the high priority 119 thread preempts low prio thread multiple times 120 121testpi-4.c: 122- The scheduling policies of threads are different from previous testcase 123 124testpi-5.c: 125- Uses priority inheritance protocol (PTHREAD_PRIO_INHERIT) and uses 126 test-skeleton. Test creates a child thread which tries to acquire lock 127 twice. 128 129testpi-6.c: 130- Uses robust mutex lock (PTHREAD_MUTEX_ROBUST) and uses test-skeleton for 131 other things. 132 133testpi-7.c: 134- Measures latencies involved in priority boosting through priority inheritance 135 136test-skeleton.c: 137- is a skeleton test which creates two processes through fork(). Also it 138 handles signals by noting down timing information. 139 140sbrk_mutex.c: 141- Uses NUM_THREADS to walk through an array of malloc'd pthread mutexes. 142 Each thread holds up to NUM_CONCURRENT locks at a time. 143 144 145func/prio-preempt testcases : 146============================= 147prio-preempt.c: 148- Tests priority preemption. Main thread creates multiple number of threads 149 with different priorities, all fight for holding mutexes. Threads sleep and 150 wake-up with condvars. Testcase exhibit scheduling of threads in accordance 151 with priority-preemption. 152 153 154func/prio-wake testcases : 155========================== 156prio-wake.c: 157- Tests priority ordered wakeup with pthread_cond_*. It creates number of 158 worker threads with increasing FIFO priorities. By default, the number of 159 worker threads is equal to number of cpus. The time when worker thread 160 starts running is noted. Each of the worker thread then waits on same 161 _condvar_. The time it wakes up is also noted. Once all the threads finish 162 execution, the start and wakeup times of all the threads are displayed. The 163 output must indicate that the thread wakeup happened in a priority order. 164 165 166 167func/pthread_kill_latency testcases : 168==================================== 169pthread_kill_latency.c: 170- Measures the latency involved in sending a signal to a thread using 171 pthread_kill. Two threads are created - the one that receives the signal 172 (thread1) and other that sends signal (thread2). Before sending the signal, 173 the thread2 waits for thread1 to initialize, notes the time and sends 174 pthread_kill signal to thread1. Thread2, which has defined a handler for the 175 signal, notes the time it receives the signal. The maximum and minimum 176 latency is reported. 177 178 179func/sched_football testcases : 180=============================== 181sched_football.c: 182- A scheduler test that uses a football analogy. The premise is that we want 183 to make sure that lower priority threads (the offensive team) do not preempt 184 higher priority threads (the defensive team). 185 186 187func/sched_jitter testcases : 188============================= 189sched_jitter.c: 190- Measures scheduling jitter between realtime processes. 191 192 193func/sched_latency testcases : 194============================== 195sched_latency.c: 196- Measures the latency involved with periodic scheduling. A thread is created 197 at priority 89. It periodically sleeps for a specified duration (PERIOD). 198 The delay is measured as delay = (now - start - i*PERIOD) converted to 199 microseconds where now = CLOCK_MONOTONIC gettime in ns, start = 200 CLOCK_MONOTONIC gettime at the start of the test, i = iteration number, 201 PERIOD = the period chosen. 202 203 204func/thread_clock testcases : 205============================= 206tc-2.c: 207- Check if clock_gettime is working properly. This test creates NUMSLEEP 208 threads that just sleep and NUMWORK threads that spend time on the CPU. It 209 then reads the thread cpu clocks of all these threads and compares the sum 210 of thread cpu clocks with the process that spend time on the CPU. It then 211 reads the cpu clock of all these threads and compares the sum of thread cpu 212 clocks with the process cpu clock value. The test expects that: the cpu 213 clock of every sleeping thread shows close to zero value. Sum of cpu clocks 214 of all threads is comparable with the process cpu clock. 215 216 217perf/latency testcases : 218======================== 219pthread_cond_latency.c: 220- Measures latencies involved in pthread_cond_t 221 222pthread_cond_many.c: 223- Measures latencies involved in pthread_cond_t. This test executes in 224 many processes running together and contesting to being scheduled. 225 226 227stress/pi-tests testcases : 228=========================== 229testpi-3.c: 230- Tests priority inheritance under stress conditions. Test runs in two 231 scenarios: non-pi and pi. 232 233 234lookup_pi_state.c: 235- Tests lookup_pi_state under stress conditions. Test creates one master and 236 several slave threads, all fighting for mutexes. 237