Previously FrameCollector.write_frames used "columns" argument only as a
filter for which columns to write, but the order would always be the
same as in raw output.
The Instrument API requires that the column ordering in the resulting
MeasurementsCsv matches the ordering of channels specified in reset()
(if any). This means the collectors should respect the ordering
specified in the "columns" parameter (which gets populated based on
active channels).
Calling stop before start will result in hanging in self._started.wait(),
because that event will never get set. Although stop before start is an illegal
usage pattern, let's try not to fail annoyingly.
If you call .start then immediately call .stop, the thread may not
yet have set ._logcat, resulting in an AttributeError.
I initially fixed this by setting _logcat = None in __init__, then putting the
`kill` calls inside `if self._logcat`. The problem with this, as pointed out by
@valschneider, is that we can then have this sequence:
main thread: monitor thread
stop() run()
if self._logcat: .
# False, don't kill process .
join() .
self._logcat = <...>
Therefore, just have the stop() method wait until the process is started before
unconditionally killing it.
Add gfxinfo_get_last_dump utility function to get the last gfxinfo dump
from a (potentially large) file containing a concatenation of such dumps
(as in the raw output of the GfxinfoFrames instrument).
- Add process_raw() method to the API. This is inteneded to be invoked
on any raw output (i.e. not MeasurmentCsv) generated by an Instrument.
- Both process() process_raw() are portional to be overriden by
impolementation; the default behavior is to return an empty list.
- The output specification for both is extened to allow
MeasurementCsv's, as well as DerivedMetric's.
- Documentation has been reworded for clarity.
DerivedMeasurments processors now return DerviedMetrics rather than
measurments. The notion of an InstrumentChannel doesn't really make
sense in the context of DerivedMeasurments, which are not directly
measured on the target. Since Measurement's require a channel, a simpler
DerviedMetric is added that only requires a name and a type.
- Added values() and iter_values() methods. These return each row as a
named tuple, with channel labels as the field names.
- __cmp__ has been made more generic by checking wether other has
"value" attribute, rather than wether it is an instance of Measurment.
- MeasurementCsv no longer keeps an open handle to the file, and instead
re-opens the file each time it needs it. This removes the need for
managing the open handle, and alows parallel iterations over the
values (each iteration will have it's own read handle into the files).
In addition to a label constructed form the combination of site and
measurment type, channels had a name that was specified on creation.
This proven to be not particularly useful (there only being one instance
of the name being set to something materially different from the label);
and this has lead to channels being inconsistenly referenced (some times
a channel is identified by its label, and sometimes by the name).
This commit removes the name from __init__ arguments, and
InstrumentChannel.name is now an alias for InstrumentChannel.label.
Derived metrics may be calculated form data in raw output that is not
present in the resulting MeasurementCSV. This adds a method to provide
uniform access to raw artifacts generated by an instrument.
- Fix missing parameter in the documentation
- Clarify meaning of `sites` and `kinds` in the documentation.
- With the current implementation the `channels` argument is
useless: if `sites` and `kinds` are not also specified then all
channels are enabled anyway. Fix that by making those parameters
ignored when `channels` is provided.
host.kill_children() is used to properly kill the logcat process
when it is IO blocked.
The logcat regexp argument is now within double quotes, as having
parenthesis within the regexp could break the command.
LogcatMonitor.search() has been renamed to wait_for() to make the
behaviour of the method more explicit. A non-blocking version of
this method has been added and is named search().
This method is useful for killing the children spawned by
Popen() calls with shell=True. For instance:
proc = Popen('sleep 100', shell=True)
proc.kill()
This would spawn a shell task and that shell would spawn the sleep task.
Issuing a kill to the Popen handle will only kill the shell task,
and the sleep task will keep running.
Using host.kill_children(proc.pid) will ensure all child tasks are
killed.
All values in the gem5 statistics log file are numeric. This commit adds a
cast on the strings read from the stats file to native numeric values when
and logs a warning in case of a malformed entry.
The set() method of the CGroup class used to freeze tasks relies on
target's write_value(). Sometimes, the freezing procedure takes some
time and the call to write_value() in set() fails by reading "FREEZING"
while it expected "FROZEN". To avoid this issue, this commits introduces
a shutil call dedicated to changing the state of the freezer controller.
The current implementation of match() in the gem5stats module returns
records matching exactly the specified keys. This commit changes this
behaviour by matching keys over regular expressions, hence resulting in
a much more powerful match() implementation.
Adds `DerivedMeasurements` which are designed to perform post processing on
a provided MeasurementCsv.
Currently only a `DerivedEnergyMeasurements` class has been added which
has 2 purposes:
- Calculate energy from power results if not present using recorded timestamps,
falling back to a provided sample rate
- Calculate cumulative energy and average power from a specified MeasurementCSV
file.
To conform with the new DerivedMeasuements API the "sim_seconds" channel
has been renamed to "timestamp" so that it can be identified in post
processing. As "sim_seconds" needs to be extracted from the gem5
statistics file, an addional mapping has been added to support this.