1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

155 Commits

Author SHA1 Message Date
Brendan Jackman
d3a02d9d9e cpuidle: Make desc, name, latency, power memoized properties
When this information is not needed, this avoids executing 4 commands on
the host for each CPU, which significantly speeds up initialising the
cpuidle module.
2016-10-12 18:31:12 +01:00
setrofim
1a47cadfa7 Merge pull request #63 from bjackman/get-domain-cpus
cpufreq: Add function to get CPUs in frequency domain
2016-10-12 08:29:14 +01:00
Brendan Jackman
f1b4bf2845 cpufreq: Add function to get CPUs in frequency domain 2016-10-11 20:40:10 +01:00
setrofim
25818b035e Merge pull request #62 from bjackman/check-governor-supported
cpufreq: Improve error when setting all CPUs to unsupported governor
2016-10-11 14:36:12 +01:00
Brendan Jackman
af4214c3fb cpufreq: Improve error when setting all CPUs to unsupported governor
Currently when using set_all_governors to try to set an unsupported
governor, the error is a somewhat cryptic "sh: echo: I/O error". Add a
check that diagnoses this error.

In order to avoid slowing down the "good" path, the check for
unsupported governors is only done if the failure has already occured.
2016-10-11 14:28:58 +01:00
setrofim
1cc6ddf140 Merge pull request #61 from credp/android_disconnect
android: don't try to disconnect devices which aren't connected
2016-10-07 08:24:11 +01:00
Chris Redpath
119fd7dc24 android: don't try to disconnect devices which aren't connected
If you try to disconnect a device and there are none, certain versions
of adb return 1, which leads to a TargetError and stops everything in
its tracks.

Try to mitigate this by checking if the device we want to disconnect is
connected before we make the disconnect call.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
2016-10-06 16:34:14 +01:00
Sergei Trofimov
cae239d1dc memoized: detect hashability by catching TypeError
This is a fix for

https://github.com/ARM-software/devlib/issues/60

Apprently, being an instance of Hashable does not mean that the object
is, in fact, hashable. So rather than testing for hashability, try to
hash the object and handle the potential error by falling back to the
old method.
2016-10-06 08:44:42 +01:00
Sergei Trofimov
09ec88e946 memoized: further fixes; hash objects whre possible
This is further to commit 6d854fd4dc59936142fff811e575cd034a308c43

Due to the way certain objects are handled, getting the frist few bytes
of an object may not be enough (e.g. strings do not store their values
inline). To further mitigate the issue, hash the object where possible.
2016-10-04 17:57:46 +01:00
setrofim
f8440cf354 Merge pull request #59 from derkling/fix-ftrace
ftrace: ensure ftrace commands are executed as root
2016-09-28 08:20:10 +01:00
setrofim
46d65c8237 Merge pull request #58 from credp/android7_ls
AndroidTarget: Handle ls format change in Android 7.0
2016-09-27 16:28:32 +01:00
Chris Redpath
2a4eafae6e AndroidTarget: Handle ls format change in Android 7.0
We expect ls to output single column listings. Previous to Linaro Android
16.09 release, this was the default. From the 16.09 release onwards, the
default is multi-column. Unfortunately, pre-16.09 ls does not support the
'-1' option to guarantee single column output.

Test for ls supporting '-1' and use it if possible.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
2016-09-27 12:08:33 +01:00
Patrick Bellasi
3e6a040863 ftrace: ensure ftrace commands are executed as root
Configuration sysfs files required by ftrace are usually accessible only by
the root user. In systems where ADB does not run as root by default, the
initialisation of the ftrace module fails.

This patch ensure that all ftrace commands are executed with root privileges.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-09-21 16:17:45 +01:00
Sergei Trofimov
08b36e71cb utils; adding more CPU part numbers 2016-09-06 16:01:09 +01:00
Sergei Trofimov
6d854fd4dc memoized: fix for bug where wrong cached results were returned
memoized() used id() to get "unique" representations for arguments
passed to a function, in order to ensure that results for the same
function called with different arguments are treated differently.

