]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - tools/perf/builtin-record.c
Merge branches 'pm-core', 'pm-qos', 'pm-domains' and 'pm-opp'
[linux.git] / tools / perf / builtin-record.c
index 33a9eaaf9db49463374762d259b36e5854806bf9..6cd6776052e7a940f78c78d43e623709256a0711 100644 (file)
@@ -418,7 +418,7 @@ static int record__mmap(struct record *rec)
 
 static int record__open(struct record *rec)
 {
-       char msg[512];
+       char msg[BUFSIZ];
        struct perf_evsel *pos;
        struct perf_evlist *evlist = rec->evlist;
        struct perf_session *session = rec->session;
@@ -655,22 +655,23 @@ record__finish_output(struct record *rec)
 
 static int record__synthesize_workload(struct record *rec, bool tail)
 {
-       struct {
-               struct thread_map map;
-               struct thread_map_data map_data;
-       } thread_map;
+       int err;
+       struct thread_map *thread_map;
 
        if (rec->opts.tail_synthesize != tail)
                return 0;
 
-       thread_map.map.nr = 1;
-       thread_map.map.map[0].pid = rec->evlist->workload.pid;
-       thread_map.map.map[0].comm = NULL;
-       return perf_event__synthesize_thread_map(&rec->tool, &thread_map.map,
+       thread_map = thread_map__new_by_tid(rec->evlist->workload.pid);
+       if (thread_map == NULL)
+               return -1;
+
+       err = perf_event__synthesize_thread_map(&rec->tool, thread_map,
                                                 process_synthesized_event,
                                                 &rec->session->machines.host,
                                                 rec->opts.sample_address,
                                                 rec->opts.proc_map_timeout);
+       thread_map__put(thread_map);
+       return err;
 }
 
 static int record__synthesize(struct record *rec, bool tail);
@@ -1670,7 +1671,9 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
        if (rec->evlist == NULL)
                return -ENOMEM;
 
-       perf_config(perf_record_config, rec);
+       err = perf_config(perf_record_config, rec);
+       if (err)
+               return err;
 
        argc = parse_options(argc, argv, record_options, record_usage,
                            PARSE_OPT_STOP_AT_NON_OPTION);