I need to prove that when process is runnig and I remove the ELF file of this process number of free blocks and nodes in filesystem won't increase, and after I kill the process they increase. I also need to show latency in whole lifecycle of this process so I am using perf shed record ./Prog
, but it makes a file and saving there results of recording and this destroys my first part of my task. When I try(logged as root) to use:
perf sched record -i /mnt/disk1 ./Prog &
I get
Workload failed: permission denied
Can someone tell me how to change the input file on file that is in other filesystem?
perf sched record
has no option to change output file (-i
is for input file not directory) according to man page http://man7.org/linux/man-pages/man1/perf-sched.1.html
-i, --input=<file>
Input file name. (default: perf.data unless stdin is a fifo)
and to implementation: 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,
};
But! The __cmd_record
of builtin-sched.c calls default cmd_record
of builtin_record.c which has -o
option to specify output file: 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"),
So, you can change destination path for perf sched record
by changing current dir, or you can try perf sched record -o /mnt/disk1/perf.data ./Prog &
. Don't use directory name as argument of -i
(input for report) / -o
(output for record) perf options.