1. 07 8月, 2015 9 次提交
  2. 06 8月, 2015 6 次提交
  3. 05 8月, 2015 6 次提交
    • K
      perf tools: Per-event time support · 32067712
      Kan Liang 提交于
      This patchkit adds the ability to turn off time stamps per event.
      
      One usaful case for partial time is to work with per-event callgraph to
      enable "PEBS threshold > 1" (https://lkml.org/lkml/2015/5/10/196), which
      can significantly reduce the sampling overhead.
      
      The event samples with time stamps off will not be ordered.
      Signed-off-by: NKan Liang <kan.liang@intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1438677022-34296-2-git-send-email-kan.liang@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      32067712
    • A
      perf trace: Use vfs_getname syscall arg beautifier in more syscalls · 34221118
      Arnaldo Carvalho de Melo 提交于
      Those were covered and tested in this cset:
      
       access, chdir, chmod, chown, chroot, creat, getxattr,
       inotify_add_watch, lchown, lgetxattr, listxattr,
       lsetxattr, mkdir, mkdirat, mknod, rmdir, faccessat,
       newfstatat, openat, readlink, readlinkat, removexattr,
       setxattr, statfs, swapon, swapoff, truncate, unlinkat,
       utime, utimes, utimensat.
      
      E.g.:
      
        # trace -e statfs,access,mkdir mkdir /tmp/bla
         0.285 (0.020 ms): mkdir/2799 access(filename: /etc/ld.so.preload, mode: R         ) = -1 ENOENT No such file or directory
         1.070 (0.032 ms): mkdir/2799 statfs(pathname: /sys/fs/selinux, buf: 0x7ffeafbdc930) = 0
         1.087 (0.013 ms): mkdir/2799 statfs(pathname: /sys/fs/selinux, buf: 0x7ffeafbdc820) = 0
         1.189 (0.014 ms): mkdir/2799 access(filename: /etc/selinux/config                 ) = 0
         1.905 (0.610 ms): mkdir/2799 mkdir(pathname: /tmp/bla, mode: 511                  ) = 0
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Milian Wolff <mail@milianw.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-wbqtnlktquun3wtpjdz3okul@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      
        and an empty message aborts the commit.
      34221118
    • A
      perf trace: Deref sys_enter pointer args with contents from probe:vfs_getname · f994592d
      Arnaldo Carvalho de Melo 提交于
      To work like strace and dereference syscall pointer args we need to
      insert probes (or tracepoints) right after we copy those bytes from
      userspace.
      
      Since we're formatting the syscall args at raw_syscalls:sys_enter time,
      we need to have a formatter that just stores the position where, later,
      when we get the probe:vfs_getname, we can insert the pointer contents.
      
      Now, if a probe:vfs_getname with this format is in place:
      
       # perf probe -l
        probe:vfs_getname (on getname_flags:72@/home/git/linux/fs/namei.c with pathname)
      
      That was, in this case, put in place with:
      
       # perf probe 'vfs_getname=getname_flags:72 pathname=filename:string'
       Added new event:
        probe:vfs_getname    (on getname_flags:72 with pathname=filename:string)
      
       You can now use it in all perf tools, such as:
      
      	perf record -e probe:vfs_getname -aR sleep 1
       #
      
      Then 'perf trace' will notice that and do the pointer -> contents
      expansion:
      
       # trace -e open touch /tmp/bla
        0.165 (0.010 ms): touch/17752 open(filename: /etc/ld.so.cache, flags: CLOEXEC) = 3
        0.195 (0.011 ms): touch/17752 open(filename: /lib64/libc.so.6, flags: CLOEXEC) = 3
        0.512 (0.012 ms): touch/17752 open(filename: /usr/lib/locale/locale-archive, flags: CLOEXEC) = 3
        0.582 (0.012 ms): touch/17752 open(filename: /tmp/bla, flags: CREAT|NOCTTY|NONBLOCK|WRONLY, mode: 438) = 3
       #
      
      Roughly equivalent to strace's output:
      
       # strace -rT -e open touch /tmp/bla
        0.000000 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 <0.000039>
        0.000317 open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 <0.000102>
        0.001461 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 <0.000072>
        0.000405 open("/tmp/bla", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 3 <0.000055>
        0.000641 +++ exited with 0 +++
       #
      
      Now we need to either look for at all syscalls that are marked as
      pointers and have some well known names ("filename", "pathname", etc)
      and set the arg formatter to the one used for the "open" syscall in this
      patch.
      
      This implementation works for syscalls with just a string being copied
      from userspace, for matching syscalls with more than one string being
      copied via the same probe/trace point (vfs_getname) we need to extend
      the vfs_getname probe spec to include the pointer too, but there are
      some problems with that in 'perf probe' or the kernel kprobes code, need
      to investigate before considering supporting multiple strings per
      syscall.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Milian Wolff <mail@milianw.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-xvuwx6nuj8cf389kf9s2ue2s@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f994592d
    • A
      perf trace: Use a constant for the syscall formatting buffer · e4d44e83
      Arnaldo Carvalho de Melo 提交于
      We were using it as a magic number, 1024, fix that.
      
      Eventually we need to stop doing it per line, and do it per
      arg, traversing the args at output time, to avoid the memmove()
      calls that will be used in the next cset to replace pointers
      present at raw_syscalls:sys_enter time with its contents that
      appear at probe:vfs_getname time, before raw_syscalls:sys_exit
      time.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Milian Wolff <mail@milianw.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-4sz3wid39egay1pp8qmbur4u@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e4d44e83
    • A
      perf trace: Remember if the vfs_getname tracepoint/kprobe is in place · 08c98776
      Arnaldo Carvalho de Melo 提交于
      So that we can later decide if we will store where to expand the
      pathname once we are handling vfs_getname or if we should instead
      just go on and straight away print the pointer.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Milian Wolff <mail@milianw.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-ytxk5s5jpc50wahffmlxgxuw@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      08c98776
    • A
      perf trace: Do not show syscall tracepoint filter in the --no-syscalls case · 2e5e5f87
      Arnaldo Carvalho de Melo 提交于
      We were accessing trace->syscalls.events members even when that struct
      wasn't initialized, i.e. --no-syscalls was specified on the command
      line, fix it to show that, still in debug mode, when we have an event
      qualifier list, i.e. when we actually are doing subset syscall tracing.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Milian Wolff <mail@milianw.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Fixes: 19867b61 ("perf trace: Use event filters for the event qualifier list")
      Link: http://lkml.kernel.org/n/tip-7980ym6vujgh3yiai0cqzc88@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e5e5f87
  4. 04 8月, 2015 1 次提交
  5. 30 7月, 2015 4 次提交
  6. 29 7月, 2015 7 次提交
    • A
      perf session env: Rename exit method · 4c7de49a
      Arnaldo Carvalho de Melo 提交于
      The semantic associated in tools/perf/ with foo__delete(instance) is to
      release all resources referenced by 'instance' members and then release
      the memory for 'instance' itself.
      
      The perf_session_env__delete() function isn't doing this, it just does
      the first part, but the space used by 'instance' itself isn't freed, as
      it is embedded in a larger structure, that will be freed at other stage.
      
      For these cases we se foo__exit(), i.e. the usage is:
      
       void foo__delete(foo)
       {
               if (foo) {
                       foo__exit(foo);
                       free(foo);
               }
       }
      
      But when we have something like:
      
       struct bar {
               struct foo foo;
               . . .
       }
      
      Then we can't really call foo__delete(&bar.foo), we must have this
      instead:
      
       void bar__exit(bar)
       {
               foo__exit(&bar.foo);
               /* free other bar-> resources */
       }
      
       void bar__delete(bar)
       {
               if (bar) {
      		bar__exit(bar);
                      free(bar);
               }
       }
      
      So just rename perf_session_env__delete() to perf_session_env__exit().
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-djbgpcfo5udqptx3q0flwtmk@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4c7de49a
    • A
      perf symbols: Fix mismatched declarations for elf_getphdrnum · f785f235
      Arnaldo Carvalho de Melo 提交于
      When HAVE_ELF_GETPHDRNUM_SUPPORT is false we trip on this problem:
      
          CC       /tmp/build/perf/util/symbol-elf.o
        util/symbol-elf.c:41:12: error: static declaration of ‘elf_getphdrnum’ follows non-static declaration
         static int elf_getphdrnum(Elf *elf, size_t *dst)
                  ^
        In file included from util/symbol.h:19:0,
                         from util/symbol-elf.c:8:
        /usr/include/libelf.h:206:12: note: previous declaration of ‘elf_getphdrnum’ was here
         extern int elf_getphdrnum (Elf *__elf, size_t *__dst);
                  ^
          MKDIR    /tmp/build/perf/bench/
        /home/git/linux/tools/build/Makefile.build:68: recipe for target '/tmp/build/perf/util/symbol-elf.o' failed
        make[3]: *** [/tmp/build/perf/util/symbol-elf.o] Error 1
      
      Fix it.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-qcmekyfedmov4sxr0wahcikr@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f785f235
    • A
      perf python: Make twatch.py use soft dummy event, freq=0 · 58b32c1b
      Arnaldo Carvalho de Melo 提交于
      To not sample, what we want are just the PERF_RECORD_ lifetime events
      for threads, using the default, PERF_TYPE_HARDWARE +
      PERF_COUNT_HW_CYCLES and freq=1 (the default), makes perf reenable
      irq_vectors:local_timer_entry, disabling nohz, not good for some use
      cases where all we want is to get notifications when threads comes and
      goes...
      
      Fix it by using PERF_TYPE_SOFTWARE (no counter rotation) and
      PERF_COUNT_SW_DUMMY (created by Adrian so that we could have access to
      those PERF_RECORD_ goodies).
      Reported-by: NLuiz Fernando Capitulino <lcapitulino@redhat.com>
      Suggested-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jaroslav Skarvada <jskarvad@redhat.com>
      Cc: Jeremy Eder <jeder@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-kfsijirfrs6xfhkcdxeoen06@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      58b32c1b
    • A
      perf python: Add missing PERF_RECORD_{MMAP2,AUX,etc} · 84576da2
      Arnaldo Carvalho de Melo 提交于
      Those were added to the kernel and tooling but we forgot to
      expose them via the python binding, fix it.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-sg1m6t2c58gchidfce4hmitg@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      84576da2
    • A
      perf python: Add macro to simplify maintainance of the constants array · 5865fe36
      Arnaldo Carvalho de Melo 提交于
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/n/tip-ffuchgsbr5mqu91xl9oggfss@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5865fe36
    • A
      perf python: Remove dependency on 'machine' methods · 959c2199
      Arnaldo Carvalho de Melo 提交于
      The python binding still doesn't provide symbol resolving facilities,
      but the recent addition of the trace_event__register_resolver() function
      made it add as a dependency the machine__resolve_kernel_addr() method,
      that in turn drags all the symbol resolving code.
      
      The problem:
      
        [root@zoo ~]# perf test -v python
        17: Try 'import perf' in python, checking link problems      :
        --- start ---
        test child forked, pid 6853
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        ImportError: /tmp/build/perf/python/perf.so: undefined symbol: machine__resolve_kernel_addr
        test child finished with -1
        ---- end ----
        Try 'import perf' in python, checking link problems: FAILED!
        [root@zoo ~]#
      
      Fix it by requiring this function to receive the resolver as a
      parameter, just like pevent_register_function_resolver(), i.e. do
      not explicitely refer to an object file not included in
      tools/perf/util/python-ext-sources.
      
        [root@zoo ~]# perf test python
        17: Try 'import perf' in python, checking link problems      : Ok
        [root@zoo ~]#
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Fixes: c3168b0d ("perf symbols: Provide libtraceevent callback to resolve kernel symbols")
      Link: http://lkml.kernel.org/n/tip-vxlhh95v2em9zdbgj3jm7xi5@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      959c2199
    • P
      perf tools: Fix test build error when bindir contains double slash · 0927beec
      Pawel Moll 提交于
      When building with a prefix ending with a slash, for example:
      
      	$ make prefix=/usr/local/
      
      one of the perf tests fail to compile due to BUILD_STR macro mishandling
      bindir_SQ string containing with two slashes:
      
      	-DBINDIR="BUILD_STR(/usr/local//bin)"
      
      with the following error:
      
      	  CC       tests/attr.o
      	tests/attr.c: In function ‘test__attr’:
      	tests/attr.c:168:50: error: expected ‘)’ before ‘;’ token
      	  snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR);
                                                        ^
      	tests/attr.c:176:1: error: expected ‘;’ before ‘}’ token
      	 }
      	 ^
      	tests/attr.c:176:1: error: control reaches end of non-void function [-Werror=return-type]
      	 }
      	 ^
      	cc1: all warnings being treated as errors
      
      This patch works around the problem by "cleaning" the bindir string
      using make's abspath function.
      Signed-off-by: NPawel Moll <pawel.moll@arm.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1438092613-21014-1-git-send-email-pawel.moll@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0927beec
  7. 28 7月, 2015 1 次提交
  8. 24 7月, 2015 6 次提交