diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c index 709152a7b408ea18c6f8502098b9ce5b0dc2459c..d6525bc54d13e337e927b197ab87da55f99492ae 100644 --- a/tools/perf/builtin-data.c +++ b/tools/perf/builtin-data.c @@ -53,12 +53,14 @@ static int cmd_data_convert(int argc, const char **argv, const char *prefix __maybe_unused) { const char *to_ctf = NULL; + bool force = false; const struct option options[] = { OPT_INCR('v', "verbose", &verbose, "be more verbose"), OPT_STRING('i', "input", &input_name, "file", "input file name"), #ifdef HAVE_LIBBABELTRACE_SUPPORT OPT_STRING(0, "to-ctf", &to_ctf, NULL, "Convert to CTF format"), #endif + OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), OPT_END() }; @@ -76,7 +78,7 @@ static int cmd_data_convert(int argc, const char **argv, if (to_ctf) { #ifdef HAVE_LIBBABELTRACE_SUPPORT - return bt_convert__perf2ctf(input_name, to_ctf); + return bt_convert__perf2ctf(input_name, to_ctf, force); #else pr_err("The libbabeltrace support is not compiled in.\n"); return -1; diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c index c6d62268cc2a85a8594f5cceb5f4804ef9145c52..dd17c9a32fbcfcf3c55c8cc33a44349582f4bb89 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -791,12 +791,13 @@ static int ctf_writer__init(struct ctf_writer *cw, const char *path) return -1; } -int bt_convert__perf2ctf(const char *input, const char *path) +int bt_convert__perf2ctf(const char *input, const char *path, bool force) { struct perf_session *session; struct perf_data_file file = { .path = input, .mode = PERF_DATA_MODE_READ, + .force = force, }; struct convert c = { .tool = { diff --git a/tools/perf/util/data-convert-bt.h b/tools/perf/util/data-convert-bt.h index dda30c5d07922b5d56a4fec8b29b9a8bc5f57137..4c204342a9d838aa32dce4c69688bdc8b8f85bbc 100644 --- a/tools/perf/util/data-convert-bt.h +++ b/tools/perf/util/data-convert-bt.h @@ -2,7 +2,7 @@ #define __DATA_CONVERT_BT_H #ifdef HAVE_LIBBABELTRACE_SUPPORT -int bt_convert__perf2ctf(const char *input_name, const char *to_ctf); +int bt_convert__perf2ctf(const char *input_name, const char *to_ctf, bool force); #endif /* HAVE_LIBBABELTRACE_SUPPORT */ #endif /* __DATA_CONVERT_BT_H */