However, Python object identities are only guaranteed to be unique at a
particular point in time. It is possible than a particular ID gets
reused for a different object if the previous object associated with
that ID no longer exists. In particular, in CPython, the IDs are just
addresses of the corresponding PyObject's in memory. If a PyObject gets
garbage collected, another object may get allocated in its place, and
the new object will "inherit" the ID by virtue of being in the same
memory location. If the new object is then used to call a memoized
function that was previously called with the old object, the old cached
result will be incorrectly returned.

To get around this issue, the cache is now indexed not only by the ID of
an object but also but the first few bytes of its value.

NOTE: there is still a potential issue it two relatively large objects
gets allocated in the same place and happen to share the first few
(currently 32) bytes, and are then both used as parameters to the same
memoized function. The only way around that is to hash the entire value
of the object. However, given the performance penalty that would incur
for larger object, and the unlikeliness of this situation actually
arising, it is currently deemed not worth it.
2016-09-06 09:57:58 +01:00
Sergei Trofimov
390a544a92 instrument: allow specifying channels in reset()
Prior to this commit, measurements to be collected were specified via
"sites" and "kinds" parameters. This has the limitation that if you
wanted measurments of kind X from site A and kind Y from site B, you'd
have to specify them as

	reset(sites=['A', 'B'], kinds=['X', 'Y'])

Which would have the effect of also collecting measurments Y for site A
and measurments X for site B. This commit adds the option of specifying
individual channels, via thier labels, e.g.

	reset(channels=['A_X', 'B_Y'])

so that only the channels you're interested in will be collected.
2016-09-02 14:03:33 +01:00
Sergei Trofimov
d7aac2b5df utils: added a function to reset memoized cache
Added a function to reset the memo cache used by memoized decorator,
which would force all memoized functions to re-evalued their results
when they are next called. This is primarily intended for debugging.
2016-09-02 13:24:30 +01:00
setrofim
0e8fc0d732 Merge pull request #57 from derkling/cgroups-cosmetics
Cgroups cosmetics
2016-08-31 11:53:19 +01:00
Patrick Bellasi
730bb606b1 cgroup: fix documentation of freeze function
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-31 11:40:10 +01:00
Patrick Bellasi
c8f118da4f cgroups: change log level to avoid cluttering caller output
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-31 11:39:33 +01:00
Sergei Trofimov
ca0b6e88a1 AndroidTarget: fixed kick_off()
kick_off relies on nohup, which may not work properly unless the command
for it is  explicitly backgrounded with "&", which was not being done in
the AndroidTarget implementation of kick_off().
2016-08-30 14:27:16 +01:00
setrofim
c307ffab15 Merge pull request #56 from derkling/cgroups-isolation-and-freeze
Add support for CPUs isolation and tasks freezing
2016-08-30 09:14:39 +01:00
Patrick Bellasi
23ad61fcae cgroups: add support for tasks freezing
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:27:08 +01:00
Patrick Bellasi
75a086d77a cgroups: add support for CPUs isolation
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:27:08 +01:00
Patrick Bellasi
21d18f8b78 cgroups: fix support to filter tasks to move into a specified CGroup
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:20:11 +01:00
Patrick Bellasi
3cab786d03 cgroups: use shutils for move_tasks
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:17:32 +01:00
Patrick Bellasi
d8ae3aba1a cgroups: add couple of methods to return the tasks of a CGroup
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:17:32 +01:00
Patrick Bellasi
42efd0a2e2 cgroups: add support list tasks in a specified CGroup
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 18:15:41 +01:00
Patrick Bellasi
83c1312b22 shutils: ensure we use "cat" version provided by Busybox
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-08-26 16:12:23 +01:00
setrofim
b9a16982d8 Merge pull request #53 from mdigiorgio/fix-cgroups_get_states
cgroups: fix get_states() return value when passing integer state
2016-08-01 10:46:24 +01:00
Michele Di Giorgio
f9cb932d9c cgroups: fix get_states() return value when passing integer state
When passing an idle state ID to get_states(), nothing is returned. Also, there
is a wrong call to enable() in the method.

Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
2016-08-01 10:41:38 +01:00
setrofim
0c8f26763b Merge pull request #49 from derkling/fix-adb-connect
android: avoid connect for USB target
2016-07-29 16:09:17 +01:00
setrofim
2d496486bf Merge pull request #52 from garethstockwell/master
TelnetConnection: support for systems which do not prompt for a password
2016-07-29 16:08:30 +01:00
Gareth Stockwell
f24493676c TelnetConnection: allow username and/or password to be optional
If username is set to None, no '-l' option is appended to the telnet command.
If password is set to None, devlib does not wait for a password prompt when
connecting.
2016-07-29 14:52:52 +00:00
Gareth Stockwell
76b059c6b1 TelnetConnection: allow client to specify the original prompt string 2016-07-29 14:52:52 +00:00
setrofim
baab8ab131 Merge pull request #51 from ep1cman/master
TelnetConnection: Added the ability to specify connection port
2016-07-29 15:21:26 +01:00
Sebastian Goscik
73f2e28a06 TelnetConnection: Added the ability to specify connection port 2016-07-29 15:14:41 +01:00
Patrick Bellasi
f714dd39f1 android: avoid connect for USB target
The "adb connect" command is not required for USB connected devices.
This patch is a small update to use "adb connect" only for android devices
accessed by IP address.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2016-07-15 11:18:09 +01:00
Sergei Trofimov
c4784e0993 Added documentation for Target.extract() 2016-07-14 11:15:08 +01:00
Sergei Trofimov
baaa67bfcc target: added extract() method
Added a method for extracting compressed on-target files and archives.
The method extacts the specified on-target path (the method is based on
the extension) and return the path to extracted content.
2016-07-14 11:07:19 +01:00
setrofim
17692891ef Merge pull request #46 from JaviMerino/needs_su
devlib: don't use sudo/su if you are root
2016-06-24 09:18:01 +01:00
Javi Merino
16d87c6924 devlib: don't use sudo/su if you are root
Most invocations of target.execute() pass as_root=self.is_rooted .
However, is_rooted is not what you want to do here.  as_root tells the
connection to wrap the command around sudo/su to execute the command as
root.  is_rooted returns True if the device can run commands as
root (for example, if we are connected as root).  If you are already
connected as root, there is no need to wrap the command around sudo, you
are already root.  In that case, as_root should always be false.

