• Jiri Olsa's avatar
    perf daemon: Add 'list' command · b325f7be
    Jiri Olsa authored
    Add a 'list' command to display all running sessions.  It's the default
    command if no other command is specified.
    
    Example:
    
      # cat ~/.perfconfig
      [daemon]
      base=/opt/perfdata
    
      [session-cycles]
      run = -m 10M -e cycles --overwrite --switch-output -a
    
      [session-sched]
      run = -m 20M -e sched:* --overwrite --switch-output -a
    
    Start the daemon:
    
      # perf daemon start
    
    List sessions:
    
      # perf daemon
      [771394:daemon] base: /opt/perfdata
      [771395:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a
      [771396:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a
    
    List sessions with more info:
    
      # perf daemon -v
      [771394:daemon] base: /opt/perfdata
        output:  /opt/perfdata/output
      [771395:cycles] perf record -m 10M -e cycles --overwrite --switch-output -a
        base:    /opt/perfdata/session-cycles
        output:  /opt/perfdata/session-cycles/output
      [771396:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a
        base:    /opt/perfdata/session-sched
        output:  /opt/perfdata/session-sched/output
    
    The 'output' file is perf record output for specific session.
    
    Note you have to stop all running perf processes manually at this point,
    stop command is coming in following patches.
    
    Committer notes:
    
    Fixup union initialization to overcome this in multiple older systems:
    
      22    15.74 debian:8                      : FAIL gcc version 4.9.2 (Debian 4.9.2-10+deb8u2)
    
        builtin-daemon.c: In function 'send_cmd_list':
        builtin-daemon.c:1386:2: error: missing initializer for field 'csv_sep' of 'struct <anonymous>' [-Werror=missing-field-initializers]
          };
          ^
        builtin-daemon.c:641:8: note: 'csv_sep' declared here
           char csv_sep;
                ^
        cc1: all warnings being treated as errors
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Alexei Budankov <abudankov@huawei.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Michael Petlan <mpetlan@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: https://lore.kernel.org/r/20210208200908.1019149-11-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    b325f7be
builtin-daemon.c 22.6 KB