The implementation of the `counter` was duplicated in both
`wa.utils.counters` and `wa.utils.types.counter` the latter of which is
currently unsed, therefore port missing functionality to the former and
remove.
Previously the `once_per_instance` used the output of `__repr__` to
identify the class of where the decorated method was called from. For
classes that override this method to produce the same output for
different instances of the same class this caused different instances to
be mistakenly treated as one. Now use the hash of the containing class
instead of the string representation and update the tests to catch this
error.
Add a cpu_mask type to allow for users to use a consistent way of representing a
cpus mask with properties to provide conversions between the various required
forms. The mask can be specified directly as a mask, as a list of cpus indexes
or a sysfs-style string.
Also add support for the type to be serialized/deserialzed for the json
and yaml serializers.
Add cpustates output processor. This is more-or-less a port of the
cpustates processor from WA, however there are some differences:
- Idle states are now tracked individually per-CPU. This will fix
processing traces from targets that have different number of idle
states on different clusters.
- Simplify the parameter list for report_power_stats:
- Replace paths to individual report files with a path to a single
directory. A subdirectory will be created under it which will
contain all the reports.
- Replace the individual bits bits of information about CPUs (core
names, idle states, etc) with a list of CpuInfo objects.
- Clean up and simplify the code a bit:
- Make all reports mandatory -- the marginal cost of generating
an additional report is minimal compared to tracking power states
in the first place.
- Standardize the interface for Reporters and Reports.
- Rename some of the reports to something a bit more meaningful.
- The stand-alone command line interface is not ported for now, as it
is now possible to run this offline on existing results using
"wa process".
Move the check_for_markers and events parameters from parser() to
__init__(). These parameters control the behavior of the parser, and do
not relate to a particular trace file, so it makes more sense to have
them there.
- Use indentcontext inside initialize_run to make sure log level
is dedented on error.
- Ensure Executor postamble always runs, event if runner errors.
- Fix format_duration() to handle sub-second timedeltas.
Ensure buffered records are indented properly by saving the indent level
at the time the record was generated as part of the record, and
preferring that over the current indent level inside LineFormatter.
Buffer early log records until a log file becomes available, flush
records to said file afterwards. This ensures that early log output,
which, among other things, contains plugin discovery logging, is not
lost. Buffer capacity is configurable via an environment variable.
Add support for "~~" special value that indicates that, when merging
into another set, all values from that set should in fact be dropped.
Apart from the unique merge semantics, "~~" just like any other "~"
value.
- The merge_with and merge_into implementation was reversed. Fix this, so that
it is implemented correctly, i.e. that
a.merge_with(b) === merge(a, b)
a.merge_into(b) === merge(b, a)
- Ensure that in case of merge_into(), a toggle_set is always returned.
Strings are iterable, so can be used to instantiate sets (resulting in a
set of chars). This is never what we want for toggle_set's though, and
may result in difficult-to-interpret errors when parsing configuration,
so raise a TypeError if attempting to create a toggle_set with a string.
Rather than relying on a custom Logger with a context to add events when
they are logged, have the runner register hooks for corresponding
signals that do that.
The issue with the previous approach is that the event ended up
being added too late -- after the current job was already cleared, so
all events were added at run level.
With the new approach, the event will be added when it is first logged,
while there is still a current job being set. There will be no
duplication for Exceptions being re-raised and handled at different
levels because log_error() will ensure that each Exception is logged
only once.
- Keep track of logged exceptions inside log_error itself.
- signal: log the exception, if there is one in the finally clause of
the signal wrapper; this will ensure that the error will be logged
closer to the command that originated.
- entrypoint: use log.log_error for top-level error logging, rather than
the entrypoint logger directly; this will ensure that errors are not
repeated unnecessarily.
- Log CTRL-C message at zeroth indent level to make it easier to see in
the non-verbose output where it occurred.
Both the instrument and utility functions were called `trace-cmd.py`.
`"-"`'s are not valid python identifiers therefore when trying to import
the `trace-cmd` module this causes an error.
Changed location of revent binary on target to be a class attribute so that
it is shared across all instances. Also changed discovery method to a
static method which can be memoized to prevent the target being queried
unnecessarily.
Instead of taking an extension as a parameter and assuming there it has
an attribute 'parameters' instead take a list of parameters directly
which allows the method to be used with parameter lists with different
names.
Logcat entries are split on a ':' followed by a space so ensure this
is present in the line instead of just a ':'. Some devices have entires
without the trailing space causing an error.
Now that we add an event when logging errors, we need to avoid passing an
exception object directly to the logger. Otherwise we end up adding the
unserializable Exception object to the events list, which causes an error when
trying to write the output.
Add ContextLogger wich extends logging.Logger's warning and error
methods to automatically add the message to the context's events (if a
context has been provided).
devlib's CGgroups module logs things at INFO level. The information it
logs is too detailed for what WA considers "INFO", and should be logged
at DEBUG level instead.
The begining and end of recording timestamps are now stored as part of
the recording. This allows to correctly replay recordings where the
first event occurs some time after the recording started, or the last
event some time before recording ended.
Add pre-built revent binaries for the armeabi and arm64 architectures.
It seems that occasionally an inclomplete recording file is pulled. Add
a one-second (target time) delay to allow SIGINT to be properly handled
and recording to be updated, followed by a sync to ensure the file has
been written.
- What used to be enum.values is now enum.levels.
- Add enum.names and enum.values that are lists of enum's levels' names
and values respectively.
- Add a check on creation to make sure that provided level names do not
conflict with the atomatically created members.