Merge pull request #734 from syohex/syohex/perf-kmem
Update 'perf kmem' completion
This commit is contained in:
		
						commit
						bb61ca2a97
					
				
							
								
								
									
										36
									
								
								src/_perf
								
								
								
								
							
							
						
						
									
										36
									
								
								src/_perf
								
								
								
								
							|  | @ -101,6 +101,24 @@ _perf_trace_subcommand() { | ||||||
|   _alternative "_command_names -e" "subcommand:command:(record)" |   _alternative "_command_names -e" "subcommand:command:(record)" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | _perf_kmem_sort_keys() { | ||||||
|  |   local -a keys=(ptr callsite bytes hit pingpong frag page order migtype gfp) | ||||||
|  | 
 | ||||||
|  |   for ((i = 1; i < CURRENT; i++)) | ||||||
|  |   do | ||||||
|  |     if [[ $words[$i] == "--slab" ]]; then | ||||||
|  |       keys=(ptr callsite bytes hit pingpong frag) | ||||||
|  |       break | ||||||
|  |     fi | ||||||
|  |     if [[ $words[$i] == "--page" ]]; then | ||||||
|  |       keys=(page callsite hit order migtype gfp) | ||||||
|  |       break | ||||||
|  |     fi | ||||||
|  |   done | ||||||
|  | 
 | ||||||
|  |   _values -s ',' 'key' $keys | ||||||
|  | } | ||||||
|  | 
 | ||||||
| _perf() { | _perf() { | ||||||
|   local context curcontext="$curcontext" state line |   local context curcontext="$curcontext" state line | ||||||
|   typeset -A opt_args |   typeset -A opt_args | ||||||
|  | @ -255,14 +273,20 @@ _perf() { | ||||||
|             && ret=0 |             && ret=0 | ||||||
|         ;; |         ;; | ||||||
|         (kmem) |         (kmem) | ||||||
|           # TODO Complete 'record' command |  | ||||||
|           _arguments \ |           _arguments \ | ||||||
|             '(-i --input)'{-i,--input=}'[input file name]: :_files' \ |             '(-i --input)'{-i,--input=}'[input file name]: :_files' \ | ||||||
|  |             '(-f --force)'{-f,--force}'[dont do ownership validation]' \ | ||||||
|             '--caller[show per-callsite statistics]' \ |             '--caller[show per-callsite statistics]' \ | ||||||
|             '--alloc[show per-allocation statistics]' \ |             '--alloc[show per-allocation statistics]' \ | ||||||
|             '(-s --sort)'{-s,--sort=}'[sort by output]: :_values -s , key frag hit bytes' \ |             '(-s --sort)'{-s,--sort=}'[sort by output]: :_perf_kmem_sort_keys' \ | ||||||
|             '(-n --lines)'{-n,--lines}'[print n lines only]:number' \ |             '(-n --lines)'{-n,--lines}'[print n lines only]:number' \ | ||||||
|  |             '--raw-ip[print raw ip instead of symbol]' \ | ||||||
|  |             '--slab[analyze slab allocator events]' \ | ||||||
|  |             '--page[analyze page allocator events]' \ | ||||||
|  |             '--live[show live page stat]' \ | ||||||
|  |             '--time=[only analyze samples within given time window]:time_window:' \ | ||||||
|             '1:command:((record\:record\ the\ kmem\ events\ of\ an\ arbitrary\ workload stat\:report\ kernel\ memory\ statistics))' \ |             '1:command:((record\:record\ the\ kmem\ events\ of\ an\ arbitrary\ workload stat\:report\ kernel\ memory\ statistics))' \ | ||||||
|  |             '*:: :->kmem_args' \ | ||||||
|             && ret=0 |             && ret=0 | ||||||
|         ;; |         ;; | ||||||
|         (kvm) |         (kvm) | ||||||
|  | @ -754,6 +778,14 @@ _perf() { | ||||||
|           && ret=0 |           && ret=0 | ||||||
|       fi |       fi | ||||||
|     ;; |     ;; | ||||||
|  |     (kmem_args) | ||||||
|  |       if [[ $words[1] == "record" ]]; then | ||||||
|  |         _arguments \ | ||||||
|  |           '1:command:_command_names -e' \ | ||||||
|  |           '*::args:_normal' \ | ||||||
|  |           && ret=0 | ||||||
|  |       fi | ||||||
|  |     ;; | ||||||
|     (lock_args) |     (lock_args) | ||||||
|       case $words[1] in |       case $words[1] in | ||||||
|         (record) |         (record) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue