perf sched record
有根據手冊頁http://man7.org/linux/man-pages/man1/perf-sched.1.html
-i, --input=<file>
輸入文件名沒有選項可以更改輸出文件(-i
是輸入文件沒有目錄)。 (默認:perf.data除非標準輸入是FIFO)
,並執行: http://elixir.free-electrons.com/linux/v4.8/source/tools/perf/builtin-sched.c#L1896
tools/perf/builtin-sched.c
static int __cmd_record(int argc, const char **argv)
{
unsigned int rec_argc, i, j;
const char **rec_argv;
const char * const record_args[] = {
"record",
"-a",
"-R",
"-m", "1024",
"-c", "1",
"-e", "sched:sched_switch",
"-e", "sched:sched_stat_wait",
"-e", "sched:sched_stat_sleep",
"-e", "sched:sched_stat_iowait",
"-e", "sched:sched_stat_runtime",
"-e", "sched:sched_process_fork",
"-e", "sched:sched_wakeup",
"-e", "sched:sched_wakeup_new",
"-e", "sched:sched_migrate_task",
};
...
return cmd_record(i, rec_argv, NULL);
}
int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
{
const struct option sched_options[] = {
OPT_STRING('i', "input", &input_name, "file",
"input file name"),
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"),
OPT_END()
};
....
static int perf_sched__read_events(struct perf_sched *sched)
{
...
struct perf_data_file file = {
.path = input_name,
.mode = PERF_DATA_MODE_READ,
.force = sched->force,
};
但是!內置-sched.c中的__cmd_record
調用builtin_record.c具有-o
選項來指定輸出文件的默認cmd_record
:http://elixir.free-electrons.com/linux/v4.8/source/tools/perf/builtin-record.c#L1380
OPT_STRING('o', "output", &record.file.path, "file",
"output file name"),
所以,你可以通過改變當前目錄更改目的地路徑perf sched record
,或者你可以嘗試perf sched record -o /mnt/disk1/perf.data ./Prog &
。不要使用目錄名作爲參數-i
(輸入報告)/ -o
(輸出記錄)perf選項。