mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 07:04:17 +00:00 
			
		
		
		
	utils/trace_cmd: reduce regex use
Do not attempt to regex match each line for dropped events/preamble. Use substring search to detect them first, and only use regex on relevant lines.
This commit is contained in:
		| @@ -274,20 +274,23 @@ class TraceCmdTrace(object): | |||||||
|                     elif TRACE_MARKER_STOP in line: |                     elif TRACE_MARKER_STOP in line: | ||||||
|                         break |                         break | ||||||
|  |  | ||||||
|                 match = DROPPED_EVENTS_REGEX.search(line) |                 if 'EVENTS DROPPED' in line: | ||||||
|                 if match: |                     match = DROPPED_EVENTS_REGEX.search(line) | ||||||
|                     yield DroppedEventsEvent(match.group('cpu_id')) |  | ||||||
|                     continue |  | ||||||
|  |  | ||||||
|                 matched = False |  | ||||||
|                 for rx in [HEADER_REGEX, EMPTY_CPU_REGEX]: |  | ||||||
|                     match = rx.search(line) |  | ||||||
|                     if match: |                     if match: | ||||||
|                         logger.debug(line.strip()) |                         yield DroppedEventsEvent(match.group('cpu_id')) | ||||||
|                         matched = True |                         continue | ||||||
|                         break |  | ||||||
|                 if matched: |                 if line.startswith('version') or line.startswith('cpus') or\ | ||||||
|                     continue |                         line.startswith('CPU:'): | ||||||
|  |                     matched = False | ||||||
|  |                     for rx in [HEADER_REGEX, EMPTY_CPU_REGEX]: | ||||||
|  |                         match = rx.search(line) | ||||||
|  |                         if match: | ||||||
|  |                             logger.debug(line.strip()) | ||||||
|  |                             matched = True | ||||||
|  |                             break | ||||||
|  |                     if matched: | ||||||
|  |                         continue | ||||||
|  |  | ||||||
|                 # <thread/cpu/timestamp>: <event name>: <event body> |                 # <thread/cpu/timestamp>: <event name>: <event body> | ||||||
|                 parts = line.split(': ', 2) |                 parts = line.split(': ', 2) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user