Commit 563aecb2 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

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=2Signed-off-by: default avatarJiri 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent d07f0b12
...@@ -65,12 +65,10 @@ OPTIONS ...@@ -65,12 +65,10 @@ OPTIONS
-r:: -r::
--realtime=:: --realtime=::
Collect data with this RT SCHED_FIFO priority. Collect data with this RT SCHED_FIFO priority.
-D:: -D::
--no-delay:: --no-delay::
Collect data without buffering. Collect data without buffering.
-A::
--append::
Append to the output file to do incremental profiling.
-f:: -f::
--force:: --force::
......
...@@ -61,11 +61,6 @@ static void __handle_on_exit_funcs(void) ...@@ -61,11 +61,6 @@ static void __handle_on_exit_funcs(void)
} }
#endif #endif
enum write_mode_t {
WRITE_FORCE,
WRITE_APPEND
};
struct perf_record { struct perf_record {
struct perf_tool tool; struct perf_tool tool;
struct perf_record_opts opts; struct perf_record_opts opts;
...@@ -77,12 +72,9 @@ struct perf_record { ...@@ -77,12 +72,9 @@ struct perf_record {
int output; int output;
unsigned int page_size; unsigned int page_size;
int realtime_prio; int realtime_prio;
enum write_mode_t write_mode;
bool no_buildid; bool no_buildid;
bool no_buildid_cache; bool no_buildid_cache;
bool force; bool force;
bool file_new;
bool append_file;
long samples; long samples;
off_t post_processing_offset; off_t post_processing_offset;
}; };
...@@ -200,25 +192,6 @@ static void perf_record__sig_exit(int exit_status __maybe_unused, void *arg) ...@@ -200,25 +192,6 @@ static void perf_record__sig_exit(int exit_status __maybe_unused, void *arg)
signal(signr, SIG_DFL); signal(signr, SIG_DFL);
} }
static bool perf_evlist__equal(struct perf_evlist *evlist,
struct perf_evlist *other)
{
struct perf_evsel *pos, *pair;
if (evlist->nr_entries != other->nr_entries)
return false;
pair = perf_evlist__first(other);
list_for_each_entry(pos, &evlist->entries, node) {
if (memcmp(&pos->attr, &pair->attr, sizeof(pos->attr) != 0))
return false;
pair = perf_evsel__next(pair);
}
return true;
}
static int perf_record__open(struct perf_record *rec) static int perf_record__open(struct perf_record *rec)
{ {
char msg[512]; char msg[512];
...@@ -273,16 +246,7 @@ static int perf_record__open(struct perf_record *rec) ...@@ -273,16 +246,7 @@ static int perf_record__open(struct perf_record *rec)
goto out; goto out;
} }
if (rec->file_new) session->evlist = evlist;
session->evlist = evlist;
else {
if (!perf_evlist__equal(session->evlist, evlist)) {
fprintf(stderr, "incompatible append\n");
rc = -1;
goto out;
}
}
perf_session__set_id_hdr_size(session); perf_session__set_id_hdr_size(session);
out: out:
return rc; return rc;
...@@ -415,23 +379,15 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) ...@@ -415,23 +379,15 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
if (!strcmp(output_name, "-")) if (!strcmp(output_name, "-"))
opts->pipe_output = true; opts->pipe_output = true;
else if (!stat(output_name, &st) && st.st_size) { else if (!stat(output_name, &st) && st.st_size) {
if (rec->write_mode == WRITE_FORCE) { char oldname[PATH_MAX];
char oldname[PATH_MAX]; snprintf(oldname, sizeof(oldname), "%s.old",
snprintf(oldname, sizeof(oldname), "%s.old", output_name);
output_name); unlink(oldname);
unlink(oldname); rename(output_name, oldname);
rename(output_name, oldname);
}
} else if (rec->write_mode == WRITE_APPEND) {
rec->write_mode = WRITE_FORCE;
} }
} }
flags = O_CREAT|O_RDWR; flags = O_CREAT|O_RDWR|O_TRUNC;
if (rec->write_mode == WRITE_APPEND)
rec->file_new = 0;
else
flags |= O_TRUNC;
if (opts->pipe_output) if (opts->pipe_output)
output = STDOUT_FILENO; output = STDOUT_FILENO;
...@@ -445,7 +401,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) ...@@ -445,7 +401,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
rec->output = output; rec->output = output;
session = perf_session__new(output_name, O_WRONLY, session = perf_session__new(output_name, O_WRONLY,
rec->write_mode == WRITE_FORCE, false, NULL); true, false, NULL);
if (session == NULL) { if (session == NULL) {
pr_err("Not enough memory for reading perf file header\n"); pr_err("Not enough memory for reading perf file header\n");
return -1; return -1;
...@@ -465,12 +421,6 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) ...@@ -465,12 +421,6 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
if (!rec->opts.branch_stack) if (!rec->opts.branch_stack)
perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK); perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK);
if (!rec->file_new) {
err = perf_session__read_header(session, output);
if (err < 0)
goto out_delete_session;
}
if (forks) { if (forks) {
err = perf_evlist__prepare_workload(evsel_list, &opts->target, err = perf_evlist__prepare_workload(evsel_list, &opts->target,
argv, opts->pipe_output, argv, opts->pipe_output,
...@@ -498,7 +448,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) ...@@ -498,7 +448,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
err = perf_header__write_pipe(output); err = perf_header__write_pipe(output);
if (err < 0) if (err < 0)
goto out_delete_session; goto out_delete_session;
} else if (rec->file_new) { } else {
err = perf_session__write_header(session, evsel_list, err = perf_session__write_header(session, evsel_list,
output, false); output, false);
if (err < 0) if (err < 0)
...@@ -869,8 +819,6 @@ static struct perf_record record = { ...@@ -869,8 +819,6 @@ static struct perf_record record = {
.uses_mmap = true, .uses_mmap = true,
}, },
}, },
.write_mode = WRITE_FORCE,
.file_new = true,
}; };
#define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
...@@ -906,8 +854,6 @@ const struct option record_options[] = { ...@@ -906,8 +854,6 @@ const struct option record_options[] = {
"collect raw sample records from all opened counters"), "collect raw sample records from all opened counters"),
OPT_BOOLEAN('a', "all-cpus", &record.opts.target.system_wide, OPT_BOOLEAN('a', "all-cpus", &record.opts.target.system_wide,
"system-wide collection from all CPUs"), "system-wide collection from all CPUs"),
OPT_BOOLEAN('A', "append", &record.append_file,
"append to the output file to do incremental profiling"),
OPT_STRING('C', "cpu", &record.opts.target.cpu_list, "cpu", OPT_STRING('C', "cpu", &record.opts.target.cpu_list, "cpu",
"list of cpus to monitor"), "list of cpus to monitor"),
OPT_BOOLEAN('f', "force", &record.force, OPT_BOOLEAN('f', "force", &record.force,
...@@ -977,16 +923,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -977,16 +923,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
if (!argc && perf_target__none(&rec->opts.target)) if (!argc && perf_target__none(&rec->opts.target))
usage_with_options(record_usage, record_options); usage_with_options(record_usage, record_options);
if (rec->force && rec->append_file) {
ui__error("Can't overwrite and append at the same time."
" You need to choose between -f and -A");
usage_with_options(record_usage, record_options);
} else if (rec->append_file) {
rec->write_mode = WRITE_APPEND;
} else {
rec->write_mode = WRITE_FORCE;
}
if (nr_cgroups && !rec->opts.target.system_wide) { if (nr_cgroups && !rec->opts.target.system_wide) {
ui__error("cgroup monitoring only available in" ui__error("cgroup monitoring only available in"
" system-wide mode\n"); " system-wide mode\n");
......
...@@ -2303,29 +2303,18 @@ int perf_session__write_header(struct perf_session *session, ...@@ -2303,29 +2303,18 @@ int perf_session__write_header(struct perf_session *session,
struct perf_file_header f_header; struct perf_file_header f_header;
struct perf_file_attr f_attr; struct perf_file_attr f_attr;
struct perf_header *header = &session->header; struct perf_header *header = &session->header;
struct perf_evsel *evsel, *pair = NULL; struct perf_evsel *evsel;
int err; int err;
lseek(fd, sizeof(f_header), SEEK_SET); lseek(fd, sizeof(f_header), SEEK_SET);
if (session->evlist != evlist)
pair = perf_evlist__first(session->evlist);
list_for_each_entry(evsel, &evlist->entries, node) { list_for_each_entry(evsel, &evlist->entries, node) {
evsel->id_offset = lseek(fd, 0, SEEK_CUR); evsel->id_offset = lseek(fd, 0, SEEK_CUR);
err = do_write(fd, evsel->id, evsel->ids * sizeof(u64)); err = do_write(fd, evsel->id, evsel->ids * sizeof(u64));
if (err < 0) { if (err < 0) {
out_err_write:
pr_debug("failed to write perf header\n"); pr_debug("failed to write perf header\n");
return err; return err;
} }
if (session->evlist != evlist) {
err = do_write(fd, pair->id, pair->ids * sizeof(u64));
if (err < 0)
goto out_err_write;
evsel->ids += pair->ids;
pair = perf_evsel__next(pair);
}
} }
header->attr_offset = lseek(fd, 0, SEEK_CUR); header->attr_offset = lseek(fd, 0, SEEK_CUR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment