History log of /external/trappy/tests/test_base.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
7f0b67931d5035205915a27cf6808707cf5b2030 28-Jun-2017 Joel Fernandes <joelaf@google.com> trappy: add support to parse TGID in systrace

Change-Id: Ie79698d90e0406cc11c52d364144ec08c33dfac4
Signed-off-by: Joel Fernandes <joelaf@google.com>
/external/trappy/tests/test_base.py
8dcd96197ec48f37615d3ae7c6465e41f4ca6e3f 20-Jun-2017 Patrick Bellasi <patrick.bellasi@arm.com> trappy/ftrace: add support for boot clock timestamp

FTrace can be configured to report events timestamp using different
clock sources which can be selected via the trace_clock sysfs attribute
as described in:
https://www.kernel.org/doc/Documentation/trace/ftrace.txt

The global clock source reports time in [s] with a [us] resolution.
Other sources instead, like for example the boot clock, uses [ns].
Thus, in these last cases we do not have decimals in the timestamp.

Let's update the special fields regexp to match both [s] and [ns]
formatted times and do the required pre-processing to ensure that
DataFrames are alwasy expressed using a [s].[decimals] format.
This also update the base test to add a set of trace events which are
expressed in [ns] resolution.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Reviewed-by: KP Singh <kpsingh@google.com>
/external/trappy/tests/test_base.py
1954b37df094fce96ed345344da920dd248597d9 14-Jun-2017 Patrick Bellasi <patrick.bellasi@arm.com> trappy/tests: add a new test for new line number parsing

Let's test that the parsed events have the proper line number reported
in their DF.

Signed-off-by: Joel Fernandes <joelaf@google.com>
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Reviewed-by: KP Singh <kpsingh@google.com>
/external/trappy/tests/test_base.py
658d4cc50a81cc0234bd4cdb3fa87f38782223b1 14-Jun-2017 Joel Fernandes <joelaf@google.com> trappy/ftrace: add a line number column

Useful for joining DataFrames that have timestamp collisions or for
iterating through a group of DataFrames in line order.

Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-by: KP Singh <kpsingh@google.com>
/external/trappy/tests/test_base.py
214940f3fb53b45358168759f7198149b9dd01bf 16-Jan-2017 Brendan Jackman <brendan.jackman@arm.com> base: Don't error on event field values containing '='