Define a new property for the target called needs_su that returns true
if the target needs to run a command to get superuser privileges.
2016-06-23 14:55:19 +01:00
setrofim
fa20e7c28d Merge pull request #45 from mdigiorgio/improve-memoize
Improve memoize decorator
2016-06-23 11:13:36 +01:00
Michele Di Giorgio
539e9b34b9 devlib/utils/misc: improve memoize decorator
Using the wrapt module we can improve the memoize decorator. In fact, it allows
to preserve the attributes of the memoized function, such as signature,
docstring, path to the file where the function is implemented, and so on.

Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
2016-06-23 09:51:47 +01:00
setrofim
ee521f64e6 Merge pull request #42 from ep1cman/fixes
LinuxTarget: now used 'uname' instead of 'busybox uname'
2016-06-16 14:50:49 +01:00
Sebastian Goscik
5880f6e9ef LinuxTarget: now used 'uname' instead of 'busybox uname'
To install busybox we need to know the ABI of the device to push the
correct binary but to know the ABI we need busybox.

Since uname is part of the POSIX standard and this issue only effects
the LinuxTarget (AndroidTarget gets this from build.prop) it is safe
to assume all LinuxTargets should have uname.
2016-06-16 13:56:13 +01:00
setrofim
cf791d1e64 Merge pull request #35 from derkling/cgroup-fix-setup
Cgroup fix setup
2016-05-27 16:39:50 +01:00
setrofim
bbee251547 Merge pull request #39 from ep1cman/fixes
AndroidDevice: kick-off no longer requires root
2016-05-27 16:37:55 +01:00
Sebastian Goscik
9af32ec485 AndroidDevice: kick-off no longer requires root
kick off will now use root if the device is rooted or if manually
specified otherwise its run without root.
2016-05-27 16:36:45 +01:00
Sergei Trofimov
89256fd408 connetion: fixing None timeout issue
Connection objects set timeout to a default value in case a timeout is
not specified. However, Target defaults timeout to None and passes that
to connection, overridng the default.

This commit ensures that default timeout remains set if calling code
specified timemout as None.

Fix for issue

https://github.com/ARM-software/devlib/issues/34
2016-05-17 14:00:01 +01:00