1. 14 4月, 2010 1 次提交
    • I
      perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() · c0555642
      Ian Munsie 提交于
      Parsing an option from the command line with OPT_BOOLEAN on a
      bool data type would not work on a big-endian machine due to the
      manner in which the boolean was being cast into an int and
      incremented. For example, running 'perf probe --list' on a
      PowerPC machine would fail to properly set the list_events bool
      and would therefore print out the usage information and
      terminate.
      
      This patch makes OPT_BOOLEAN work as expected with a bool
      datatype. For cases where the original OPT_BOOLEAN was
      intentionally being used to increment an int each time it was
      passed in on the command line, this patch introduces OPT_INCR
      with the old behaviour of OPT_BOOLEAN (the verbose variable is
      currently the only such example of this).
      
      I have reviewed every use of OPT_BOOLEAN to verify that a true
      C99 bool was passed. Where integers were used, I verified that
      they were only being used for boolean logic and changed them to
      bools to ensure that they would not be mistakenly used as ints.
      The major exception was the verbose variable which now uses
      OPT_INCR instead of OPT_BOOLEAN.
      Signed-off-by: NIan Munsie <imunsie@au.ibm.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Cc: <stable@kernel.org> # NOTE: wont apply to .3[34].x cleanly, please backport
      Cc: Git development list <git@vger.kernel.org>
      Cc: Ian Munsie <imunsie@au1.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Eric B Munson <ebmunson@us.ibm.com>
      Cc: Valdis.Kletnieks@vt.edu
      Cc: WANG Cong <amwang@redhat.com>
      Cc: Thiago Farina <tfransosi@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1271147857-11604-1-git-send-email-imunsie@au.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c0555642
  2. 28 2月, 2010 1 次提交
    • F
      perf lock: Drop the buffers multiplexing dependency · b67577df
      Frederic Weisbecker 提交于
      We need to deal with time ordered events to build a correct
      state machine of lock events. This is why we multiplex the lock
      events buffers. But the ordering is done from the kernel, on
      the tracing fast path, leading to high contention between cpus.
      
      Without multiplexing, the events appears in a weak order.
      If we have four events, each split per cpu, perf record will
      read the events buffers in the following order:
      
      [ CPU0 ev0, CPU0 ev1, CPU0 ev3, CPU0 ev4, CPU1 ev0, CPU1 ev0....]
      
      To handle a post processing reordering, we could just read and sort
      the whole in memory, but it just doesn't scale with high amounts
      of events: lock events can fill huge amounts in few times.
      
      Basically we need to sort in memory and find a "grace period"
      point when we know that a given slice of previously sorted events
      can be committed for post-processing, so that we can unload the
      memory usage step by step and keep a scalable sorting list.
      
      There is no strong rules about how to define such "grace period".
      What does this patch is:
      
      We define a FLUSH_PERIOD value that defines a grace period in
      seconds.
      We want to have a slice of events covering 2 * FLUSH_PERIOD in our
      sorted list.
      If FLUSH_PERIOD is big enough, it ensures every events that occured
      in the first half of the timeslice have all been buffered and there
      are none remaining and there won't be further to put inside this
      first timeslice. Then once we reach the 2 * FLUSH_PERIOD
      timeslice, we flush the first half to be gentle with the memory
      (the second half can still get new events in the middle, so wait
      another period to flush it)
      
      FLUSH_PERIOD is defined to 5 seconds. Say the first event started on
      time t0. We can safely assume that at the time we are processing
      events of t0 + 10 seconds, ther won't be anymore events to read
      from perf.data that occured between t0 and t0 + 5 seconds. Hence
      we can safely flush the first half.
      
      To point out funky bugs, we have a guardian that checks a new event
      timestamp is not below the last event's timestamp flushed and that
      displays a warning in this case.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      b67577df
  3. 31 1月, 2010 2 次提交
    • I
      perf lock: Clean up various details · 59f411b6
      Ingo Molnar 提交于
      Fix up a few small stylistic details:
      
       - use consistent vertical spacing/alignment
       - remove line80 artifacts
       - group some global variables better
       - remove dead code
      
      Plus rename 'prof' to 'report' to make it more in line with other
      tools, and remove the line/file keying as we really want to use
      IPs like the other tools do.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1264851813-8413-12-git-send-email-mitake@dcl.info.waseda.ac.jp>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      59f411b6
    • H
      perf lock: Introduce new tool "perf lock", for analyzing lock statistics · 9b5e350c
      Hitoshi Mitake 提交于
      Adding new subcommand "perf lock" to perf.
      
      I have a lot of remaining ToDos, but for now perf lock can
      already provide minimal functionality for analyzing lock
      statistics.
      Signed-off-by: NHitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1264851813-8413-12-git-send-email-mitake@dcl.info.waseda.ac.jp>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9b5e350c