If a trace field value contains a '=', we currently get a ValueError('Too many
values to unpack'). Instead, let's only split on the first '='.

In practice if a field value contains a '=' it's probably because a kernel
developer typo'd a custom event like:

/* Note missing space between "%d" and "bar" */
trace_printk("my_broken_event: foo=%dbar=%d", foo, bar)

So I did consider raising an explicit 'malformed event field' error. But this
approach is more flexible in case someone really wanted to trace fields
containing strings with '=' in them.
/external/trappy/tests/test_base.py
e81fdcb135d0325e3bc22fae0583555d20aae280 04-Jan-2017 Brendan Jackman <brendan.jackman@arm.com> Update ARM Ltd. copyright to 2017
/external/trappy/tests/test_base.py
8a3fdcd2ea43b4e49330f21af433f5be214b7b5a 28-Mar-2016 Patrick Bellasi <patrick.bellasi@arm.com> ftrace: improve special fields matching

612384c (ftrace: match comm names that have a '[' as part of their name)
fixed parsing of special fields to match also names with contains a '['
by forcing a task name to match up to 16 chars.
This regexp seems to not be robust enough for systrace collected traces.
Indeed, not only names can contains the '[' char but, in general, they can
also be longer than 16 chars.

What happen is that, while the linux kernel truncates a task name (comm) to
16 chars, the systrace tool tries its best to "fix" that by fixing truncated
names. Specifically, this is done by the "atrace" agent, e.g.
https://github.com/catapult-project/catapult/blob/0d71be6/systrace/systrace/agents/atrace_agent.py#L583

Thus, in traces collected via systrace/atrace, not only names can contain
the '[' character but they can also be longer than 16 chars.

This patch uses a more generic reg-exp, which is a refinemend of the one
proposed in PR #90, which finally should allow to match task names of any
length and set of used characters.
A meaningless but challenging task name has been added in the test to
proof the patch and ensure a more robust coverage of this "sensible" code.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
/external/trappy/tests/test_base.py
612384c42c3f00725f555265b5ba2f92de2c1e99 07-Mar-2016 Javi Merino <javi.merino@arm.com> ftrace: match comm names that have a '[' as part of their name

990f925224107 ("run: update special fields regexp to parse task names with a
space") fixed parsing task names that had spaces by assuming that no task
would have a "[" as part of their name. The day has come that we have found
a task with a "[".

Set the regexp to match anything up to 16 characters. The kernel seems to
limit the task name to 16 characters so this should be safe from now on (until
we find another task that breaks the regexp, that is).
/external/trappy/tests/test_base.py
cb53daadd0e199791871c1d261b160b6ea02030d 07-Mar-2016 Javi Merino <javi.merino@arm.com> tests: simplify test_parse_special_fields by using float for timestamps
/external/trappy/tests/test_base.py
d9cdc2b52f69d47529b86de41c7cc8e9ef53745a 07-Mar-2016 Javi Merino <javi.merino@arm.com> test: use existing timestamp in test_parse_special_field

Calculating our the timestamp for the index of events is not needed. Tell
trappy to not normalize the time and that way we don't need to do the
error-prone calculation ourselves.
/external/trappy/tests/test_base.py
416e23442c484b09bfda2704fdea73a148fc6a67 07-Mar-2016 Javi Merino <javi.merino@arm.com> tests: fix typo in test_special_fields

timestap -> timestamp. It was working because a previous timestamp was
present.
/external/trappy/tests/test_base.py
4ec4aee55dbd4045cfb6a2fe099615a569ce7ff7 05-Jan-2016 Javi Merino <javi.merino@arm.com> trappy: update copyright to 2016
/external/trappy/tests/test_base.py
a5db2d84050d18299f20c227b5f82895584a3c79 22-Dec-2015 Javi Merino <javi.merino@arm.com> tests: unregister dynamically created classes in the tests

The classes registered dynamically in the tests persist across the
execution of the testsuite. That makes the testsuite sometimes fail if
a test has added a class to the sched scope and
test_ftrace_has_all_classes_scope_sched() run concurrently. Unregister
the dynamic events when the tests that register them finish.
/external/trappy/tests/test_base.py
fecb2676b883265a98e37deff1e4764337647c16 21-Dec-2015 Javi Merino <javi.merino@arm.com> dynamic: ensure dynamic methods refer to ftrace

Now that we can have traces coming from sources other than ftrace,
rename register_dynamic() and register_class() to
register_dynamic_ftrace() and register_ftrace_parser() to make it clear
that they are only available for traces coming from ftrace.
/external/trappy/tests/test_base.py
c26a323210533d4ed3a8b4e62c33744236e3beda 11-Dec-2015 Javi Merino <javi.merino@arm.com> ftrace: rename Run to FTrace

Run is a very generic and inappropriate name for an object that parses
the result of ftrace into a form consumable by python. Rename it to
FTrace in preparation for its generalization.
/external/trappy/tests/test_base.py
435457c8af9d69383ba45e0bd7da022d967a8dea 10-Aug-2015 Javi Merino <javi.merino@arm.com> trappy: rename to trappy

Change-Id: I7e0e34c9f5565e34629683bb29ab25cf5e737088
/external/trappy/tests/test_base.py
aace7c0732cac769f1ffe95a89591b6217fa9447 10-Aug-2015 Javi Merino <javi.merino@arm.com> cr2: change copyright to Apache 2

Change-Id: Ie505af7efb7526f94b1cc9e37195cbd2e0451b9d
/external/trappy/tests/test_base.py
8fa0f5c87eecdee7ac24c242359dd13be74530f2 19-Jun-2015 Javi Merino <javi.merino@arm.com> cr2: remove shebang from module files

Change-Id: Ia27765444594448313b955a7808b3532fb89df50
/external/trappy/tests/test_base.py
e9780cfc365c3868d58f0d30129bf44ed6ef5d25 24-Jun-2015 Javi Merino <javi.merino@arm.com> doc: move one of the trace test files to the doc/ folder

The tests/ folder is not available for external people. By having an
example trace in the doc/ folder, people that download cr2 from dropzone
can play and modify the examples.

Change-Id: I866c1d254b8cb72664bad14611c1159f975bf46a
/external/trappy/tests/test_base.py
2cfd1e8efc013d4453147a1a284f164c0248321d 21-Apr-2015 Javi Merino <javi.merino@arm.com> cr2: rename power.py to cpu_power.py

We're going to get gpu power information so clarify that InPower and
OutPower refer to the cpu by prepending Cpu to their class names.

Redo a couple of the docs that had that name on it while we are at it.

Change-Id: If05882a7e8521d01cbd6b95370de3f92669b25a6
Signed-off-by: Javi Merino <javi.merino@arm.com>
/external/trappy/tests/test_base.py
034e7cc3f2c7ae3b6618b9286249a0c5390cc088 22-Apr-2015 Javi Merino <javi.merino@arm.com> tests: add copyright headers to all test files

They are missing and we need them if we want to opensource this.

Change-Id: I456ecd5ac5e33c7ada234f490389572d8932090b
Signed-off-by: Javi Merino <javi.merino@arm.com>
/external/trappy/tests/test_base.py
990f9252241074aca73612d4f25ae84ae0c32ea5 24-Apr-2015 Patrick Bellasi <patrick.bellasi@arm.com> run: update special fields regexp to parse task names with a space

Chrome spawn a number of tasks which have a space in between. This produces
trace files which could have events starting with, for example:

AsyncTask #1-9241 [001] 1033.379578:

This patch update the regular expression used to parse the special fields
at the beginning of each event in such a way to properly grab the taskname
even when it presents a space in it.

The propose patch should be valid as long as we could assume there is not
tasks which name includes the "[" char.

This patch adds also a test case to verify proper parsing of all common
fields for a set of events. The set of events could easily be extended
to check for more tasks names.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
/external/trappy/tests/test_base.py
d721b27ead40c39efa1f1febdd853f9b04c54984 20-Apr-2015 Javi Merino <javi.merino@arm.com> tests: new thermal trace data

We now have trace for devfreq cooling, for the gpu, so get new trace
data that contains it. Fix the tests that broke because of the new
data.

Change-Id: I9e0e7e575fa69e40a8811f6979f9f50f5ff71106
/external/trappy/tests/test_base.py
69c59882c6af7c496a6eb864cdf2e6e4e3444ee1 30-Mar-2015 Javi Merino <javi.merino@arm.com> tests: make test_parse_values_concatenation() operate on a unique trace
event

When running nosetests from the tests/ directory, all tests are run
within the same import of cr2. Therefore, invocations of
register_dynamic() are persistent and affect the tests that follow them.
test_run_basetime_empty(), test_run_normalize_some_tracepoints() and
test_empty_trace_txt() all expect that the file they are parsing doesn't
have any known traces. Because the register_dynamic() in
test_parse_values_concatenation() is persistent, they now parse that
trace and that makes these tests fail. Again, this only happens if
nosetests is run from the tests/ directory.

Change the event registered by test_parse_values_concatenation() to
something unique and not present in the "empty" traces, so that the
tests that expect to parse a file without meaningful traces succeed.

Change-Id: I31ac4f0ad636c28d49e0db5345d9a27d8bd62d6c
Signed-off-by: Javi Merino <javi.merino@arm.com>
/external/trappy/tests/test_base.py
64965eb65c62be4fbc41f5fb6a8093bfa0e20315 30-Mar-2015 Javi Merino <javi.merino@arm.com> tests: make test_parse_values_concatenation() register the
sched_stat_runtime as part of the sched scope

When running nosetests from the tests/ directory, all the tests are
collated and run together, with only one import of cr2. Because of
that, every register_dynamic() invocation is persistent and every test
run afterwards is affected by it. As such, registering
sched_stat_runtime affects the result of test_get_filters() in
test_sched.py when nosetests is run from the tests/ directory.

Fix it by adding the appropriate scope to register_dynamic().

Change-Id: Ia8d87df4dce563f2838265c1fa3e695fd96ddcb9
Signed-off-by: Javi Merino <javi.merino@arm.com>
/external/trappy/tests/test_base.py
af26671e7b10327ee18b7d7c561ad08352133e4d 27-Mar-2015 Javi Merino <javi.merino@arm.com> run: parse the special fields of a trace

Ftrace collects the current program, the pid and the cpu when any trace
event is generated. Add that information to every event in every class
as it's present and can be valuable.

Change-Id: I63a615ae8e303d80b83cb490026109d319e79018
/external/trappy/tests/test_base.py
6df06c151c555145d427bad0c4af1d21b9e2c53f 20-Mar-2015 Patrick Bellasi <patrick.bellasi@arm.com> base: fix concatenation of numerical values

A previous patch:
8deda27b thermal: fix parsing of spaced value attributes
introduced the support to parse key-value pairs where the value is a string
with spaces. This fix was mainly targeted to recover the complete task name
for "comm=" key which is reported by many event classes.
However, this patch is broken for other classes of events.

All the events in the sched_stat_* class report a unit of measure after
the numerical value of a key. These are some examples:

sshd-1779 [000] 77.948169: sched_stat_sleep: comm=sshd pid=1574 delay=210542666 [ns]
rcu_preempt-7 [000] 73.714509: sched_stat_runtime: comm=rcu_preempt pid=7 runtime=184333 [ns] vruntime=17097006397 [ns]
<idle>-0 [004] 67.138996: sched_stat_iowait: comm=taskset pid=1773 delay=9385208 [ns]
<idle>-0 [004] 67.128158: sched_stat_blocked: comm=sh pid=1773 delay=5493958 [ns]

In general it make sense to concatenate a value to a following space separated
string only if the first token assigned to a key is itself a string.
In all other cases, i.e. the current key value is not a string, the
concatenation operation is not safe and also produce run-time exceptions.
This is the case of the previous trace events, where the a number is going
to be concatenated with a string.

This patch introduces a further check to enable concatention only if the
current key value is a string.
NOTE: in that case the current token is simply discarded, this should not be
an issue since:
1. the current token is not a "key=value" pair
2. it is numerical value which could not be assigned to a
corresponding key

This patch adds also a test case to verify proper parsing of string
concatenated values as well as numerical values (not concatenated to a
following string value).

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
/external/trappy/tests/test_base.py
6649249398eb95f803f37df0672d26e21d522c95 12-Jan-2015 Javi Merino <javi.merino@arm.com> tests: new trace data

Two keys in the cpu cooling device have changed, so update the trace
with that information and fix the tests that broke because of that.
/external/trappy/tests/test_base.py
2da87108eda35a299bfdd4796d661fefffd5ba78 15-Dec-2014 Dietmar Eggemann <dietmar.eggemann@arm.com> cr2/run,thermal: read trace file only once

Let the run object read the trace file only once at distribute the data
and the timestamp to the class object in case the trace line contains its
unique word.

Move the function trace_parser_explode_array into class Base as method
explode_array since now each class Base obbject applies the explode
function on its own parsed_data array.

Comparing the old and new trace approach taking a trace file with
1.000.000 entries shows that the new approach takes only half the time
(~6s versus 11s on an otherwise idling Intel(R) Core(TM) i5-3320M CPU @
2.60GHz).

Change-Id: I725652f50372269abc6fd172ddd721723762c8b0
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
/external/trappy/tests/test_base.py
0e112d697421b4a4c7c8b5e6eb58722c25000ac5 16-Dec-2014 Javi Merino <javi.merino@arm.com> tests: rename trace.txt to trace_thermal.txt

While we are at it, rename trace_empty.txt to trace_sched.txt, as it
better describes what it is.
/external/trappy/tests/test_base.py
1bd53051ba04627141d6ddf9a0dd655877c16a62 16-Dec-2014 Javi Merino <javi.merino@arm.com> tests: don't use trace_empty.txt in TestBase
/external/trappy/tests/test_base.py
10f90ef1aa3bb7447409d128bf629b2ff8cfbaf1 16-Dec-2014 Javi Merino <javi.merino@arm.com> tests: learn to rename files that are copied for all tests

Make files_to_copy an array of tuples in which the first element is
the source filename and the second the destination name. That we can
rename files, useful since CR2 assumes that the trace is called trace.txt.
/external/trappy/tests/test_base.py
b42a50b19e4b99d1ccf1ee5d2478f958a07d5c20 11-Dec-2014 Dietmar Eggemann <dietmar.eggemann@arm.com> cr2/thermal, base: factor out class Base

To be able to use cr2 for other class objects then thermal related one,
put class Base into an extra file to split it from any thermal specific
functionality.

The test cases have been rearranged accordingly.

Change-Id: I48a8e1d6be27bc595795a2602480da931b9cbf71
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
/external/trappy/tests/test_base.py