1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 10:50:51 +01:00
Commit Graph

455 Commits

Author SHA1 Message Date
Sergei Trofimov
d560aea660 Target: fix read_tree_values for empty dir
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.
2017-10-05 09:41:40 +01:00
setrofim
4d8da589f8 Merge pull request #181 from setrofim/master
Module initialization optimizations.
2017-10-04 16:23:18 +01:00
Sergei Trofimov
f042646792 module/hotplug: optimize online_all
Optimize online_all by offloading it to a shutils function which only
requres a single call to the target.
2017-10-04 15:59:19 +01:00
Sergei Trofimov
d7ca39e4d1 module/cpuidle: optimize initialization.
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.
2017-10-04 15:59:19 +01:00
Sergei Trofimov
5a599f91db module/hwmon: optimize initialization.
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.
2017-10-04 15:59:19 +01:00
Sergei Trofimov
181bc180c4 Target: add read_tree_values and read_tree_values_flat
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.
2017-10-04 15:58:22 +01:00
Sergei Trofimov
92fb54d57b module: nicer logger name
Use Module.name rather than Module.__name__ to name the logger for
slightly more readable log output.
2017-10-04 13:21:26 +01:00
Sergei Trofimov
bfb4721715 Target: ensure shutils is always set
Make sure shutils is always set, even if setup() has not been
called by initializing  it on first access if necessary.
2017-10-04 13:21:26 +01:00
setrofim
e21265f6f6 Merge pull request #177 from bjackman/hwmon-no-permissions
hwmon: Disable if no permissions
2017-10-02 10:37:25 +01:00
setrofim
a3f78cabc1 Merge pull request #179 from setrofim/fps
Add FPS derived metrics
2017-09-29 16:15:25 +01:00
Sergei Trofimov
4593d8605d gfxinfo fixes
- Make sure timestamps are actually reported in microseconds.
- Eliminate duplicate entries from successive dumps
2017-09-27 14:45:27 +01:00
Sergei Trofimov
9f666320f3 derived: add DerivedSurfaceFlingerStats
Add DerivedSurfaceFlingerStats that parse output from
SurfaceFlingerFramesInstrument to produce FPS data and rendering
statistics.
2017-09-27 14:45:27 +01:00
Sergei Trofimov
f692315d9c derived: add DerivedGfxInfoStats
Add DerivedGfxInfoStats that parse output from GfxInfoFramesInstrument
to produce FPS data and rendering statistics.
2017-09-27 14:45:27 +01:00
setrofim
e4fda7898d Merge pull request #178 from setrofim/master
Various fixes.
2017-09-27 14:00:26 +01:00
Sergei Trofimov
109fcc6deb AndroidTarget: fix ps()
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.
2017-09-27 10:44:44 +01:00
Sergei Trofimov
96693a3035 AndroidTarget: fix get_pid_of for recent Androids
ps on recent Androids no longer takes an optional comm name; use
Target.ps() instead, and filter by process name on the host.
2017-09-27 10:44:44 +01:00
Sergei Trofimov
d952abf52e utils/rendering: frame collectors should respect column order
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).
2017-09-27 10:44:44 +01:00
Sergei Trofimov
50dfb297cd utils/rendering: fix surfaceflinger list
SurfaceFlingerFrameCollector.list now converts line endings before
splitting, so it now works when the endings are something other than
"\r\n".
2017-09-27 10:44:43 +01:00
setrofim
e7a319b0a7 Merge pull request #176 from bjackman/logcat-docs
utils/anroid: Documentation for LogcatMonitor
2017-09-21 14:08:33 +01:00
Brendan Jackman
6bb24aa12a hwmon: Disable if no permissions
If we don't have permissions, scan() currently raises a
TargetError. Instead we should return False from probe() so the
module is disabled
2017-09-21 13:31:59 +01:00
Brendan Jackman
fb5a260f4b utils/anroid: Documentation for LogcatMonitor 2017-09-21 13:23:10 +01:00
setrofim
e1ec1eacfb Merge pull request #175 from bjackman/logcat-race
Fix race in LogcatMonitor
2017-09-20 15:52:34 +01:00
Brendan Jackman
22c1f5e911 utils/android: Don't lock up if LogcatMonitor stopped before start
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.
2017-09-20 15:08:31 +01:00
Brendan Jackman
8cf4a44bd7 utils/android: Fix race condition in LogcatMonitor
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.
2017-09-20 14:06:34 +01:00
setrofim
a59093465d Merge pull request #174 from bjackman/adb-start-server
utils/android: Start ADB server before listing devices
2017-09-20 13:59:02 +01:00
Brendan Jackman
b3242a1ee4 utils/android: whitespace 2017-09-20 13:42:36 +01:00
Brendan Jackman
a290d28835 utils/android: Start ADB server before listing devices
Otherwise if the server isn't started we fail to parse the output of
'adb devices'
2017-09-20 13:04:25 +01:00
Sergei Trofimov
a8ca0fc6c8 util/rendering: add gfxinfo_get_last_dump
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).
2017-09-19 13:34:43 +01:00
Sergei Trofimov
01b5cffe03 instrument: Update MeasurementType table
- Add generic "count" and "percent" MeasurementType's.
- Add "fps" MeasurementType.
- Add "thermal" category for "termperature"
- Add a comment describing each category
2017-09-19 13:34:43 +01:00
Sergei Trofimov
adf25f93bb DerivedMeasurements: add process_raw() + doc updates
- 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.
2017-09-19 13:34:43 +01:00
Sergei Trofimov
dd26b43ac5 derived: DerivedMeasurments now return DerivedMetrics
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.
2017-09-19 13:34:43 +01:00
Sergei Trofimov
8479af48c4 MeasurementCsv: various enhancements
- 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).
2017-09-19 13:34:43 +01:00
Sergei Trofimov
07ba177e58 InstrumentChannel: allow None sites
Allow site to be None (still must be explicitly specified). If the site
is None, the label if created using only the measurement type.
2017-09-19 13:34:43 +01:00
Sergei Trofimov
9192deb8ee InstrumentChannel: name is now an alias for label
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.
2017-09-19 13:34:43 +01:00
Sergei Trofimov
823ce718bf instrument: add get_raw() API
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.
2017-09-19 13:34:42 +01:00
Sergei Trofimov
2afa8f86a4 insturment: add catergory for time + doc fix
- Add a category name for time MeasurmentType's, as there are now
  multiple.
