mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-11-04 09:02:12 +00:00 
			
		
		
		
	Merge pull request #71 from setrofim/master
trace_cmd: updated to handle empty CPUs.
This commit is contained in:
		@@ -196,13 +196,15 @@ HEADER_REGEX = re.compile(r'^\s*(?:version|cpus)\s*=\s*([\d.]+)\s*$')
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
DROPPED_EVENTS_REGEX = re.compile(r'CPU:(?P<cpu_id>\d+) \[\d*\s*EVENTS DROPPED\]')
 | 
					DROPPED_EVENTS_REGEX = re.compile(r'CPU:(?P<cpu_id>\d+) \[\d*\s*EVENTS DROPPED\]')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EMPTY_CPU_REGEX = re.compile(r'CPU \d+ is empty')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TraceCmdTrace(object):
 | 
					class TraceCmdTrace(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, filter_markers=True):
 | 
					    def __init__(self, filter_markers=True):
 | 
				
			||||||
        self.filter_markers = filter_markers
 | 
					        self.filter_markers = filter_markers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def parse(self, filepath, names=None, check_for_markers=True):  # pylint: disable=too-many-branches
 | 
					    def parse(self, filepath, names=None, check_for_markers=True):  # pylint: disable=too-many-branches,too-many-locals
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        This is a generator for the trace event stream.
 | 
					        This is a generator for the trace event stream.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,6 +219,7 @@ class TraceCmdTrace(object):
 | 
				
			|||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    # maker not found force filtering by marker to False
 | 
					                    # maker not found force filtering by marker to False
 | 
				
			||||||
                    self.filter_markers = False
 | 
					                    self.filter_markers = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with open(filepath) as fh:
 | 
					        with open(filepath) as fh:
 | 
				
			||||||
            for line in fh:
 | 
					            for line in fh:
 | 
				
			||||||
                # if processing trace markers, skip marker lines as well as all
 | 
					                # if processing trace markers, skip marker lines as well as all
 | 
				
			||||||
@@ -235,9 +238,14 @@ class TraceCmdTrace(object):
 | 
				
			|||||||
                    yield DroppedEventsEvent(match.group('cpu_id'))
 | 
					                    yield DroppedEventsEvent(match.group('cpu_id'))
 | 
				
			||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                match = HEADER_REGEX.search(line)
 | 
					                matched = False
 | 
				
			||||||
                if match:
 | 
					                for rx in [HEADER_REGEX, EMPTY_CPU_REGEX]:
 | 
				
			||||||
                    logger.debug(line.strip())
 | 
					                    match = rx.search(line)
 | 
				
			||||||
 | 
					                    if match:
 | 
				
			||||||
 | 
					                        logger.debug(line.strip())
 | 
				
			||||||
 | 
					                        matched = True
 | 
				
			||||||
 | 
					                        break
 | 
				
			||||||
 | 
					                if matched:
 | 
				
			||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                match = TRACE_EVENT_REGEX.search(line)
 | 
					                match = TRACE_EVENT_REGEX.search(line)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user