1. 24 3月, 2015 8 次提交
  2. 23 3月, 2015 7 次提交
  3. 22 3月, 2015 17 次提交
  4. 21 3月, 2015 4 次提交
  5. 20 3月, 2015 4 次提交
    • W
      perf report: Don't allow empty argument for '-t'. · 0c8c2077
      Wang Nan 提交于
      Without this patch, perf report cause segfault if pass "" as '-t':
      
        $ perf report -t ""
      
         # To display the perf.data header info, please use --header/--header-only options.
         #
         # Samples: 37  of event 'syscalls:sys_enter_write'
         # Event count (approx.): 37
         #
         # Children    SelfCommand   Shared Object         Symbol
         Segmentation fault
      
      Since -t is used to add field-separator for generate table, -t "" is
      actually meanless. This patch defines a new OPT_STRING_NOEMPTY() option
      generator to ensure user never pass empty string to that option.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: pi3orama@163.com
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Link: http://lkml.kernel.org/r/1426251114-198991-1-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0c8c2077
    • W
      perf callchain: Separate eh/debug frame offset cache. · 303cb89a
      Wang Nan 提交于
      Commit f1f13af9 ("perf callchain: Cache eh/debug frame offset for
      dwarf unwind") introduces a cache for .debug_frame and .eh_frame_hdr.
      Unfortunately, it makes them share a same cache (dso->frame_offset).
      Which causes unwind failure on ARM:
      
         $ perf test unwind
        Test dwarf unwind: FAILED!
      
      The reason is that, if a dso has '.debug_frame' but doesn't have
      '.eh_frame_hdr' (like ARM), dso->frame_offset will be filled by offset
      of '.debug_frame' during the first time calling of find_proc_info() ->
      read_unwind_spec_debug_frame(), and be regarded to '.eh_frame_hdr' when
      the second time calling of find_proc_info() ->
      read_unwind_spec_eh_frame(), since '.eh_frame_hdr' is checked prior to
      '.debug_frame'.
      
      This patch solves the problem by creating two cache fields for
      '.eh_frame_hdr' and '.debug_frame'.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Link: http://lkml.kernel.org/r/55028BA0.1030701@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      303cb89a
    • Y
      perf tools: Avoid confusion with preloaded bash function for perf bash completion · 1312c8a8
      Yunlong Song 提交于
      Since some functions (e.g. '_get_comp_words_by_ref()') in perf bash
      completion script are originally taken from git bash completion script,
      these functions may be preloaded before perf bash completion script
      runs.
      
      In order to avoid repeating loading the same function twice, some test
      constraints are used before these function definitions in the perf bash
      completion script (e.g. 'type _get_comp_words_by_ref &>/dev/null ||').
      
      The problem is that, if these functions in perf bash completion script
      are changed for some reason, perf will still use the preloaded bash
      functions rather than the customized functions of its own.
      
      As a result, the perf bash completion will behave incorrectly. To get
      rid of this problem, a flag can be defined to determine the proper
      situation.
      
      And to avoid overwriting the preloaded functions, the names of these
      functions in perf bash completion script should be renamed to the
      perf-customized ones.
      
      Example:
      
      Before this patch:
      
       $ type _get_comp_words_by_ref
       _get_comp_words_by_ref is a function
       _get_comp_words_by_ref ()
       {
           local exclude flag i OPTIND=1;
           local cur cword words=();
           local upargs=() upvars=() vcur vcword vprev vwords;
           while getopts "c:i:n:p:w:" flag "$@"; do
               case $flag in
                   c)
                       vcur=$OPTARG
                   ;;
                   i)
                       vcword=$OPTARG
                   ;;
                   n)
                       exclude=$OPTARG
                   ;;
                   p)
                       vprev=$OPTARG
                   ;;
                   w)
                       vwords=$OPTARG
                   ;;
               esac;
           done;
           while [[ $# -ge $OPTIND ]]; do
               case ${!OPTIND} in
                   cur)
                       vcur=cur
                   ;;
                   prev)
                       vprev=prev
                   ;;
                   cword)
                       vcword=cword
                   ;;
                   words)
                       vwords=words
                   ;;
                   *)
                       echo "bash: $FUNCNAME(): \`${!OPTIND}': unknown argument" 1>&2;
                       return 1
                   ;;
               esac;
               let "OPTIND += 1";
           done;
           __get_cword_at_cursor_by_ref "$exclude" words cword cur;
           [[ -n $vcur ]] && {
               upvars+=("$vcur");
               upargs+=(-v $vcur "$cur")
           };
           [[ -n $vcword ]] && {
               upvars+=("$vcword");
               upargs+=(-v $vcword "$cword")
           };
           [[ -n $vprev && $cword -ge 1 ]] && {
               upvars+=("$vprev");
               upargs+=(-v $vprev "${words[cword - 1]}")
           };
           [[ -n $vwords ]] && {
               upvars+=("$vwords");
               upargs+=(-a${#words[@]} $vwords "${words[@]}")
           };
           (( ${#upvars[@]} )) && local "${upvars[@]}" && _upvars "${upargs[@]}"
       }
      
      As shown above, the _get_comp_words_by_ref is the preloaded function in
      fact, rather than the function defined in perf-completion.sh. So if we
      happen to change the function for some reason, the result will behave in
      a wrong state.
      
      After this patch:
      
      We can set preload_get_comp_words_by_ref="false" to not use the preloaded
      function. Instead, it will use the function defined in perf-completion.sh,
      which is renamed as __perf_get_comp_words_by_ref to avoid overwriting
      the preloaded function _get_comp_words_by_ref.
      
       $ type __perf_get_comp_words_by_ref
       __perf_get_comp_words_by_ref is a function
       __perf_get_comp_words_by_ref ()
       {
           local exclude cur_ words_ cword_;
           if [ "$1" = "-n" ]; then
               exclude=$2;
               shift 2;
           fi;
           __my_reassemble_comp_words_by_ref "$exclude";
           cur_=${words_[cword_]};
           while [ $# -gt 0 ]; do
               case "$1" in
                   cur)
                       cur=$cur_
                   ;;
                   prev)
                       prev=${words_[$cword_-1]}
                   ;;
                   words)
                       words=("${words_[@]}")
                   ;;
                   cword)
                       cword=$cword_
                   ;;
               esac;
               shift;
           done
       }
      
      As shown above, the function __perf_get_comp_words_by_ref is loaded and
      can work this time.
      
      Note that we do not change the original behavior when those functions are
      not preloaded before perf bash completion script runs. In this case,
      although the flag is set to "true", the code will still change it to
      "false" to use the function defined in perf-completion.sh.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1426685758-25488-14-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1312c8a8
    • Y
      perf tools: Add the bash completion for listing subsubcommands of perf trace · 6fdd9cb7
      Yunlong Song 提交于
      The bash completion does not support listing subsubcommands for 'perf
      trace <TAB>', so fix it.
      
      Example:
      
      Before this patch:
      
       $ perf trace <TAB>
       $
      
      As shown above, the subsubcommands of perf trace does not come out.
      
      After this patch:
      
       $ perf trace <TAB>
       record
      
      As shown above, the subsubcommands of perf trace can come out now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1426685758-25488-13-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6fdd9cb7