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