diff --git a/wa/instruments/perf.py b/wa/instruments/perf.py index fd49e190..351b131c 100644 --- a/wa/instruments/perf.py +++ b/wa/instruments/perf.py @@ -21,7 +21,7 @@ import re from devlib.collector.perf import PerfCollector -from wa import Instrument, Parameter +from wa import Instrument, Parameter, ConfigError from wa.utils.types import list_or_string, list_of_strs, numeric PERF_COUNT_REGEX = re.compile(r'^(CPU\d+)?\s*(\d+)\s*(.*?)\s*(\[\s*\d+\.\d+%\s*\])?\s*$') @@ -116,6 +116,14 @@ class PerfInstrument(Instrument): self.collector = None self.outdir = None + def validate(self): + if self.report_option_string and (self.command != "record"): + raise ConfigError("report_option_string only works with perf/simpleperf record. Set command to record or remove report_option_string") + if self.report_sample_options and (self.command != "record"): + raise ConfigError("report_sample_options only works with perf/simpleperf record. Set command to record or remove report_sample_options") + if self.run_report_sample and (self.command != "record"): + raise ConfigError("run_report_sample only works with perf/simpleperf record. Set command to record or remove run_report_sample") + def initialize(self, context): if self.report_sample_options: self.run_report_sample = True