/* Configure leader sampling here now that the sample type is known */
evlist__for_each_entry(evlist, evsel)
evsel__config_leader_sampling(evsel, evlist);
if (user_interval && user_freq) {
pr_err("cannot set frequency and period at the same time\n"); return -1;
}
if (user_interval)
opts->default_interval = opts->user_interval; if (user_freq)
opts->freq = opts->user_freq;
/* *Userspecifiedcountoverridesdefaultfrequency.
*/ if (opts->default_interval)
opts->freq = 0; elseif (opts->freq) {
opts->default_interval = opts->freq;
} else {
pr_err("frequency and count are zero, aborting\n"); return -1;
}
if (get_max_rate(&max_rate)) return0;
/* *Userspecifiedfrequencyisovercurrentmaximum.
*/ if (user_freq && (max_rate < opts->freq)) { if (opts->strict_freq) {
pr_err("error: Maximum frequency rate (%'u Hz) exceeded.\n" " Please use -F freq option with a lower value or consider\n" " tweaking /proc/sys/kernel/perf_event_max_sample_rate.\n",
max_rate); return -1;
} else {
pr_warning("warning: Maximum frequency rate (%'u Hz) exceeded, throttling from %'u Hz to %'u Hz.\n" " The limit can be raised via /proc/sys/kernel/perf_event_max_sample_rate.\n" " The kernel will lower it when perf's interrupts take too long.\n" " Use --strict-freq to disable this throttling, refusing to record.\n",
max_rate, opts->freq, max_rate);
opts->freq = max_rate;
}
}
/* *Defaultfrequencyisovercurrentmaximum.
*/ if (max_rate < opts->freq) {
pr_warning("Lowering default frequency rate from %u to %u.\n" "Please consider tweaking " "/proc/sys/kernel/perf_event_max_sample_rate.\n",
opts->freq, max_rate);
opts->freq = max_rate;
}
return0;
}
int record_opts__config(struct record_opts *opts)
{ return record_opts__config_freq(opts);
}
int record__parse_freq(conststruct option *opt, constchar *str, int unset __maybe_unused)
{ unsignedint freq; struct record_opts *opts = opt->value;
if (!str) return -EINVAL;
if (strcasecmp(str, "max") == 0) { if (get_max_rate(&freq)) {
pr_err("couldn't read /proc/sys/kernel/perf_event_max_sample_rate\n"); return -1;
}
pr_info("info: Using a maximum frequency rate of %'d Hz\n", freq);
} else {
freq = atoi(str);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.