lkml.org 
[lkml]   [2011]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] perf: bug fixes and cleanups for perf sched

    perf sched latency was printing garbage because it was using
    stale pointers from a deleted session structure. This patches
    fixes the problem.

    The patch also cleans up the data structure definitions for all
    the arrays used to store the processor name (comm).

    Finally, the patch updates the man page and help text to reflect
    the actual options of the command. perf sched trace does not
    exist anymore, AFAICT. Without this change, users get an error
    when invoking perf sched trace but they have no idea why.

    Signed-off-by: Stephane Eranian <eranian@google.com>
    ---

    diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt
    index 46822d5..ad764cc 100644
    --- a/tools/perf/Documentation/perf-sched.txt
    +++ b/tools/perf/Documentation/perf-sched.txt
    @@ -8,7 +8,7 @@ perf-sched - Tool to trace/measure scheduler properties (latencies)
    SYNOPSIS
    --------
    [verse]
    -'perf sched' {record|latency|map|replay|trace}
    +'perf sched' {record|latency|map|replay|script}

    DESCRIPTION
    -----------
    @@ -20,7 +20,7 @@ There are five variants of perf sched:
    'perf sched latency' to report the per task scheduling latencies
    and other scheduling properties of the workload.

    - 'perf sched trace' to see a detailed trace of the workload that
    + 'perf sched script' to see a detailed trace of the workload that
    was recorded.

    'perf sched replay' to simulate the workload that was recorded
    diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
    index dcfe887..d5a9d9e 100644
    --- a/tools/perf/builtin-sched.c
    +++ b/tools/perf/builtin-sched.c
    @@ -649,11 +649,11 @@ struct trace_switch_event {
    u32 common_pid;
    u32 common_tgid;

    - char prev_comm[16];
    + char prev_comm[COMM_LEN];
    u32 prev_pid;
    u32 prev_prio;
    u64 prev_state;
    - char next_comm[16];
    + char next_comm[COMM_LEN];
    u32 next_pid;
    u32 next_prio;
    };
    @@ -667,7 +667,7 @@ struct trace_runtime_event {
    u32 common_pid;
    u32 common_tgid;

    - char comm[16];
    + char comm[COMM_LEN];
    u32 pid;
    u64 runtime;
    u64 vruntime;
    @@ -682,7 +682,7 @@ struct trace_wakeup_event {
    u32 common_pid;
    u32 common_tgid;

    - char comm[16];
    + char comm[COMM_LEN];
    u32 pid;

    u32 prio;
    @@ -699,9 +699,9 @@ struct trace_fork_event {
    u32 common_pid;
    u32 common_tgid;

    - char parent_comm[16];
    + char parent_comm[COMM_LEN];
    u32 parent_pid;
    - char child_comm[16];
    + char child_comm[COMM_LEN];
    u32 child_pid;
    };

    @@ -714,7 +714,7 @@ struct trace_migrate_task_event {
    u32 common_pid;
    u32 common_tgid;

    - char comm[16];
    + char comm[COMM_LEN];
    u32 pid;

    u32 prio;
    @@ -1651,8 +1651,12 @@ static int read_events(void)
    nr_lost_events = session->hists.stats.total_lost;
    nr_lost_chunks = session->hists.stats.nr_events[PERF_RECORD_LOST];
    }
    -
    - perf_session__delete(session);
    + /*
    + * cannot delete session because cmd_lat() is relying on work_atoms
    + * which point to fields (e.g., thread) which are part of the session.
    + *
    + * perf_session__delete(session);
    + */
    return err;
    }

    @@ -1769,7 +1773,7 @@ static void __cmd_replay(void)


    static const char * const sched_usage[] = {
    - "perf sched [<options>] {record|latency|map|replay|trace}",
    + "perf sched [<options>] {record|latency|map|replay|script}",
    NULL
    };


    \
     
     \ /
      Last update: 2011-06-07 16:49    [W:0.025 / U:89.812 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site