- Fix the names of time_ms and time_us in the documentation.
2017-09-19 13:34:42 +01:00
Sergei Trofimov
15333eb09c utils/misc: update CPU_PART_MAP with Mongoose
Add Samsung's Mongoose M1 core part identifiers to the map.
2017-09-19 13:34:42 +01:00
Sergei Trofimov
dfd0b8ebd9 MeasurementsCsv: rename itermeasurments
Renamed to iter_measurments for readability.
2017-09-19 13:34:42 +01:00
Sergei Trofimov
ff366b3fd9 derived: renamed derived_measurments --> energy
Renamed to reduce redandancy in import path.
2017-09-19 13:34:42 +01:00
setrofim
25ad53feff Merge pull request #171 from bjackman/instrument-fix-reset
instrument: Clear up Instrument.reset semantics
2017-09-15 13:34:09 +01:00
Brendan Jackman
1513db0951 instrument: Clear up Instrument.reset semantics
- 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.
2017-09-13 15:01:41 +01:00
Sergei Trofimov
90040e8b58 utils/android: grant_app_permissions fix.
Handle the case where an app does not specify any permissions.
2017-09-13 14:03:59 +01:00
setrofim
3658eec66c Merge pull request #169 from valschneider/grant-permission
utils/android: Add grant_app_permissions
2017-09-13 13:29:14 +01:00
Valentin Schneider
24d5630e54 utils/android: Add grant_app_permissions
This is mostly useful to avoid having to manually click/tap
on the permission requests that may pop up when opening apps,
which would ruin automation
2017-09-13 12:13:31 +01:00
setrofim
ee153210c6 Merge pull request #168 from valschneider/logcat-tweaks
utils/android: LogcatMonitor fixes and improvements
2017-09-12 17:41:09 +01:00
Valentin Schneider
6bda0934ad utils/android: LogcatMonitor fixes
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().
2017-09-12 17:21:31 +01:00
setrofim
a46f1038f8 Merge pull request #167 from valschneider/kill-children
host: Add kill_children utility method
2017-09-12 15:41:18 +01:00
Valentin Schneider
4de973483e host: Add kill_children utility method
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.
2017-09-12 15:14:23 +01:00
setrofim
0e9221f58e Merge pull request #166 from valschneider/logcat-monitor
Logcat monitor
2017-09-11 18:41:02 +01:00
Valentin Schneider
0d3a0223b3 trace: Add logcat trace collector 2017-09-11 17:53:09 +01:00