Skip to contentSkip to conversation

rteval: Show both cyclictest and timerlat options in help menu

PATCH New John Kacur 1 participant 2 messages Nov 12, 2025

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 1/2 rteval: Show both cyclictest and timerlat options in help menu

Previously, running './rteval-cmd -h' would only show options for one measurement module (either cyclictest or timerlat), depending on which was selected. This made it difficult for users to discover all available options.

This commit modifies the module loading logic to:

1. Load both cyclictest and timerlat modules for help generation, ensuring all options are visible in the help menu

2. Determine which module should actually run based on:
- Command-line argument (--measurement-module) takes precedence
- Config file setting if no command-line override
- Default to timerlat if neither is specified

3. After help is generated and arguments are parsed, disable the non-selected measurement module so only the chosen one runs

Additionally, changed the default measurement module from cyclictest to timerlat when no config file exists.

Assisted-by Claude <[email protected]>
---
 rteval-cmd | 56 ++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 44 insertions(+), 12 deletions(-)
rteval-cmd +44 -12
index 855934e42192..45d9f3a58a11 100755
@@ -220,7 +220,7 @@ if __name__ == '__main__':
 
         if not config.HasSection('measurement'):
             config.AppendConfig('measurement', {
-                'cyclictest' : 'module',
+                'timerlat' : 'module',
                 'sysstat' : 'module'})
 
         # Check for --measurement-module argument early to override config file
@@ -229,17 +229,35 @@ if __name__ == '__main__':
                                         type=str, choices=['cyclictest', 'timerlat'])
         early_args, _ = measurement_parser.parse_known_args()
 
+        # For help generation, we want to load both cyclictest and timerlat modules
+        # so users can see all available options regardless of which one is selected
+        msrcfg = config.GetSection('measurement')
+
+        # Determine which module should actually run before we load both for help
+        selected_measurement_module = None
         if early_args.measurement_module:
-            # Override measurement config based on command-line argument
-            msrcfg = config.GetSection('measurement')
-            # Disable both cyclictest and timerlat first
-            if 'cyclictest' in msrcfg:
-                msrcfg.cyclictest = None
-            if 'timerlat' in msrcfg:
-                msrcfg.timerlat = None
-            # Enable the selected measurement module
-            setattr(msrcfg, early_args.measurement_module, 'module')
-            logger.log(Log.INFO, f"Using measurement module: {early_args.measurement_module} (from command line)")
+            # Command-line argument takes precedence
+            selected_measurement_module = early_args.measurement_module
+            logger.log(Log.INFO, f"Using measurement module: {selected_measurement_module} (from command line)")
+        else:
+            # Check config file to see what's configured
+            cyclictest_in_config = hasattr(msrcfg, 'cyclictest') and msrcfg.cyclictest == 'module'
+            timerlat_in_config = hasattr(msrcfg, 'timerlat') and msrcfg.timerlat == 'module'
+
+            if cyclictest_in_config and not timerlat_in_config:
+                selected_measurement_module = 'cyclictest'
+            elif timerlat_in_config and not cyclictest_in_config:
+                selected_measurement_module = 'timerlat'
+            elif cyclictest_in_config and timerlat_in_config:
+                # Both in config - prefer timerlat as default
+                selected_measurement_module = 'timerlat'
+            else:
+                # Neither in config - default to timerlat
+                selected_measurement_module = 'timerlat'
+
+        # Now ensure both modules are loaded for option display
+        msrcfg.cyclictest = 'module'
+        msrcfg.timerlat = 'module'
 
         # Prepare log levels before loading modules, not to have unwanted log messages
         # Use a minimal parser to extract logging-related flags early
@@ -267,7 +285,7 @@ if __name__ == '__main__':
         if early_args.idle_set:
             rtevcfg.update({'usingCpupower': True})
 
-        # Load modules
+        # Load modules (both cyclictest and timerlat are loaded for help display)
         loadmods = LoadModules(config, logger=logger)
         measuremods = MeasurementModules(config, logger=logger)
 
@@ -277,6 +295,20 @@ if __name__ == '__main__':
         measuremods.SetupModuleOptions(parser)
         cmd_opts = parse_options(config, parser, sys.argv[1:])
 
+        # After parsing options, disable the measurement module that won't be used
+        # This must be done after option parsing so both modules' options appear in help
+        msrcfg = config.GetSection('measurement')
+        if hasattr(cmd_opts, 'measurement___measurement_module') and cmd_opts.measurement___measurement_module:
+            selected_measurement_module = cmd_opts.measurement___measurement_module
+
+        # Disable the non-selected measurement module
+        if selected_measurement_module == 'timerlat':
+            if hasattr(msrcfg, 'cyclictest'):
+                msrcfg.cyclictest = None
+        elif selected_measurement_module == 'cyclictest':
+            if hasattr(msrcfg, 'timerlat'):
+                msrcfg.timerlat = None
+
         if rtevcfg.noload:
             if rtevcfg.onlyload:
                 # Make up your mind!
Signature · 1 line
2.51.1
author
#1 lore raw

PATCH 2/2 rteval: timerlat: Disable auto-analysis with --no-aa

Pass --no-aa flag to rtla timerlat to disable auto-analysis, which reduces CPU usage of the timerlat measurement tool.

---
 rteval/modules/measurement/timerlat.py | 2 ++
 1 file changed, 2 insertions(+)
rteval/modules/measurement/timerlat.py +2 -0
index 1c7fb1607682..7ad8997c95dc 100644
@@ -231,6 +231,8 @@ class Timerlat(rtevalModulePrototype):
         self.__cmd.append(f'-c{self.__cpulist}')
         self.__cmd.append(f'-E{self.__buckets}')
         self.__cmd.append('--no-summary')
+        # Disable auto-analysis
+        self.__cmd.append('--no-aa')
 
         # Add dma-latency option if configured (default is 0)
         # If dma_latency is explicitly set to None, don't pass the option to rtla
Signature · 1 line
2.51.1