Skip to content
  • Jiri Olsa's avatar
    perf record: Add --all-user/--all-kernel options · 85723885
    Jiri Olsa authored
    
    
    Allow user to easily switch all events to user or kernel space with simple
    --all-user or --all-kernel options.
    
    This will be handy within perf mem/c2c wrappers to switch easily monitoring
    modes.
    
    Committer note:
    
    Testing it:
    
      # perf record --all-kernel --all-user -a sleep 2
       Error: option `all-user' cannot be used with all-kernel
       Usage: perf record [<options>] [<command>]
          or: perf record [<options>] -- <command> [<options>]
    
            --all-user        Configure all used events to run in user space.
            --all-kernel      Configure all used events to run in kernel space.
      # perf record --all-user --all-kernel -a sleep 2
       Error: option `all-kernel' cannot be used with all-user
       Usage: perf record [<options>] [<command>]
          or: perf record [<options>] -- <command> [<options>]
    
            --all-kernel      Configure all used events to run in kernel space.
            --all-user        Configure all used events to run in user space.
      # perf record --all-user -a sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 1.416 MB perf.data (162 samples) ]
      # perf report | grep '\[k\]'
      # perf record --all-kernel -a sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 1.423 MB perf.data (296 samples) ]
      # perf report | grep '\[\.\]'
      #
    
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lkml.kernel.org/r/1455525293-8671-2-git-send-email-jolsa@kernel.org
    
    
    [ Made those options to be mutually exclusive ]
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    85723885