perf tools: Use sysctl__read_int instead of ad-hoc copies
Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-pt2u7a3b50oddggecx7rwq2n@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Родитель
42e3c4a127
Коммит
ce27309f67
|
@ -137,16 +137,7 @@ void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts)
|
||||||
|
|
||||||
static int get_max_rate(unsigned int *rate)
|
static int get_max_rate(unsigned int *rate)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX];
|
return sysctl__read_int("kernel/perf_event_max_sample_rate", (int *)rate);
|
||||||
const char *procfs = procfs__mountpoint();
|
|
||||||
|
|
||||||
if (!procfs)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
snprintf(path, PATH_MAX,
|
|
||||||
"%s/sys/kernel/perf_event_max_sample_rate", procfs);
|
|
||||||
|
|
||||||
return filename__read_int(path, (int *) rate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int record_opts__config_freq(struct record_opts *opts)
|
static int record_opts__config_freq(struct record_opts *opts)
|
||||||
|
|
|
@ -506,16 +506,9 @@ const char *get_filename_for_perf_kvm(void)
|
||||||
|
|
||||||
int perf_event_paranoid(void)
|
int perf_event_paranoid(void)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX];
|
|
||||||
const char *procfs = procfs__mountpoint();
|
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (!procfs)
|
if (sysctl__read_int("kernel/perf_event_paranoid", &value))
|
||||||
return INT_MAX;
|
|
||||||
|
|
||||||
scnprintf(path, PATH_MAX, "%s/sys/kernel/perf_event_paranoid", procfs);
|
|
||||||
|
|
||||||
if (filename__read_int(path, &value))
|
|
||||||
return INT_MAX;
|
return INT_MAX;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче