cyclictest 的使用

來源:互聯網
上載者:User

cyclictest測試核心的效能。
1。安裝 cyclictest工具.
參考網址:https://rt.wiki.kernel.org/index.php/Cyclictest
2.使用:
cyclictest --help
cyclictest V 0.72
Usage:
cyclictest <options>

-a [NUM] --affinity        run thread #N on processor #N, if possible
                           with NUM pin all threads to the processor NUM//在N#處理器上運行N#線程 cyclictest -a [3]
-b USEC  --breaktrace=USEC send break trace command when latency > USEC //當延時大於USEC指定的值時,發送停止跟蹤。USEC,單位為謬秒。 cyclictest -b 20
-B       --preemptirqs     both preempt and irqsoff tracing (used with -b)//和 -b一起使用。preempt(搶佔)和 irqsoff同時跟蹤。cyclictest -b 100 -B
-c CLOCK --clock=CLOCK     select clock//選擇時鐘  cyclictest -c 1
                           0 = CLOCK_MONOTONIC (default)
                           1 = CLOCK_REALTIME
-C       --context         context switch tracing (used with -b)//環境切換跟蹤(和-b一起使用)
-d DIST  --distance=DIST   distance of thread intervals in us default=500//線程間隔(預設為500)
-D       --duration=t      specify a length for the test run//指定要測試多長時間。預設單位是秒,但是也可以指定m(分),h(小時),d(天)
                           default is in seconds, but 'm', 'h', or 'd' maybe added
                           to modify value to minutes, hours or days
-E       --event           event tracing (used with -b)//事件跟蹤,和 -b一起使用
-f       --ftrace          function trace (when -b is active)//函數跟蹤(-b 為啟用的)
-h       --histogram=US    dump a latency histogram to stdout after the run//在執行完後在標準輸出裝置上畫出延遲的長條圖(很多線程有相同的許可權)US為最大的跟蹤時間限制(單位為毫秒)。
                           (with same priority about many threads)
                           US is the max time to be be tracked in microseconds
-i INTV  --interval=INTV   base interval of thread in us default=1000//基本線程間隔,預設為1000us
-I       --irqsoff         Irqsoff tracing (used with -b)//插斷要求關閉  跟蹤
-l LOOPS --loops=LOOPS     number of loops: default=0(endless)//迴圈的個數,預設為0(無窮個)
-m       --mlockall        lock current and future memory allocations//鎖定當前和將來的記憶體配置
-M       --refresh_on_max  delay updating the screen until a new max latency is hit//延遲更新螢幕直到新的延時周期的到來
-n       --nanosleep       use clock_nanosleep
-N       --nsecs           print results in ns instead of us (default us)//每ns列印一次結果,而不是us(預設是us)
-o RED   --oscope=RED      oscilloscope mode, reduce verbose output by RED//示波器模式,減少冗長的輸出通過RED
-O TOPT  --traceopt=TOPT   trace option//跟蹤選項
-p PRIO  --prio=PRIO       priority of highest prio thread//最高優先順序線程的優先順序
-P       --preemptoff      Preempt off tracing (used with -b)//跟蹤搶佔關閉(和-b一起使用)
-q       --quiet           print only a summary on exit//退出時只列印概要內容
-r       --relative        use relative timer instead of absolute//使用相對時間而非絕對時間
-s       --system          use sys_nanosleep and sys_setitimer//使用 sys_nanosleep 和 sys_setitimer
-t       --threads         one thread per available processor//每個可用的處理器一個線程
-t [NUM] --threads=NUM     number of threads://線程的個數,不指定 NUM 時,線程個數為max_cups,沒有 -t 選項時,線程個數為1
                           without NUM, threads = max_cpus
                           without -t default = 1
-T TRACE --tracer=TRACER   set tracing function//設定跟蹤函數
    configured tracers: unavailable (debugfs not mounted)
-u       --unbuffered      force unbuffered output for live processing//對活動的進程強製為無緩衝輸出
-v       --verbose         output values on stdout for statistics//把統計資料輸出到標準輸出
                           format: n:c:v n=tasknum c=count v=value in us// n=任務個數 c=計數 v=數值(單位:us)
-w       --wakeup          task wakeup tracing (used with -b)//任務喚醒跟蹤(和 -b 一起使用)
-W       --wakeuprt        rt task wakeup tracing (used with -b)//即時任務喚醒跟蹤
-y POLI  --policy=POLI     policy of realtime thread, POLI may be fifo(default) or rr//即時線程的調度規則,可以是 fifo(預設) 或者 rr 格式為: --ploicy=fifo 或者 rr
                           format: --policy=fifo(default) or --policy=rr
