From ab17b682be975b919bc42d5f87c1b5e181ea3b50 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 14 May 2020 21:12:03 +0900 Subject: [PATCH] Implement 'perf bench' subsystem and suite completion --- src/_perf | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/src/_perf b/src/_perf index 162c0c1..fbf2246 100644 --- a/src/_perf +++ b/src/_perf @@ -136,12 +136,11 @@ _perf() { && ret=0 ;; (bench) - # TODO Complete subsystems - # TODO Complete suites _arguments \ - '(-f --format)'{-f,--format=}'[specify format style]: :((default\:mainly\ for\ human\ reading simple\:friendly\ for\ automated\ processing\ by\ scripts))' \ - '1::subsystem' \ - '2::suite' \ + '(-r --repeat)'{-r,--repeat=}'[specify amount of times to repeat the run]' \ + '(-f --format)'{-f,--format=}'[specify format style]: :(default simple)' \ + '1:subsystem:(sched mem numa futex epoll all)' \ + '*:: :->bench_subsystem' \ && ret=0 ;; (buildid-cache) @@ -625,6 +624,37 @@ _perf() { esac case $state in + (bench_subsystem) + case $words[1] in + (sched) + _arguments \ + '1:suite:(messaging pipe)' \ + '*:: :->bench_sched_suite' \ + && ret=0 + ;; + (mem) + _arguments \ + '1:suite:(memcpy memset)' \ + '*:: :->bench_mem_suite' \ + && ret=0 + ;; + (numa) + _arguments \ + '1:suite:(mem)' \ + && ret=0 + ;; + (futex) + _arguments \ + '1:suite:(hash wake wake-parallel requeue lock-pi)' \ + && ret=0 + ;; + (epoll) + _arguments \ + '1:suite:(wait ctl)' \ + && ret=0 + ;; + esac + ;; (c2c_args) case $words[1] in (record) @@ -696,6 +726,34 @@ _perf() { fi ;; esac + + case $state in + (bench_sched_suite) + case $words[1] in + (messaging) + _arguments \ + '(-p --pipe)'{-p,--pipe}'[use pipe instead of socketpair]' \ + '(-t --thread)'{-t,--thread}'[be multi thread instead of multi process]' \ + '(-g --group)'{-g,--group=}'[specify number of groups]:number:' \ + '(-l --nr_loops)'{-l,--nr_loops=}['specify number of loops']\ + && ret=0 + ;; + (pipe) + _arguments \ + '(-l --loop)'{-l,--loop}'[specify number of loops]:number:' \ + && ret=0 + esac + ;; + (bench_mem_suite) + # memcpy and memset support same options + _arguments \ + '(-l --size)'{-l,--size=}'[specify size of memory to copy]:size:' \ + '(-f --function)'{-f,--function=}'[specify function to copy]:function:' \ + '(-l --nr_loops)'{-l,--nr_loops=}'[repeat memcpy invocation this number of times]:number:' \ + '(-c --cycles)'{-c,--cycles}'[use perf cpu-cycles event instead of gettimeofday]' \ + && ret=0 + ;; + esac } # FIXME Parse 'perf --help' instead of hard-coding.