1. 17 1月, 2017 8 次提交
  2. 12 1月, 2017 11 次提交
  3. 04 1月, 2017 4 次提交
  4. 03 1月, 2017 3 次提交
  5. 28 12月, 2016 1 次提交
  6. 23 12月, 2016 4 次提交
    • N
      perf sched timehist: Fix invalid period calculation · bdd75729
      Namhyung Kim 提交于
      When --time option is given with a value outside recorded time, the last
      sample time (tprev) was set to that value and run time calculation might
      be incorrect.  This is a problem of the first samples for each cpus
      since it would skip the runtime update when tprev is 0.  But with --time
      option it had non-zero (which is invalid) value so the calculation is
      also incorrect.
      
      For example, let's see the followging:
      
        $ perf sched timehist
                   time    cpu  task name                       wait time  sch delay   run time
                                [tid/pid]                          (msec)     (msec)     (msec)
        --------------- ------  ------------------------------  ---------  ---------  ---------
            3195.968367 [0003]  <idle>                              0.000      0.000      0.000
            3195.968386 [0002]  Timer[4306/4277]                    0.000      0.000      0.018
            3195.968397 [0002]  Web Content[4277]                   0.000      0.000      0.000
            3195.968595 [0001]  JS Helper[4302/4277]                0.000      0.000      0.000
            3195.969217 [0000]  <idle>                              0.000      0.000      0.621
            3195.969251 [0001]  kworker/1:1H[291]                   0.000      0.000      0.033
      
      The sample starts at 3195.968367 but when I gave a time interval from
      3194 to 3196 (in sec) it will calculate the whole 2 second as runtime.
      In below, 2 cpus accounted it as runtime, other 2 cpus accounted it as
      idle time.
      
      Before:
      
        $ perf sched timehist --time 3194,3196 -s | tail
        Idle stats:
            CPU  0 idle for   1995.991  msec
            CPU  1 idle for     20.793  msec
            CPU  2 idle for     30.191  msec
            CPU  3 idle for   1999.852  msec
      
            Total number of unique tasks: 23
        Total number of context switches: 128
                   Total run time (msec): 3724.940
      
      After:
      
        $ perf sched timehist --time 3194,3196 -s | tail
        Idle stats:
            CPU  0 idle for     10.811  msec
            CPU  1 idle for     20.793  msec
            CPU  2 idle for     30.191  msec
            CPU  3 idle for     18.337  msec
      
            Total number of unique tasks: 23
        Total number of context switches: 128
                   Total run time (msec): 18.139
      
      Committer notes:
      
      Further testing:
      
      Before:
      
        Idle stats:
            CPU  0 idle for    229.785  msec
            CPU  1 idle for    937.944  msec
            CPU  2 idle for    188.931  msec
            CPU  3 idle for    986.185  msec
      
        After:
      
        # perf sched timehist --time 40602,40603 -s | tail
      
        Idle stats:
            CPU  0 idle for    229.785  msec
            CPU  1 idle for    175.407  msec
            CPU  2 idle for    188.931  msec
            CPU  3 idle for    223.657  msec
      
            Total number of unique tasks: 68
        Total number of context switches: 814
                   Total run time (msec): 97.688
      
        # for cpu in `seq 0 3` ; do echo -n "CPU $cpu idle for " ; perf sched timehist --time 40602,40603 | grep "\[000${cpu}\].*\<idle\>" | tr -s ' ' | cut -d' ' -f7 | awk '{entries++ ; s+=$1} END {print s " msec (entries: " entries ")"}' ; done
        CPU 0 idle for 229.721 msec (entries: 123)
        CPU 1 idle for 175.381 msec (entries: 65)
        CPU 2 idle for 188.903 msec (entries: 56)
        CPU 3 idle for 223.61 msec (entries: 102)
      
      Difference due to the idle stats being accounted at nanoseconds precision while
      the <idle> entries in 'perf sched timehist' are trucated at msec.usec.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Fixes: 853b7407 ("perf sched timehist: Add option to specify time window of interest")
      Link: http://lkml.kernel.org/r/20161222060350.17655-2-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bdd75729
    • N
      perf sched timehist: Remove hardcoded 'comm_width' check at print_summary · 4fa0d1aa
      Namhyung Kim 提交于
      Now that the default 'comm_width' value is 30, no need to check that at
      print_summary,
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20161222060350.17655-1-namhyung@kernel.org
      [ Split from a larger patch ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4fa0d1aa
    • N
      perf sched timehist: Enlarge default 'comm_width' · 9b8087d7
      Namhyung Kim 提交于
      Current default value is 20 but it's easily changed to a bigger value as
      task has a long name and different tid and pid.  And it makes the output
      not aligned.  So change it to have a large value as summary shows.
      
      Committer notes:
      
      Before:
      
        # perf sched record
        ^C
        # perf sched timehist
        <SNIP>
          40602.770537 [0001]  rcuos/2[29]               7.970      0.002      0.020
          40602.771512 [0003]  <idle>                    0.003      0.000      0.986
          40602.771586 [0001]  <idle>                    0.020      0.000      1.049
          40602.771606 [0001]  qemu-system-x86[3593/3510]      0.000      0.002      0.020
          40602.771629 [0003]  qemu-system-x86[3510]           0.000      0.003      0.116
          40602.771776 [0000]  <idle>                          0.001      0.000      1.892
        <SNIP>
      
      After:
      
        # perf sched timehist
        <SNIP>
         40602.770537 [0001]  rcuos/2[29]                         7.970      0.002      0.020
         40602.771512 [0003]  <idle>                              0.003      0.000      0.986
         40602.771586 [0001]  <idle>                              0.020      0.000      1.049
         40602.771606 [0001]  qemu-system-x86[3593/3510]          0.000      0.002      0.020
         40602.771629 [0003]  qemu-system-x86[3510]               0.000      0.003      0.116
        <SNIP>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20161222060350.17655-1-namhyung@kernel.org
      [ Split from a larger patch ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9b8087d7
    • N
      perf sched timehist: Honour 'comm_width' when aligning the headers · 0e6758e8
      Namhyung Kim 提交于
      Current default value is 20, but that may change in the future, so make
      places where we have 20 hardcoded use 'comm_width'.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20161222060350.17655-1-namhyung@kernel.org
      [ Split from a larger patch ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0e6758e8
  7. 20 12月, 2016 4 次提交
  8. 16 12月, 2016 5 次提交
    • R
      perf annotate: Fix jump target outside of function address range · e216874c
      Ravi Bangoria 提交于
      If jump target is outside of function range, perf is not handling it
      correctly. Especially when target address is lesser than function start
      address, target offset will be negative. But, target address declared to
      be unsigned, converts negative number into 2's complement. See below
      example. Here target of 'jumpq' instruction at 34cf8 is 34ac0 which is
      lesser than function start address(34cf0).
      
              34ac0 - 34cf0 = -0x230 = 0xfffffffffffffdd0
      
      Objdump output:
      
        0000000000034cf0 <__sigaction>:
        __GI___sigaction():
          34cf0: lea    -0x20(%rdi),%eax
          34cf3: cmp    -bashx1,%eax
          34cf6: jbe    34d00 <__sigaction+0x10>
          34cf8: jmpq   34ac0 <__GI___libc_sigaction>
          34cfd: nopl   (%rax)
          34d00: mov    0x386161(%rip),%rax        # 3bae68 <_DYNAMIC+0x2e8>
          34d07: movl   -bashx16,%fs:(%rax)
          34d0e: mov    -bashxffffffff,%eax
          34d13: retq
      
      perf annotate before applying patch:
      
        __GI___sigaction  /usr/lib64/libc-2.22.so
                 lea    -0x20(%rdi),%eax
                 cmp    -bashx1,%eax
              v  jbe    10
              v  jmpq   fffffffffffffdd0
                 nop
          10:    mov    _DYNAMIC+0x2e8,%rax
                 movl   -bashx16,%fs:(%rax)
                 mov    -bashxffffffff,%eax
                 retq
      
      perf annotate after applying patch:
      
        __GI___sigaction  /usr/lib64/libc-2.22.so
                 lea    -0x20(%rdi),%eax
                 cmp    -bashx1,%eax
              v  jbe    10
              ^  jmpq   34ac0 <__GI___libc_sigaction>
                 nop
          10:    mov    _DYNAMIC+0x2e8,%rax
                 movl   -bashx16,%fs:(%rax)
                 mov    -bashxffffffff,%eax
                 retq
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Chris Riyder <chris.ryder@arm.com>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/1480953407-7605-3-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e216874c
    • R
      perf annotate: Support jump instruction with target as second operand · 3ee2eb6d
      Ravi Bangoria 提交于
      Architectures like PowerPC have jump instructions that includes a target
      address as a second operand. For example, 'bne cr7,0xc0000000000f6154'.
      Add support for such instruction in perf annotate.
      
      objdump o/p:
        c0000000000f6140:   ld     r9,1032(r31)
        c0000000000f6144:   cmpdi  cr7,r9,0
        c0000000000f6148:   bne    cr7,0xc0000000000f6154
        c0000000000f614c:   ld     r9,2312(r30)
        c0000000000f6150:   std    r9,1032(r31)
        c0000000000f6154:   ld     r9,88(r31)
      
      Corresponding perf annotate o/p:
      
      Before patch:
               ld     r9,1032(r31)
               cmpdi  cr7,r9,0
            v  bne    3ffffffffff09f2c
               ld     r9,2312(r30)
               std    r9,1032(r31)
        74:    ld     r9,88(r31)
      
      After patch:
               ld     r9,1032(r31)
               cmpdi  cr7,r9,0
            v  bne    74
               ld     r9,2312(r30)
               std    r9,1032(r31)
        74:    ld     r9,88(r31)
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Chris Riyder <chris.ryder@arm.com>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/1480953407-7605-2-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3ee2eb6d
    • J
      perf record: Force ignore_missing_thread for uid option · 23dc4f15
      Jiri Olsa 提交于
      Enable perf_evsel::ignore_missing_thread for -u option to ignore
      complete failure if any of the user's processes die between its
      enumeration and time we open the event.
      
      Committer notes:
      
      While doing a 'make -j4 allmodconfig' we sometimes get into the race:
      
      Before:
      
        # perf record -u acme
        Error:
        The sys_perf_event_open() syscall returned with 3 (No such process) for event (cycles:ppp).
        /bin/dmesg may provide additional information.
        No CONFIG_PERF_EVENTS=y kernel support configured?
        #
      
      After:
      
        [root@jouet ~]# perf record -u acme
        WARNING: Ignored open failure for pid 9888
        WARNING: Ignored open failure for pid 18059
        [root@jouet ~]#
      
      Which is an improvement, with the races not preventing the remaining threads
      for the specified user from being monitored, but the message probably needs
      further clarification.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1481538943-21874-6-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      23dc4f15
    • J
      perf evsel: Allow to ignore missing pid · a359c17a
      Jiri Olsa 提交于
      Adding perf_evsel::ignore_missing_cpu_thread bool.
      
      When set true, it allows perf to ignore error of missing pid of perf
      event syscall.
      
      We remove missing thread id from the thread_map, so the rest of the
      processing like ioctl and mmap won't get disturbed with -1 fd.
      
      The reason for supporting this is to ease up monitoring group of pids,
      that 'disappear' before perf opens their event. This currently leads
      perf to report error and exit and makes perf record's -u option unusable
      under certain setup.
      
      With this change we will allow this race and ignore such failure with
      following warning:
      
        WARNING: Ignored open failure for pid 8605
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20161213074622.GA3084@kravaSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a359c17a
    • J
      perf thread_map: Add thread_map__remove function · 38af91f0
      Jiri Olsa 提交于
      Add thread_map__remove function to remove thread from thread map.
      
      Add automated test also.
      
      Committer notes:
      
      Testing it:
      
        # perf test "Remove thread map"
        39: Remove thread map                          : Ok
        # perf test -v "Remove thread map"
        39: Remove thread map                          :
        --- start ---
        test child forked, pid 4483
        2 threads: 4482, 4483
        1 thread: 4483
        0 thread:
        test child finished with 0
        ---- end ----
        Remove thread map: Ok
        #
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1481538943-21874-4-git-send-email-jolsa@kernel.org
      [ Added stdlib.h, to get the free() declaration ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      38af91f0