aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-05 07:33:38 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-05 07:33:38 +0000
commitad62d3bbb2178c1458c466e2e09dfa2060556c37 (patch)
tree11a53e4d5eaae2a508165e3b1c5001e4e1bbd374
parentf562a555c722fd7d8a2d2044a73971efec2e9a9a (diff)
parent9d118e56d67ee600272717fb44c896a092c7922e (diff)
downloadlisa-oreo-dr2-release.tar.gz
Change-Id: I172fbc67fbb67d3df3fe2708c2eb61d16a48a039
-rw-r--r--libs/utils/trace.py19
-rw-r--r--libs/utils/trace_callback.py25
-rw-r--r--src/shell/android-post.sh13
3 files changed, 51 insertions, 6 deletions
diff --git a/libs/utils/trace.py b/libs/utils/trace.py
index ada8db4..d3cabed 100644
--- a/libs/utils/trace.py
+++ b/libs/utils/trace.py
@@ -78,7 +78,9 @@ class Trace(object):
normalize_time=True,
trace_format='FTrace',
plots_dir=None,
- plots_prefix=''):
+ plots_prefix='',
+ event_callbacks={},
+ build_df=True):
# The platform used to run the experiments
self.platform = platform
@@ -108,6 +110,10 @@ class Trace(object):
# List of events required by user
self.events = []
+ # Stuff for event callback support
+ self.event_callbacks = event_callbacks
+ self.build_df = build_df
+
# List of events available in the parsed trace
self.available_events = []
@@ -135,6 +141,11 @@ class Trace(object):
self.__registerTraceEvents(events)
self.__parseTrace(data_dir, tasks, window, normalize_time,
trace_format)
+
+ if not self.build_df:
+ self._log.info('Data frames not built for the trace')
+ return
+
self.__computeTimeSpan()
# Minimum and Maximum x_time to use for all plots
@@ -242,7 +253,9 @@ class Trace(object):
raise ValueError("Unknown trace format {}".format(trace_format))
self.ftrace = trace_class(path, scope="custom", events=self.events,
- window=window, normalize_time=normalize_time)
+ window=window, normalize_time=normalize_time,
+ event_callbacks=self.event_callbacks,
+ build_df=self.build_df)
# Load Functions profiling data
has_function_stats = self._loadFunctionsStats(path)
@@ -253,6 +266,8 @@ class Trace(object):
if has_function_stats:
self._log.info('Trace contains only functions stats')
return
+ elif not self.build_df:
+ return
raise ValueError('The trace does not contain useful events '
'nor function stats')
diff --git a/libs/utils/trace_callback.py b/libs/utils/trace_callback.py
new file mode 100644
index 0000000..6115adf
--- /dev/null
+++ b/libs/utils/trace_callback.py
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: Apache-2.0
+#
+# Copyright (C) 2017, Google and contributors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from trace import Trace
+
+class TraceCallback(object):
+ """
+ The TraceCallbacks object which is used for event-driven trace analysis
+ """
+ def __init__(self, trace_path, callbacks):
+ self.trace_obj = Trace(None, trace_path, callbacks.keys(), event_callbacks=callbacks, build_df=False);
diff --git a/src/shell/android-post.sh b/src/shell/android-post.sh
index cd3292f..57bf4a5 100644
--- a/src/shell/android-post.sh
+++ b/src/shell/android-post.sh
@@ -11,15 +11,20 @@ else
export PYTHONPATH=$lisadir:$PYTHONPATH
echo "Welcome to LISA $TARGET_PRODUCT environment"
echo "Target-specific scripts are located in $lisadir"
-
- monsoon_path="$ANDROID_BUILD_TOP/cts/tools/utils/"
- export PATH="$monsoon_path:$PATH"
- echo "Monsoon will run from: $monsoon_path"
else
echo "LISA scripts don't exist for $TARGET_PRODUCT, skipping"
fi
fi
+if [ -z "$CATAPULT_HOME" ]; then
+ export CATAPULT_HOME=$LISA_HOME/../chromium-trace/catapult/
+ echo "Systrace will run from: $(readlink -f $CATAPULT_HOME)"
+fi
+
+monsoon_path="$LISA_HOME/../../cts/tools/utils/"
+export PATH="$monsoon_path:$PATH"
+echo "Monsoon will run from: $(readlink -f $monsoon_path/monsoon.py)"
+
export PYTHONPATH=$LISA_HOME/../devlib:$PYTHONPATH
export PYTHONPATH=$LISA_HOME/../trappy:$PYTHONPATH
export PYTHONPATH=$LISA_HOME/../bart:$PYTHONPATH