mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-04 12:22:41 +01:00
framework: utils: Improve logging in revent replay related methods
Also fix typos around the modified lines. Signed-off-by: Metin Kaya <metin.kaya@arm.com>
This commit is contained in:
@@ -584,6 +584,7 @@ class ReventGUI(object):
|
|||||||
|
|
||||||
def __init__(self, workload, target, setup_timeout, run_timeout,
|
def __init__(self, workload, target, setup_timeout, run_timeout,
|
||||||
extract_results_timeout, teardown_timeout):
|
extract_results_timeout, teardown_timeout):
|
||||||
|
self.logger = logging.getLogger(self.__class__.__name__)
|
||||||
self.workload = workload
|
self.workload = workload
|
||||||
self.target = target
|
self.target = target
|
||||||
self.setup_timeout = setup_timeout
|
self.setup_timeout = setup_timeout
|
||||||
@@ -596,7 +597,6 @@ class ReventGUI(object):
|
|||||||
self.on_target_run_revent = self.target.get_workpath('{}.run.revent'.format(self.target.model))
|
self.on_target_run_revent = self.target.get_workpath('{}.run.revent'.format(self.target.model))
|
||||||
self.on_target_extract_results_revent = self.target.get_workpath('{}.extract_results.revent'.format(self.target.model))
|
self.on_target_extract_results_revent = self.target.get_workpath('{}.extract_results.revent'.format(self.target.model))
|
||||||
self.on_target_teardown_revent = self.target.get_workpath('{}.teardown.revent'.format(self.target.model))
|
self.on_target_teardown_revent = self.target.get_workpath('{}.teardown.revent'.format(self.target.model))
|
||||||
self.logger = logging.getLogger('revent')
|
|
||||||
self.revent_setup_file = None
|
self.revent_setup_file = None
|
||||||
self.revent_run_file = None
|
self.revent_run_file = None
|
||||||
self.revent_extract_results_file = None
|
self.revent_extract_results_file = None
|
||||||
@@ -629,8 +629,9 @@ class ReventGUI(object):
|
|||||||
timeout=self.setup_timeout)
|
timeout=self.setup_timeout)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
msg = 'Replaying {}'
|
self.logger.debug('Replaying "%s" with %d seconds timeout',
|
||||||
self.logger.debug(msg.format(os.path.basename(self.on_target_run_revent)))
|
os.path.basename(self.on_target_run_revent),
|
||||||
|
self.run_timeout)
|
||||||
self.revent_recorder.replay(self.on_target_run_revent,
|
self.revent_recorder.replay(self.on_target_run_revent,
|
||||||
timeout=self.run_timeout)
|
timeout=self.run_timeout)
|
||||||
self.logger.debug('Replay completed.')
|
self.logger.debug('Replay completed.')
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
import signal
|
import signal
|
||||||
@@ -117,22 +118,22 @@ class ReventRecording(object):
|
|||||||
Represents a parsed revent recording. This contains input events and device
|
Represents a parsed revent recording. This contains input events and device
|
||||||
descriptions recorded by revent. Two parsing modes are supported. By
|
descriptions recorded by revent. Two parsing modes are supported. By
|
||||||
default, the recording will be parsed in the "streaming" mode. In this
|
default, the recording will be parsed in the "streaming" mode. In this
|
||||||
mode, initial headers and device descritions are parsed on creation and an
|
mode, initial headers and device descriptions are parsed on creation and an
|
||||||
open file handle to the recording is saved. Events will be read from the
|
open file handle to the recording is saved. Events will be read from the
|
||||||
file as they are being iterated over. In this mode, the entire recording is
|
file as they are being iterated over. In this mode, the entire recording is
|
||||||
never loaded into memory at once. The underlying file may be "released" by
|
never loaded into memory at once. The underlying file may be "released" by
|
||||||
calling ``close`` on the recroding, after which further iteration over the
|
calling ``close`` on the recording, after which further iteration over the
|
||||||
events will not be possible (but would still be possible to access the file
|
events will not be possible (but would still be possible to access the file
|
||||||
description and header information).
|
description and header information).
|
||||||
|
|
||||||
The alternative is to load the entire recording on creation (in which case
|
The alternative is to load the entire recording on creation (in which case
|
||||||
the file handle will be closed once the recroding is loaded). This can be
|
the file handle will be closed once the recording is loaded). This can be
|
||||||
enabled by specifying ``streaming=False``. This will make it faster to
|
enabled by specifying ``streaming=False``. This will make it faster to
|
||||||
subsequently iterate over the events, and also will not "hold" the file
|
subsequently iterate over the events, and also will not "hold" the file
|
||||||
open.
|
open.
|
||||||
|
|
||||||
.. note:: When starting a new iteration over the events in streaming mode,
|
.. note:: When starting a new iteration over the events in streaming mode,
|
||||||
the postion in the open file will be automatically reset to the
|
the position in the open file will be automatically reset to the
|
||||||
beginning of the event stream. This means it's possible to iterate
|
beginning of the event stream. This means it's possible to iterate
|
||||||
over the events multiple times without having to re-open the
|
over the events multiple times without having to re-open the
|
||||||
recording, however it is not possible to do so in parallel. If
|
recording, however it is not possible to do so in parallel. If
|
||||||
@@ -274,10 +275,11 @@ def get_revent_binary(abi):
|
|||||||
|
|
||||||
class ReventRecorder(object):
|
class ReventRecorder(object):
|
||||||
|
|
||||||
# Share location of target excutable across all instances
|
# Share location of target executable across all instances
|
||||||
target_executable = None
|
target_executable = None
|
||||||
|
|
||||||
def __init__(self, target):
|
def __init__(self, target):
|
||||||
|
self.logger = logging.getLogger(self.__class__.__name__)
|
||||||
self.target = target
|
self.target = target
|
||||||
if not ReventRecorder.target_executable:
|
if not ReventRecorder.target_executable:
|
||||||
ReventRecorder.target_executable = self._get_target_path(self.target)
|
ReventRecorder.target_executable = self._get_target_path(self.target)
|
||||||
@@ -295,7 +297,8 @@ class ReventRecorder(object):
|
|||||||
self.target.uninstall('revent')
|
self.target.uninstall('revent')
|
||||||
|
|
||||||
def start_record(self, revent_file):
|
def start_record(self, revent_file):
|
||||||
command = '{} record -s {}'.format(ReventRecorder.target_executable, revent_file)
|
command = f'{ReventRecorder.target_executable} record -s {revent_file}'
|
||||||
|
self.logger.debug('Executing record command "%s"...', command)
|
||||||
self.target.kick_off(command, self.target.is_rooted)
|
self.target.kick_off(command, self.target.is_rooted)
|
||||||
|
|
||||||
def stop_record(self):
|
def stop_record(self):
|
||||||
@@ -303,7 +306,8 @@ class ReventRecorder(object):
|
|||||||
|
|
||||||
def replay(self, revent_file, timeout=None):
|
def replay(self, revent_file, timeout=None):
|
||||||
self.target.killall('revent')
|
self.target.killall('revent')
|
||||||
command = "{} replay {}".format(ReventRecorder.target_executable, revent_file)
|
command = f'{ReventRecorder.target_executable} replay {revent_file}'
|
||||||
|
self.logger.debug('Executing replay command "%s" with %d seconds timeout...', command, timeout)
|
||||||
self.target.execute(command, timeout=timeout)
|
self.target.execute(command, timeout=timeout)
|
||||||
|
|
||||||
@memoized
|
@memoized
|
||||||
|
Reference in New Issue
Block a user