mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 15:12:25 +00:00 
			
		
		
		
	perf: report a config error if stat is combined with report options
When running perf/simpleperf stat, the report_option_string, report_sample_options and run_report_sample configuration parameters don't make sense. Instead of quietly ignoring them, raise a ConfigError so that the user can fix the agenda.
This commit is contained in:
		
				
					committed by
					
						 Marc Bonnici
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							43cb80d854
						
					
				
				
					commit
					789e150b0a
				
			| @@ -21,7 +21,7 @@ import re | |||||||
|  |  | ||||||
| from devlib.collector.perf import PerfCollector | 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 | 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*$') | 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.collector = None | ||||||
|         self.outdir = 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): |     def initialize(self, context): | ||||||
|         if self.report_sample_options: |         if self.report_sample_options: | ||||||
|             self.run_report_sample = True |             self.run_report_sample = True | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user