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