diff options
author | Jiri Olsa <jolsa@redhat.com> | 2013-06-05 07:35:06 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-07-08 16:37:10 -0400 |
commit | 563aecb2e63a16f86c7daabfdcfee23f3e7c5955 (patch) | |
tree | 52d72aa0bf7dd9351bc96d5f4b26b4d4cde8cca1 /tools | |
parent | d07f0b120642f442d81a61f68a9325fb7717004f (diff) |
perf record: Remove -A/--append option
It's no longer working and needed.
Quite straightforward discussion/vote was in here:
http://marc.info/?t=137028288300004&r=1&w=2
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-8fgdva12hl8w3xzzpsvvg7nx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Documentation/perf-record.txt | 4 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 82 | ||||
-rw-r--r-- | tools/perf/util/header.c | 13 |
3 files changed, 11 insertions, 88 deletions
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index d4da111ef53d..7e3258066bc9 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -65,12 +65,10 @@ OPTIONS | |||
65 | -r:: | 65 | -r:: |
66 | --realtime=:: | 66 | --realtime=:: |
67 | Collect data with this RT SCHED_FIFO priority. | 67 | Collect data with this RT SCHED_FIFO priority. |
68 | |||
68 | -D:: | 69 | -D:: |
69 | --no-delay:: | 70 | --no-delay:: |
70 | Collect data without buffering. | 71 | Collect data without buffering. |
71 | -A:: | ||
72 | --append:: | ||
73 | Append to the output file to do incremental profiling. | ||
74 | 72 | ||
75 | -f:: | 73 | -f:: |
76 | --force:: | 74 | --force:: |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index fff985cf3852..2990570b5c6d 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -61,11 +61,6 @@ static void __handle_on_exit_funcs(void) | |||
61 | } | 61 | } |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | enum write_mode_t { | ||
65 | WRITE_FORCE, | ||
66 | WRITE_APPEND | ||
67 | }; | ||
68 | |||
69 | struct perf_record { | 64 | struct perf_record { |
70 | struct perf_tool tool; | 65 | struct perf_tool tool; |
71 | struct perf_record_opts opts; | 66 | struct perf_record_opts opts; |
@@ -77,12 +72,9 @@ struct perf_record { | |||
77 | int output; | 72 | int output; |
78 | unsigned int page_size; | 73 | unsigned int page_size; |
79 | int realtime_prio; | 74 | int realtime_prio; |
80 | enum write_mode_t write_mode; | ||
81 | bool no_buildid; | 75 | bool no_buildid; |
82 | bool no_buildid_cache; | 76 | bool no_buildid_cache; |
83 | bool force; | 77 | bool force; |
84 | bool file_new; | ||
85 | bool append_file; | ||
86 | long samples; | 78 | long samples; |
87 | off_t post_processing_offset; | 79 | off_t post_processing_offset; |
88 | }; | 80 | }; |
@@ -200,25 +192,6 @@ static void perf_record__sig_exit(int exit_status __maybe_unused, void *arg) | |||
200 | signal(signr, SIG_DFL); | 192 | signal(signr, SIG_DFL); |
201 | } | 193 | } |
202 | 194 | ||
203 | static bool perf_evlist__equal(struct perf_evlist *evlist, | ||
204 | struct perf_evlist *other) | ||
205 | { | ||
206 | struct perf_evsel *pos, *pair; | ||
207 | |||
208 | if (evlist->nr_entries != other->nr_entries) | ||
209 | return false; | ||
210 | |||
211 | pair = perf_evlist__first(other); | ||
212 | |||
213 | list_for_each_entry(pos, &evlist->entries, node) { | ||
214 | if (memcmp(&pos->attr, &pair->attr, sizeof(pos->attr) != 0)) | ||
215 | return false; | ||
216 | pair = perf_evsel__next(pair); | ||
217 | } | ||
218 | |||
219 | return true; | ||
220 | } | ||
221 | |||
222 | static int perf_record__open(struct perf_record *rec) | 195 | static int perf_record__open(struct perf_record *rec) |
223 | { | 196 | { |
224 | char msg[512]; | 197 | char msg[512]; |
@@ -273,16 +246,7 @@ try_again: | |||
273 | goto out; | 246 | goto out; |
274 | } | 247 | } |
275 | 248 | ||
276 | if (rec->file_new) | 249 | session->evlist = evlist; |
277 | session->evlist = evlist; | ||
278 | else { | ||
279 | if (!perf_evlist__equal(session->evlist, evlist)) { | ||
280 | fprintf(stderr, "incompatible append\n"); | ||
281 | rc = -1; | ||
282 | goto out; | ||
283 | } | ||
284 | } | ||
285 | |||
286 | perf_session__set_id_hdr_size(session); | 250 | perf_session__set_id_hdr_size(session); |
287 | out: | 251 | out: |
288 | return rc; | 252 | return rc; |
@@ -415,23 +379,15 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) | |||
415 | if (!strcmp(output_name, "-")) | 379 | if (!strcmp(output_name, "-")) |
416 | opts->pipe_output = true; | 380 | opts->pipe_output = true; |
417 | else if (!stat(output_name, &st) && st.st_size) { | 381 | else if (!stat(output_name, &st) && st.st_size) { |
418 | if (rec->write_mode == WRITE_FORCE) { | 382 | char oldname[PATH_MAX]; |
419 | char oldname[PATH_MAX]; | 383 | snprintf(oldname, sizeof(oldname), "%s.old", |
420 | snprintf(oldname, sizeof(oldname), "%s.old", | 384 | output_name); |
421 | output_name); | 385 | unlink(oldname); |
422 | unlink(oldname); | 386 | rename(output_name, oldname); |
423 | rename(output_name, oldname); | ||
424 | } | ||
425 | } else if (rec->write_mode == WRITE_APPEND) { | ||
426 | rec->write_mode = WRITE_FORCE; | ||
427 | } | 387 | } |
428 | } | 388 | } |
429 | 389 | ||
430 | flags = O_CREAT|O_RDWR; | 390 | flags = O_CREAT|O_RDWR|O_TRUNC; |
431 | if (rec->write_mode == WRITE_APPEND) | ||
432 | rec->file_new = 0; | ||
433 | else | ||
434 | flags |= O_TRUNC; | ||
435 | 391 | ||
436 | if (opts->pipe_output) | 392 | if (opts->pipe_output) |
437 | output = STDOUT_FILENO; | 393 | output = STDOUT_FILENO; |
@@ -445,7 +401,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) | |||
445 | rec->output = output; | 401 | rec->output = output; |
446 | 402 | ||
447 | session = perf_session__new(output_name, O_WRONLY, | 403 | session = perf_session__new(output_name, O_WRONLY, |
448 | rec->write_mode == WRITE_FORCE, false, NULL); | 404 | true, false, NULL); |
449 | if (session == NULL) { | 405 | if (session == NULL) { |
450 | pr_err("Not enough memory for reading perf file header\n"); | 406 | pr_err("Not enough memory for reading perf file header\n"); |
451 | return -1; | 407 | return -1; |
@@ -465,12 +421,6 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) | |||
465 | if (!rec->opts.branch_stack) | 421 | if (!rec->opts.branch_stack) |
466 | perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK); | 422 | perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK); |
467 | 423 | ||
468 | if (!rec->file_new) { | ||
469 | err = perf_session__read_header(session, output); | ||
470 | if (err < 0) | ||
471 | goto out_delete_session; | ||
472 | } | ||
473 | |||
474 | if (forks) { | 424 | if (forks) { |
475 | err = perf_evlist__prepare_workload(evsel_list, &opts->target, | 425 | err = perf_evlist__prepare_workload(evsel_list, &opts->target, |
476 | argv, opts->pipe_output, | 426 | argv, opts->pipe_output, |
@@ -498,7 +448,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) | |||
498 | err = perf_header__write_pipe(output); | 448 | err = perf_header__write_pipe(output); |
499 | if (err < 0) | 449 | if (err < 0) |
500 | goto out_delete_session; | 450 | goto out_delete_session; |
501 | } else if (rec->file_new) { | 451 | } else { |
502 | err = perf_session__write_header(session, evsel_list, | 452 | err = perf_session__write_header(session, evsel_list, |
503 | output, false); | 453 | output, false); |
504 | if (err < 0) | 454 | if (err < 0) |
@@ -869,8 +819,6 @@ static struct perf_record record = { | |||
869 | .uses_mmap = true, | 819 | .uses_mmap = true, |
870 | }, | 820 | }, |
871 | }, | 821 | }, |
872 | .write_mode = WRITE_FORCE, | ||
873 | .file_new = true, | ||
874 | }; | 822 | }; |
875 | 823 | ||
876 | #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " | 824 | #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " |
@@ -906,8 +854,6 @@ const struct option record_options[] = { | |||
906 | "collect raw sample records from all opened counters"), | 854 | "collect raw sample records from all opened counters"), |
907 | OPT_BOOLEAN('a', "all-cpus", &record.opts.target.system_wide, | 855 | OPT_BOOLEAN('a', "all-cpus", &record.opts.target.system_wide, |
908 | "system-wide collection from all CPUs"), | 856 | "system-wide collection from all CPUs"), |
909 | OPT_BOOLEAN('A', "append", &record.append_file, | ||
910 | "append to the output file to do incremental profiling"), | ||
911 | OPT_STRING('C', "cpu", &record.opts.target.cpu_list, "cpu", | 857 | OPT_STRING('C', "cpu", &record.opts.target.cpu_list, "cpu", |
912 | "list of cpus to monitor"), | 858 | "list of cpus to monitor"), |
913 | OPT_BOOLEAN('f', "force", &record.force, | 859 | OPT_BOOLEAN('f', "force", &record.force, |
@@ -977,16 +923,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) | |||
977 | if (!argc && perf_target__none(&rec->opts.target)) | 923 | if (!argc && perf_target__none(&rec->opts.target)) |
978 | usage_with_options(record_usage, record_options); | 924 | usage_with_options(record_usage, record_options); |
979 | 925 | ||
980 | if (rec->force && rec->append_file) { | ||
981 | ui__error("Can't overwrite and append at the same time." | ||
982 | " You need to choose between -f and -A"); | ||
983 | usage_with_options(record_usage, record_options); | ||
984 | } else if (rec->append_file) { | ||
985 | rec->write_mode = WRITE_APPEND; | ||
986 | } else { | ||
987 | rec->write_mode = WRITE_FORCE; | ||
988 | } | ||
989 | |||
990 | if (nr_cgroups && !rec->opts.target.system_wide) { | 926 | if (nr_cgroups && !rec->opts.target.system_wide) { |
991 | ui__error("cgroup monitoring only available in" | 927 | ui__error("cgroup monitoring only available in" |
992 | " system-wide mode\n"); | 928 | " system-wide mode\n"); |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 738d3b8d9745..93dd31573fb5 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -2303,29 +2303,18 @@ int perf_session__write_header(struct perf_session *session, | |||
2303 | struct perf_file_header f_header; | 2303 | struct perf_file_header f_header; |
2304 | struct perf_file_attr f_attr; | 2304 | struct perf_file_attr f_attr; |
2305 | struct perf_header *header = &session->header; | 2305 | struct perf_header *header = &session->header; |
2306 | struct perf_evsel *evsel, *pair = NULL; | 2306 | struct perf_evsel *evsel; |
2307 | int err; | 2307 | int err; |
2308 | 2308 | ||
2309 | lseek(fd, sizeof(f_header), SEEK_SET); | 2309 | lseek(fd, sizeof(f_header), SEEK_SET); |
2310 | 2310 | ||
2311 | if (session->evlist != evlist) | ||
2312 | pair = perf_evlist__first(session->evlist); | ||
2313 | |||
2314 | list_for_each_entry(evsel, &evlist->entries, node) { | 2311 | list_for_each_entry(evsel, &evlist->entries, node) { |
2315 | evsel->id_offset = lseek(fd, 0, SEEK_CUR); | 2312 | evsel->id_offset = lseek(fd, 0, SEEK_CUR); |
2316 | err = do_write(fd, evsel->id, evsel->ids * sizeof(u64)); | 2313 | err = do_write(fd, evsel->id, evsel->ids * sizeof(u64)); |
2317 | if (err < 0) { | 2314 | if (err < 0) { |
2318 | out_err_write: | ||
2319 | pr_debug("failed to write perf header\n"); | 2315 | pr_debug("failed to write perf header\n"); |
2320 | return err; | 2316 | return err; |
2321 | } | 2317 | } |
2322 | if (session->evlist != evlist) { | ||
2323 | err = do_write(fd, pair->id, pair->ids * sizeof(u64)); | ||
2324 | if (err < 0) | ||
2325 | goto out_err_write; | ||
2326 | evsel->ids += pair->ids; | ||
2327 | pair = perf_evsel__next(pair); | ||
2328 | } | ||
2329 | } | 2318 | } |
2330 | 2319 | ||
2331 | header->attr_offset = lseek(fd, 0, SEEK_CUR); | 2320 | header->attr_offset = lseek(fd, 0, SEEK_CUR); |