/usr/bin/app-launch-profiler-lttng is in ubuntu-app-launch-profiler 1.3.1918+16.04.20160404-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #!/usr/bin/env python3
# Copyright 2015 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; version 2.1.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author: Benjamin Zeller <benjamin.zeller@canonical.com>
import babeltrace
import sys
import getopt
class MyCounter(dict):
def __missing__(self, key):
return 0
if __name__ == '__main__':
verbose_mode = False
try:
opts, args = getopt.getopt(sys.argv[1:], "hi:v", ["help",
"inputdata="])
except getopt.GetoptError:
print("app-launch-profiler-lttng -i <inputdata>")
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print("app-launch-profiler-lttng -i <inputdata>")
sys.exit()
elif opt in ("-i", "--idata"):
inputdata = arg
elif opt in ("-v", "--verbose"):
verbose_mode = True
else:
assert False, "unhandled option"
sys.exit(2)
col = babeltrace.TraceCollection()
if col.add_traces_recursive(inputdata, 'ctf') is None:
raise RuntimeError('Cannot add trace')
first_event = -1
iterations = 0
events_in_iteration = 2
numbers = MyCounter()
minNumbers = MyCounter()
maxNumbers = MyCounter()
for event in col.events:
if (event.name == "app:invokeApplauncher"):
if (events_in_iteration != 2):
raise RuntimeError("Wrong Nr of events: " +
str(events_in_iteration))
events_in_iteration = 1
first_event = event.timestamp
# print("Event "+event.name+" occurs after: "+str(0))
iterations += 1
else:
events_in_iteration += 1
duration = event.timestamp-first_event
numbers[event.name] += duration
if minNumbers[event.name] == 0:
minNumbers[event.name] = duration
elif minNumbers[event.name] > duration:
minNumbers[event.name] = duration
if maxNumbers[event.name] < duration:
maxNumbers[event.name] = duration
# print("Event "+event.name+" occurs after: " +
# str((event.timestamp-first_event) / 1000 / 1000 / 1000))
for event in numbers:
if (verbose_mode):
print("---------- Event "+event+" ----------")
print("Min: " + str(round(minNumbers[event] /
1000 / 1000 / 1000, 4)))
print("Max: " + str(round(maxNumbers[event] /
1000 / 1000 / 1000, 4)))
print("Avg: " + str(round(numbers[event] / iterations /
1000000/1000, 4)))
else:
print(str(round(numbers[event]/iterations/1000000/1000, 4)))
|