perf: Humanize lock flags in perf lock
[safe/jmp/linux-2.6] / tools / perf / builtin-sched.c
index 80209df..aef6ed0 100644 (file)
@@ -68,10 +68,10 @@ enum sched_event_type {
 
 struct sched_atom {
        enum sched_event_type   type;
+       int                     specific_wait;
        u64                     timestamp;
        u64                     duration;
        unsigned long           nr;
-       int                     specific_wait;
        sem_t                   *wait_sem;
        struct task_desc        *wakee;
 };
@@ -1621,11 +1621,8 @@ static int process_sample_event(event_t *event, struct perf_session *session)
 
        event__parse_sample(event, session->sample_type, &data);
 
-       dump_printf("(IP, %d): %d/%d: %p period: %Ld\n",
-               event->header.misc,
-               data.pid, data.tid,
-               (void *)(long)data.ip,
-               (long long)data.period);
+       dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc,
+                   data.pid, data.tid, data.ip, data.period);
 
        thread = perf_session__findnew(session, data.pid);
        if (thread == NULL) {
@@ -1653,33 +1650,23 @@ static int process_lost_event(event_t *event __used,
        return 0;
 }
 
-static int sample_type_check(struct perf_session *session __used)
-{
-       if (!(session->sample_type & PERF_SAMPLE_RAW)) {
-               fprintf(stderr,
-                       "No trace sample to read. Did you call perf record "
-                       "without -R?");
-               return -1;
-       }
-
-       return 0;
-}
-
 static struct perf_event_ops event_ops = {
-       .process_sample_event   = process_sample_event,
-       .process_comm_event     = event__process_comm,
-       .process_lost_event     = process_lost_event,
-       .sample_type_check      = sample_type_check,
+       .sample                 = process_sample_event,
+       .comm                   = event__process_comm,
+       .lost                   = process_lost_event,
+       .ordered_samples        = true,
 };
 
 static int read_events(void)
 {
-       int err;
-       struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0);
+       int err = -EINVAL;
+       struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0, false);
        if (session == NULL)
                return -ENOMEM;
 
-       err = perf_session__process_events(session, &event_ops);
+       if (perf_session__has_traces(session, "record -R"))
+               err = perf_session__process_events(session, &event_ops);
+
        perf_session__delete(session);
        return err;
 }
@@ -1804,7 +1791,7 @@ static const char * const sched_usage[] = {
 static const struct option sched_options[] = {
        OPT_STRING('i', "input", &input_name, "file",
                    "input file name"),
-       OPT_BOOLEAN('v', "verbose", &verbose,
+       OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show symbol address, etc)"),
        OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
                    "dump raw trace in ASCII"),
@@ -1819,7 +1806,7 @@ static const char * const latency_usage[] = {
 static const struct option latency_options[] = {
        OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
                   "sort by key(s): runtime, switch, avg, max"),
-       OPT_BOOLEAN('v', "verbose", &verbose,
+       OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show symbol address, etc)"),
        OPT_INTEGER('C', "CPU", &profile_cpu,
                    "CPU to profile on"),
@@ -1836,7 +1823,7 @@ static const char * const replay_usage[] = {
 static const struct option replay_options[] = {
        OPT_INTEGER('r', "repeat", &replay_repeat,
                    "repeat the workload replay N times (-1: infinite)"),
-       OPT_BOOLEAN('v', "verbose", &verbose,
+       OPT_INCR('v', "verbose", &verbose,
                    "be more verbose (show symbol address, etc)"),
        OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
                    "dump raw trace in ASCII"),
@@ -1864,7 +1851,6 @@ static const char *record_args[] = {
        "record",
        "-a",
        "-R",
-       "-M",
        "-f",
        "-m", "1024",
        "-c", "1",