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

418 Commits

Author SHA1 Message Date
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
Brendan Jackman
b3242a1ee4 utils/android: whitespace 2017-09-20 13:42:36 +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
Valentin Schneider
7c2fd87a3b target: Add LogcatMonitor getter for android target 2017-09-11 17:15:04 +01:00
Valentin Schneider
035181a8f1 utils/android: Add LogcatMonitor 2017-09-11 17:12:11 +01:00
setrofim
f5a00140e4 Merge pull request #161 from qperret/gem5/stats/match-regex
module/gem5stats: enhance match() with regex support
2017-08-23 17:27:46 +01:00
setrofim
77482a6c70 Merge pull request #159 from qperret/fix/cgroup-freeze
module/cgroups: robustify task freezer
2017-08-22 18:33:40 +01:00
Quentin Perret
34d73e6af1 utils/gem5: try to cast statistics dump values
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.
2017-08-22 16:16:09 +01:00
Quentin Perret
4b36439de8 module/cgroups: robustify task freezer
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.
2017-08-21 18:16:10 +01:00
Quentin Perret
3c8294c6eb module/gem5stats: better document match() and match_iter() behaviours 2017-08-21 11:12:11 +01:00
Quentin Perret
64c865de59 module: gem5stats: enhance match() with regex support
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.
2017-08-21 11:12:11 +01:00
setrofim
66a50a2f49 Merge pull request #163 from marcbonnici/Derived_Measurements
Add support for AcmeCape and Derived Measurements
2017-08-21 08:46:43 +01:00
Marc Bonnici
60e69fc4e8 Documentation/DerivedMeasurements: Added documentation for new API 2017-08-18 18:02:48 +01:00
Marc Bonnici
c62905cfdc Instrumentation/Instrumentation: Update timestamp documentation 2017-08-18 18:02:48 +01:00
Marc Bonnici
eeb5e93e6f Documentation/Instrumentation: Fix typos 2017-08-18 18:02:48 +01:00
Marc Bonnici
c093d56754 DerivedMeasurements: Add DerivedEnergyMeasurments
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.
2017-08-18 18:02:48 +01:00
Marc Bonnici
049b275665 Instrumentation: Update to store sample rate in MeasurementCSV file.
This commit updates existing instruments to store their sample rates
when creating the respective MeasurementCsv files.
2017-08-18 18:02:48 +01:00
Marc Bonnici
411719d58d Instrument/gem5power: Rename timestamp channel to match new API
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.
2017-08-18 18:02:48 +01:00
Marc Bonnici
7dd934a5d8 Instrumentation: Update to populate missing 'sample_rate_hz` attributes
To conform with the Instrumentation API each instrument should populate
the `sample_rate_hz` attribute with the relevant information.
2017-08-18 17:10:17 +01:00
Marc Bonnici
30fdfc23d3 Instrument/Acmecape: Add support for acmecape 2017-08-18 13:33:49 +01:00
Marc Bonnici
d3c3015fc8 Instrument/MeasurementCSV: Add support for recording sample rate.
If performing post processing on a MeasurementCsv file, if a timestamp
is not available then the recorded sample rate can be used as a
substitute.
2017-08-18 13:32:23 +01:00
Marc Bonnici
5ef99f2cff Instrument/MeasurementType: Allow for converting to the same type
When trying to convert measurments to a standarised type some inputs
may already be of the correct type and will now return the same value
unchanged.
2017-08-18 13:32:19 +01:00
Marc Bonnici
9b465c2766 Instruments: Add millisecond MeasurementType and conversion
Allows for reporting times in milliseconds as used with the acmecape
instrument.
2017-08-18 13:32:16 +01:00
Marc Bonnici
2de2b36387 Instrumentation: Fix conversion between microseconds and seconds 2017-08-18 13:32:10 +01:00
marcbonnici
210712b384 Merge pull request #162 from setrofim/numeric-pcent
utils/types: numeric expeanded to handle percentages
2017-08-17 11:17:56 +01:00
setrofim
2a0d110012 Merge pull request #157 from marcbonnici/airplane/brightness
Adds additional Android methods
2017-08-17 10:59:27 +01:00
Marc Bonnici
5b99c1613b Documentation: Adds documentation for Android Target
Adds documentation for the `AndroidTarget` class including the new
android methods.
2017-08-17 10:08:08 +01:00
Sergei Trofimov
3d10e3eae9 utils/types: numeric expeanded to handle percentages
numeric() conversion function is expanded to handle percentage values in
the form "10.123%". The result is the numeric part converted to a float
and divided by 100, e.g. 0.10123.
2017-08-16 16:00:38 +01:00
setrofim
4d95656e49 Merge pull request #160 from qperret/gem5/stats/async-origin
module/gem5stats: enable asynchronous origins in gem5 stats file
2017-08-16 13:39:31 +01:00
Quentin Perret
38258eb74c module: gem5stats: enable asynchronous origins in gem5 stats file
Currently, reset_origin() in the gem5stats module enables to virtually
truncate the existing dumps from the gem5 statistics file so that any
subsequent match() calls will apply only on new dumps. However, the
current implementation resets the origin of the stats file unilaterally,
without other clients knowing about it, hence leading to data being
lost.

This commits removes the reset_origin() method and provides a different
API to handle virtual truncatures in the stats file. Namely, the match()
method now takes a base_dump parameter letting clients specifiying from
which dump they want match() to apply. This feature could also be usefull
if someone wanted to add off-line processing features for statistics
files.
2017-08-16 10:40:10 +01:00
Marc Bonnici
8839ed01ba AndroidTarget: Changes default unlocking method
Instead of using a default 'horizontal' unlocking method, now will try
a diagonal swipe up as this should work most modern devices with vertical or
horizontal unlocking methods.
2017-08-14 09:55:21 +01:00
Marc Bonnici
1229af0895 AndroidTarget: Fixes 'swipe_to_unlock' method. 2017-08-11 14:22:28 +01:00
Marc Bonnici
003785dde1 AndroidTarget: Adds methods to get/set screen rotation 2017-08-10 11:21:04 +01:00
Marc Bonnici
3e751746d6 AndroidTarget: Adds methods to get/set airplane mode
In order to change the state of airplane mode, the setting needs to
be configured before broadcasting an intent to update the system. As of
Android N, root is required to send the broadcast, therefore this method
will raise an error if the requirements are not satisfied.
2017-08-10 11:21:03 +01:00
Marc Bonnici
ddd2e29b87 AndroidTarget: Adds methods to get/set screen brightness 2017-08-10 11:21:03 +01:00
marcbonnici
22b6514c35 Merge pull request #158 from bjackman/ssh-improve-errors
Improve SshConnection.push errors
2017-08-09 16:18:46 +01:00
Brendan Jackman
380ad0515d ssh: Improve error when failing to push file
CalledProcessError doesn't include the output of the failed command
in the message it prints, so use a HostError isntead.
2017-08-09 16:01:49 +01:00
Brendan Jackman
93b39a7f47 ssh: Fix redacting SSH password in errors
IIUC this is supposed to redact the password from exception messages,
but 'pass_string' is not set to the password so nothing is
altered. Fix that.
2017-08-09 16:01:49 +01:00
Basil Eljuse
70d755d75b Mark inline function to be static to avoid link issues with GCC compiler 2017-08-01 08:28:47 +01:00
setrofim
1da8d3f95f Merge pull request #151 from AnthonyARM/master
Add support for arbitrary ADB servers
2017-07-31 15:51:15 +01:00