Functions profiling data are reported in a set of files, one for each CPU.
This patch adds the required support to collect these data into a single
JSON formatted file. Data are collected using a shutils routing on the
target side and formatted in JSON on the host side.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Function stats can be collected while events are accumulated into a trace.
This function adds the required support to start and stop functions
profiling across a trace collection.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
FTrace allows to collect profiling stats for kernel functions.
This patch adds the initial support which allows to specify a list of
kernel function we would like to profile.
If a list of functions to profile is specified, for each specified function
we check for that function to be actually one of the available instrumented
functions which can be monitored by FTrace.
If a function is not supported, we throw an expection so that the user
is aware about the analysis which is going to do.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
All ftrace generated files are present under a common base folder.
This patch updates the FtraceCollector API to exposes just the common
base folder from where all the other paths can be generated.
This is a refactoring patch which makes it easier to add further attributes.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
The time required to fetch a trace depends not only on it time length but
also on the amount of events collected and the processing power of the
target device. This patch tries to factorise these last two components
into a 5x constant which is good enough to collect a relatively big trace
on a relatively slow device.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This patch adds a couple of shutils functions to efficiently read all
the frequencies/governors and returne them into a dictionary indexed by
CPU id.
The shutils functions are returning a line per each CPU that can be easily
converted into a dictionary in the host side.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This patch convert some functions to the usage of shutils provided calls.
This approach is more portable and allows to use these calls also on
an Android target.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Some complex operations are faster if executed on the target side with the
help of a small script. For example, reading the current frequency and
or governor for all the online CPUs.
This patch adds a support script to be deployed on the target as well as
an internal utility function which allows to call functions provided by
that support script.
The support script has to be cross platform, thus:
1. only a limited set of shell functions can be used, which must be supported
both in BASH and the Android shell
2. some paths needs to be defined depending on the specific target
To address the last constrain, this patch provides a "template" script which
contains some tokens "__DEVLIB_<TOKEN>__" that are replaced right before to
push the script on the target.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
The ADB pull command allows only to pull a single file or a whole directory.
This patch adds the required support to pull only a selection of files, from
a target folder, which match a path specified using '*' and/or '?' wildcards.
In this case we first get the list of files on the target, using the
wildcard expansion support provided by the "ls" command, and than we pull
each and every file returned from the previous command.
This operation mode is available only if the 'dest' parameter is a valid
host-side folder.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
When you create a target using devlib, you may not set
load_default_modules because you want to load a specific list of
modules. In that case, raise a warning if one of those modules failed
to load, as it is something you are not expecting.
In the general case, the standard set of modules are tried to be loaded.
We know that they are not supported for all platforms so just emit a
debug message.
When add channel for power meter with specific order, it also imply the
order with corresponding fields in captured data. So later need read
back the index for channel and use it to reference power data.
So need use ordered dictionary object for channel.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
If big_core is not explicitly specified by the user, it is populated by
Platform (provided the target has exactly two clusters). Perviously this
was done bu assuming that the target boots on little cluster and that
the last CPU is big. This is still used as a fallback, but now Platform
is ware of the names of big CPUs in currently existing big.LITTLE
configurations and uses that first to identify the big.
If env is specified, U-Boot module will wait for U-Boot prompt and then
interrupt the boot sequence so it should be updated. The vexpress module
that used it always set the env to contain bootargs (even if they were
None), always causing boot to be interrupted, even when that is not
necessary. This update means that boot will be interrupted only if
bootargs were specified (and therefore env needs to be updated).
This allows clients to use the instrument more easily from their code
if they were previously used to using an HWMON-style interface.
In order to provide the measurement, the existing readenergy binary
is updated and changed so that if no output option is specified then
we just print the current values and exit.
Signed-off-by: Chris Redpath <chris.redpath@arm.com>
In workload automation, utils.android._initialize_without_android_home()
gets android_home from adb's path. When this code was copied to devlib,
we mistakenly dropped parsing the output of "which" and instead call
os.path.dirname() on "adb", which always returns "" and makes
_initialize_without_android_home() fail.
Make _initialize_without_android_home() parse the output of "which"
again.
In order to execute as root, the command string gets echo'd into so;
previusly, double quotes were used in echo, which caused any veriables
in the command string to be expanded _before_ it was echoed.
This fixes an issue introduced in
64261a65cb8c4c7daeb35186f16d246d3211fa0a
The addtional echo means that $? will always have "0" (the exit code for
the echo). This removes the extra echo, prepending \n to $? instead
Since for specific platforms (Juno/TC2) we know what the big core is, we
can set the big_core default so it doesn't have to be specified by the
user. Also remove validation prior to being updated from target and
setting little_core based on the value of big_core rather than by
indexing into core_names.
- adb protcol uses "\r\n" for line breaks. This is not handled by
Python's line break translation, as not a file. So spliting on '\n'
when extracting the exit code resulted in stray '\r' in the output.
- adb_shell expects exit code to be echoed on the same line. This may
not have been the case if latest output from executed command was not
a complete line. An extra echo will now ensure that the exit code will
be on its own line even in that case.
Add a thermal module that will allow querying for thermal zones and trip
points in the target. The module allow supports enable/disabling thermal
zones as well as change trip temperatures.
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
get_installed() looks in self.executables_directory for the binary. This
may not exist on a target (this is created when setup() is invoked).
This commit updated get_installed() to check whether target_directory
exists first, avoiding the error.
Default paths for working_directory and exectuables_directory used to be
resolved at the end of the connect (because for Linux targets, the
default changes depending on the connection). This is now offloaded to a
separate internal method that is invoked earlier during connect() (after
the connection is established but before other connection actions are
resolved, as some of those actions rely on the directories being set).
When the cpufreq module is loaded, quite likely we want to run experiments
which involve an analysis of frequencies transitions. However, if during
an experiment there are not cpu_frequency events, the generated trace
does not allows to know at which frequency the experiment has been executed.
This happens for example when we are running at constant frequency or just
because the workload is not generating a variable capacity request in the
system.
This path ensure the a "cpu_frequency" events is always generated at the
beginning and at the end of a collected trace. This support is required
for example to properly plot CPUs frequencies event when there are not
CPUFreq generated changes of OPP.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This patch add a method which allows to inject into a trace a "cpu_frequency"
event for each CPU reporting the current frequency the CPU is running at.
Such a method could be useful to force report CPUs frequency into a trace
file, for example at tracing start and stop, thus allowing to know always
at which frequency an experiment has been executed.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Sometimes it could be required to change governor or frequency for a all the
online CPUs of a target. This patch provides an utility method to easily
do that using a single method call.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Sometimes it could be required to change the governor for a set of different
CPUs. This patch provides an utility method to easily and achieve that with
a single method call.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This patch refactors the CGroup module to support multiple controllers.
The new interface is based on two main classes:
.:: Controller(kind)
Provides a wrapper class for a CGgroup controller of "kind".
At module initialization time, all the controller available in the
system are enumerated and a corresponding controller class created.
A valid reference to the Controller class for a specific CGroup
controller can be obtained using the controller(kind) method exposed
by the module, e.g. to get a reference to the CPUSET controller:
cpuset = target.cgroups.controller('cpuset')
.:: CGroup(name)
Provides a wrapper class for a CGroup of "name", i.e. a folder which
path is "name" relative to the controller mount point.
At module initialization time, the root control group for each
controller is created by the controller class.
A valid reference to a CGroup for a specific controller can be
obtained using the cgroup(name) method exposed by the controller
object, e.g. to get a reference to the "/LITTLE" cgroup of the
cpuset controller:
cpuset_littles = cpuset.cgroup('/LITTLE')
The CGroup object exposes simple get()/set() methods which allows to
read and configure all the supported attributes of a controller.
For example, to set the "cpus" of a cpuset control group:
cpuset_littles.set(cpus=[0,1])
NOTE: the set() method accepts a variable list of parameters which name
must match a valid (writable) attribute for that controller.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This should help on fixing issue related to echoed commands which make
it difficult to parse the commands results.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
By default the terminal emulated by pxssh is 24x80 in size, which force
the addition of unwanted "\r" in long commands. These \r are painful to
parse and remove from the echoed command.
This patch tries to alleviate this issue by setting a bigger TTY terminal
by default. A 200 columns display should be big enough to execute most
of the commands. In case longer commands are required it is better
have them on a script to push on the target for execution.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
The pexpect module exposes a fdpexpect class starting from version 4.0.
This patch makes uses of the proper pxssh import statement depending on the
version of pexpect available in the host.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
The pexpect module exposes a pxssh class starting from version 4.0.
This patch makes uses of the proper pxssh import statement depending on the
version of pexpect available in the host.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>