'adb logcat -c' has been observed to fail when called twice concurrently. Rather
than requiring all devlib users to fix their usage patterns, let's just delay
whenever clear_logcat is called twice.
Due to the new read_tree_values API, some devlib modules now use
shutils in their __init__, which happens from
Target::connect(). Therefore ensure we have busybox on the target
before we get to that stage.
The previous fix for read_tree_values fixed the issue with sh not
supporting arrays, but looping over paths and counting them. Hover each
count increment requires spawning a subshell. For a large number of paths,
this can eat away any performance benefits of using read_tree_values.
Since we only care whether the count is greater than one, detect that
and break out of the loop early to re-introduce the performance
improvement.
My bash fu was off on my previous list. The output of find was being
treated as a single string, rather than an array of paths; which ment
that the test that there was more than one path returned failed,
resulting in null output not just for empty directories but for
everyting.
This fixes the issue by converting find output to an array.
grep was existing with 1 when passed an empty directory, resulting in
TargetError being raised unless explicitly suppressed with
check_exit_code=False. This case is now fixed to correctly return an
empty dict without error.
read_tree_values bash function has also been optimized to not
unnecessarily run find in a subshell if the path passed to the function
does not exist.
Optimize cpuidle module initialization by using the new Target.grep_values
call to get information about all idle states in a single call to the
target during module intialization, rather lazily fetching them from the
target afterwards.
Optimize hwmon module initialization by using the new Target.grep_values
call to get information about all HWMON devices in a single call to the
target.
Add two new methods to target that allow querying values of all sysfs
nodes in a sub-directory structure all at once. The difference is that
read_tree_values_flat returns a flat dict of path->value mappings;
read_tree_values returns a nested dict structure that mimics the
scanned sub-directories tree.
ps() splits the output on whiestspace into fields; always expecting
nine. In some cases, wchan field may be blank, resulting in only eight
chunks after the split. Detect that case and insert and empty entry at
the appropriate index.
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.