Cyclictest introduction, cyclictest
1. Introduction and installation of javasictest
1.1 Introduction to javasictest
What is policictest? You can guess from the name that it is a test program. The Wikipedia homepage of javasictest introduces it as follows: "javasictest is a high resolution test program, written by User: Tglx, maintained by User: Clark Williams ", that is, it is a high-precision test program, which is a test tool under rt-tests, it is also the most widely used test tool in rt-tests. It is generally used to test the kernel latency and determine the real-time kernel.
1.2 cyclictest installation 1.2.1 package-based software installation
In Debian/Ubuntu, you can directly use apt-get install rt-tests to install javasictest.
1.2.2 install git repository source code
The biggest advantage of using Linux is that we can download the software source code, learn, compile, and use it. If you use the above method to install and use it directly, if you don't understand some problems or encounter problems, you can't solve them either. From the developer's point of view, it is better to download and install the software or download the source code package after compilation.
(1) first copy the Git repository of mongoictest
# Git clone git: // git.kernel.org/pub/scm/linux/kernel/git/clrkwllms/rt-tests.git
(2) enter the git Repository
# Cd rt-tests
(3) create a branch. For example, we name it testing.
# Git branch testing
(4) to the testing branch, the subsequent steps will not affect the master Branch. This is a common method for using git repository on the computer.
# Git checkout testing
(5) view the current Branch
# Git branch
Master
* Testing
(6) use make to compile
# Make
Numa is missing during compilation. h error message. Here, we recommend that you install and use apt-file to solve such errors (with apt-file, in the case of such errors, we will know how to solve the problem rather than simply accessing the Internet to find other people's solutions. The main steps are as follows:
# Sudo apt-get install apt-file // install apt-file
# Apt-file update // similar to apt-get, apt-file also needs to update a library based on the source of the System Configuration
# Apt-file search numa. h // use apt-file search to search for our missing files
Libhwloc-dev:/usr/include/hwloc/linux-libnuma.h
Libnuma-dev:/usr/include/numa. h // in the search results, we found that the package called libnuma-dev should be the package we need to install.
Linux-headers-3.2.0-4-amd64:/usr/src/linux-headers-3.2.0-4-amd64/include/config/acpi/numa. h
Linux-headers-3.2.0-4-amd64:/usr/src/linux-headers-3.2.0-4-amd64/include/config/amd/numa. h
....
# Apt-get install libnuma-dev // use apt-get to install the libnuma-dev package
2. Introduction to the use of policictest and its parameters
We need to understand the meaning of each parameter before using javasictest, so before you start using it, please take a look at the parameters mentioned in javasictest -- help! This will be of great help to you.
2.1 simple use and result analysis of cyclictest
If you just want to play with this tool, test your computer performance with the tglx test command on the Wiki homepage:
# Sudo./cyclictest-t1-p 80-n-I 10000-l 10000
Note: We can use the rt-tests path. /cyclictest to run cyclictest. In other directories, We need to specify the cyclictest path for use, such as/home/long/rt-tests/cyclictest, alternatively, you can directly copy the javasictest file in the rt-tests path to/bin/. Then you can directly use javasictest without specifying the path !!
For example, on my computer, the test result of using this command is as follows:
#/Dev/cpu_dma_latency set to 0us
Policy: fifo: loadavg: 0.38 0.29 0.26 1/381
T: 0 (5592) P: 80 I: 10000 C: 10000 Min: 2 Act: 15 Avg: 15 Max: 195
Output result description:
T: A thread whose serial number is 0
P: 0 thread priority is 0
C: 9397 counter. Every time the thread interval reaches, the counter is incremented by 1
I: The 1000 interval is 1000 microseconds (us)
Min: Minimum latency (us)
Act: Last latency (us)
Avg: average latency (us)
Max: Maximum latency (us)
Therefore, the minimum latency on our current machine is 2, with an average of 15 and the maximum latency is 195.
$ Uname-a // we can use "uname-a" to view the kernel version currently used by our system
Linux wheezy 3.2.51-trace #8 SMP Thu Nov 21 12:34:04 CST 2013 x86_64 GNU/Linux
$ Cat/boot/config-3.2.51-trace | grep CONFIG_PREEMPT_RT // we open the current kernel config information under/boot to check whether the current kernel is installed with real-time patches, the results show that there is no. Therefore, the data such as Min: 2 Act: 15 Avg: 15 Max: 195 tested in a common kernel is good!
$ Cat/boot/config-3.10.17-trace-rt12 | grep CONFIG_PREEMPT_RT // while in another kernel under my/boot directory with real-time Patching
CONFIG_PREEMPT_RT_BASE = y
# CONFIG_PREEMPT_RTB is not set
CONFIG_PREEMPT_RT_FULL = y // determines whether a kernel is a real-time kernel. check whether this item is available in config.
The running result of javasictest is as follows:
T: 0 (5592) P: 80 I: 10000 C: 10000 Min: 1 Act: 1 Avg: 2 Max: 9
:-), The running results are obvious to all. I will introduce real-time patches for Linux kernel in my blog later.
2.2 Introduction to the parameters of javasictest the specific meanings of each parameter. It is recommended that you use time to take a look at the details of javasictest -- help (see [2] for each of my senior students under -- help parameter explanation, you can also take a look !) I will only introduce several common ones here. -P PRIO -- prio = PRIO the method for using the highest priority thread is-p 90/-- prio = 90
-M -- mlockall: Lock current and future memory allocation
-C CLOCK -- clock = CLOCK select CLOCK clock ictest-c 1
0 = CLOCK_MONOTONIC (default)
1 = CLOCK_REALTIME
-I INTV -- interval = INTV basic thread interval. The default value is 1000 (the unit is us). The following describes the principle.
-L LOOPS -- loops = number of LOOPS cycles. The default value is 0 (infinite). Combined with the-I interval, the test time can be roughly calculated, for example, for-I 1000-l 1000000, the total cycle time is 1000*1000000 = 1000000000 us = 1000 s, so it is about 16 minutes.
-N -- nanosleep uses clock_nanosleep
-H HISTNUM -- histogram = US after execution, draw a latency histogram on the standard output device (many threads have the same permissions). US is the maximum tracking time limit, this can be used in the following example. We can use gnuplot to draw the test result diagram.
-Q -- quiet does not print information when running with the-q Parameter. It only prints the summary content when exiting, combined with the-h HISTNUM parameter, the histnum row statistics and a general summary are printed at exit.
-F -- ftrace function tracking (usually used together with-B. In fact,-B is usually used instead of-f)
-B USEC -- breaktrace = USEC: When the latency is greater than the value specified by USEC, send the stop trace. USEC, in the unit of second (us ). 2.3 Recommended parameters and result instance dslab @ wheezy :~ $ Sudo shortictest-p 90-m-c 0-I 200-n-h 100-q-l 1000000 we use-p 90 to assign priority to cyclictest 90, use the-m parameter to lock memory allocation, use-c 0 to specify the use of the default MONOTONIC clock,-I 200 to specify a cycle of 1000000 us, combined with-l 1000000 for a total of cycles, in addition,-n uses nanosleep instead of simple sleep,-q does not print instant information at runtime, and-h 100 counts a total of 100 pieces of information in the final result.
#/Dev/cpu_dma_latency set to 0us ------------------------------------------------- (the following are the information printed after the end test/terminal test. This is the function of-q !)
# Histogram
000000 000000
000001 111448 -- 1000000 of the 111448 cycles with 1 US latency (this is the meaning of each line below)
000002 060272
000003 000714
000004 000344
000005 000231
000006 013170
000007 155289
000008 601393
000009 044880
000010 005348
000011 001821
000012 001444
000013 000945
000014 000538
000015 000376
000016 000344
... 000096 000002
000097 000002
000098 000002
000099 000002 -- we use-h 100, so the latency recorded in the result is 0 us ~ Number of 99us
# Total: 000999888
# Min Latencies: 00001 -- Minimum latency 1 us
# Avg Latencies: 00006 -- average latency of 6 us
# Max Latencies: 00463 -- maximum latency of 463 us, then we specify histogram = 100, that is, only 0us ~ is recorded ~ The maximum latency of 99us is 463. That is to say, there must be many such latencies that exceed 99 us. So where is the record? The answer is: no specific latency value greater than 99us is recorded, and only the number of latencies greater than 99us is recorded below (recorded in Overflows ), and the number of times exceeds (recorded in Thread 0 ).
# Histogram Overflows: 00112 -- number of times more than 99 us
# Histogram Overflow at cycle number:
# Thread 0: 02985 06044 06107 08644 08683 12048 18136 30164 33172 33757 36214 48208 54138 58822 61284 83843 83876 86382 92351 92352 96306 108937 108941 111443 117367 129130 129131 146426 155069 155070 159058 161563 171486 184200 186614 209260 211606 221606 223526 223527 234275 234321 236827 241705 241706 246766 266826 296886 321946 334644 336979 337006 359705 367066 384765 392126 412186 437221 4422 46 462306 472306 484921 487366 497366 507426 509981 512448 512488 522426 542486 567546 587606 610305 617666 635365 637704 637726 660425 672686 692846 710379 710463 717806 735443 737919 742886 760582 763088 767946 785515 785642 788149 793086 806776 808146 810703 813146 835661 835847 838172 #00012 others // here the latency of the first loop exceeds 99us.