• cyclictest 的使用


    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 画出 抖动的分布

  • 相关阅读:
    HTTPD之五---HTTP协议、相关工具及状态码
    HTTPD之四----实现HTTPD正向代理与反向代理
    第十三周---DNS原理、实现智能DNS及源码编译mariadb数据库
    DNS之五----实现智能DNS
    sqoop 导入增量数据到hive
    Hadoop 二次排序
    Spark foreachpartiton和mappartition的异同
    hadoop 实现多文件输出
    spark 实现多文件输出
    Scala 中 call by name & call by value 的区别
  • 原文地址:https://www.cnblogs.com/sophiascpn/p/13796645.html
Copyright © 2020-2023  润新知