-S       --smp             Standard SMP testing: options -a -t -n and     //標準 SMP 測試:選項 -a -t -n 並且所有的線程要優先順序相同
                           same priority of all threads
-U       --numa            Standard NUMA testing (similar to SMP option)//標準NUMA測試(和SMP選項類似)
                           thread data structures allocated from local node//線程資料結構由本地模式分配

解釋:
-b 是一個即時搶佔補丁的控制延時跟蹤的選項。
在一個系統中跟蹤意外的大的延時是很有用的。這個選項只在核心編譯時間,有如下的配置選項時有作用:
    * CONFIG_PREEMPT_RT=y
    * CONFIG_WAKEUP_TIMING=y
    * CONFIG_LATENCY_TRACE=y
    * CONFIG_CRITICAL_PREEMPT_TIMING=y
    * CONFIG_CRITICAL_IRQSOFF_TIMING=y
-b 選項的參數 USEC 定義了一個最大延時值。這個值用來和測試的實際值進行比較。一個測量的延時大於USEC給定的值,核心跟蹤和cyclictest將停止。跟蹤可以從 /proc/latency_trace mybox中讀出
#cat /proc/latency_trace > trace.log //註:我的沒找到*******
請注意,跟蹤給核心加上了不可忽略的負擔,所以跟蹤測試的延時明顯比禁用核心跟蹤時要長。
-c CLOCK 選擇使用的時鐘。
0:選擇了 CLOCK_MONOTONIC,這簡單的增加系統時間。這是預設的選項。
1:選擇 CLOCK_REALTIME,which is the time of day time.
CLOCK_REALTIME 可以由 settimeofday 設定。然而,CLOCK_MONOTONIC 不可被使用者修改。
這個選項在 -s 指定時 不起作用。
-d DIST 設定線程間間隔,單位為us(預設為 500us)。當調用 cylictest 時使用了 -t 選項時並且超過一個線程被建立,那麼這個間隔值被增加到線程之間。間隔(線程 N)=間隔(線程 N-1) + DIST
-i INTV 設定線程間隔的基準,單位是us(預設為1000us),這設定了第一個線程的的間隔。
-l LOOPS 設定迴圈的次數(預設為0,表示 永遠運行)
    這個選項對給定了測試迴圈的自動化的測試是很有用的。當計時器的間隔的計數值到達時,cyclictest 停止。
-n 使用 clock_namosleep 代替標準的間隔計時器。
-p PRIO 設定第一個線程的優先順序。 給出的優先順序用來設定第一個測試線程。每個新的線程給一個更低的優先順序。 優先順序(線程N)=優先順序(線程N-1)-1 (後面的 -1為譯者加上的)
-q 退出後僅列印概要情況。這對自動化的測試是很有用的,只有概要的輸出被捕獲。
-r 指定使用相對時間而不是絕對時間。 預設的是使用絕對時間來測試的。這個選項是為了確保完整性。在可重複的測試中不能使用。
-s 使用 sys_nanosleep 和 sys_setitimer 而不是 posix計時器
    注意,-s 只可以用在一個線程的情況下,因為每個進程一個itimers,而不是每個線程。-s 和-n 一起指定使用nanosleep系統調用,不限於一個線程。
-t NUM 設定線程的個數。預設為1個。 使用未指定參數的-t 將產生的線程數量和cpu個數一樣。

如下,為簡單的使用。
 cyclictest -t1 -p 80 -n -i 10000 -l 10000

$ sudo -i//切換為root
**** WARNING: High resolution timers not available // 有問題。http://comments.gmane.org/gmane.linux.rt.user/1401
不知道怎麼回事。[try to enable ACPI on the box and check if you get an acpi_pm]http://www.thinkwiki.org/wiki/How_to_make_ACPI_work
    http://www.columbia.edu/~ariel/acpi/acpi_howto.txt
T: 0 ( 7321) P: 0 I:1000 C:    334 Min:    351 Act:999375 Avg:499831 Max:  999375 //資料項目含義

P:跟最高優先順序線程的優先順序。
------------------------
cyclictest  -p 10 -t 10
T: 0 ( 8944) P:10 I:1000 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0
T: 1 ( 8945) P: 9 I:1500 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0
T: 2 ( 8946) P: 8 I:2000 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0
T: 3 ( 8947) P: 7 I:2500 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0
T: 4 ( 8948) P: 6 I:3000 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0
T: 5 ( 8949) P: 5 I:3500 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0
T: 6 ( 8950) P: 4 I:4000 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0
T: 7 ( 8951) P: 3 I:4500 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0
T: 8 ( 8952) P: 2 I:5000 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0
T: 9 ( 8953) P: 1 I:5500 C:      0 Min:1000000 Act:    0 Avg:    0 Max:       0

使用 gnuplot 畫出 抖動的分布

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.