diff options
Diffstat (limited to 'tools/perf/scripts/python')
17 files changed, 553 insertions, 48 deletions
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py index de7211e4fa47..38dfb720fb6f 100644 --- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py +++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | |||
@@ -107,12 +107,13 @@ def taskState(state): | |||
107 | 107 | ||
108 | class EventHeaders: | 108 | class EventHeaders: |
109 | def __init__(self, common_cpu, common_secs, common_nsecs, | 109 | def __init__(self, common_cpu, common_secs, common_nsecs, |
110 | common_pid, common_comm): | 110 | common_pid, common_comm, common_callchain): |
111 | self.cpu = common_cpu | 111 | self.cpu = common_cpu |
112 | self.secs = common_secs | 112 | self.secs = common_secs |
113 | self.nsecs = common_nsecs | 113 | self.nsecs = common_nsecs |
114 | self.pid = common_pid | 114 | self.pid = common_pid |
115 | self.comm = common_comm | 115 | self.comm = common_comm |
116 | self.callchain = common_callchain | ||
116 | 117 | ||
117 | def ts(self): | 118 | def ts(self): |
118 | return (self.secs * (10 ** 9)) + self.nsecs | 119 | return (self.secs * (10 ** 9)) + self.nsecs |
diff --git a/tools/perf/scripts/python/bin/export-to-postgresql-record b/tools/perf/scripts/python/bin/export-to-postgresql-record new file mode 100644 index 000000000000..221d66e05713 --- /dev/null +++ b/tools/perf/scripts/python/bin/export-to-postgresql-record | |||
@@ -0,0 +1,8 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # | ||
4 | # export perf data to a postgresql database. Can cover | ||
5 | # perf ip samples (excluding the tracepoints). No special | ||
6 | # record requirements, just record what you want to export. | ||
7 | # | ||
8 | perf record $@ | ||
diff --git a/tools/perf/scripts/python/bin/export-to-postgresql-report b/tools/perf/scripts/python/bin/export-to-postgresql-report new file mode 100644 index 000000000000..cd335b6e2a01 --- /dev/null +++ b/tools/perf/scripts/python/bin/export-to-postgresql-report | |||
@@ -0,0 +1,29 @@ | |||
1 | #!/bin/bash | ||
2 | # description: export perf data to a postgresql database | ||
3 | # args: [database name] [columns] [calls] | ||
4 | n_args=0 | ||
5 | for i in "$@" | ||
6 | do | ||
7 | if expr match "$i" "-" > /dev/null ; then | ||
8 | break | ||
9 | fi | ||
10 | n_args=$(( $n_args + 1 )) | ||
11 | done | ||
12 | if [ "$n_args" -gt 3 ] ; then | ||
13 | echo "usage: export-to-postgresql-report [database name] [columns] [calls]" | ||
14 | exit | ||
15 | fi | ||
16 | if [ "$n_args" -gt 2 ] ; then | ||
17 | dbname=$1 | ||
18 | columns=$2 | ||
19 | calls=$3 | ||
20 | shift 3 | ||
21 | elif [ "$n_args" -gt 1 ] ; then | ||
22 | dbname=$1 | ||
23 | columns=$2 | ||
24 | shift 2 | ||
25 | elif [ "$n_args" -gt 0 ] ; then | ||
26 | dbname=$1 | ||
27 | shift | ||
28 | fi | ||
29 | perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/export-to-postgresql.py $dbname $columns $calls | ||
diff --git a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record index 8104895a7b67..74685f318379 100644 --- a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record +++ b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-record | |||
@@ -1,2 +1,3 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | perf record -e raw_syscalls:sys_exit $@ | 2 | (perf record -e raw_syscalls:sys_exit $@ || \ |
3 | perf record -e syscalls:sys_exit $@) 2> /dev/null | ||
diff --git a/tools/perf/scripts/python/bin/sctop-record b/tools/perf/scripts/python/bin/sctop-record index 4efbfaa7f6a5..d6940841e54f 100644 --- a/tools/perf/scripts/python/bin/sctop-record +++ b/tools/perf/scripts/python/bin/sctop-record | |||
@@ -1,2 +1,3 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | perf record -e raw_syscalls:sys_enter $@ | 2 | (perf record -e raw_syscalls:sys_enter $@ || \ |
3 | perf record -e syscalls:sys_enter $@) 2> /dev/null | ||
diff --git a/tools/perf/scripts/python/bin/syscall-counts-by-pid-record b/tools/perf/scripts/python/bin/syscall-counts-by-pid-record index 4efbfaa7f6a5..d6940841e54f 100644 --- a/tools/perf/scripts/python/bin/syscall-counts-by-pid-record +++ b/tools/perf/scripts/python/bin/syscall-counts-by-pid-record | |||
@@ -1,2 +1,3 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | perf record -e raw_syscalls:sys_enter $@ | 2 | (perf record -e raw_syscalls:sys_enter $@ || \ |
3 | perf record -e syscalls:sys_enter $@) 2> /dev/null | ||
diff --git a/tools/perf/scripts/python/bin/syscall-counts-record b/tools/perf/scripts/python/bin/syscall-counts-record index 4efbfaa7f6a5..d6940841e54f 100644 --- a/tools/perf/scripts/python/bin/syscall-counts-record +++ b/tools/perf/scripts/python/bin/syscall-counts-record | |||
@@ -1,2 +1,3 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | perf record -e raw_syscalls:sys_enter $@ | 2 | (perf record -e raw_syscalls:sys_enter $@ || \ |
3 | perf record -e syscalls:sys_enter $@) 2> /dev/null | ||
diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py index 4647a7694cf6..334599c6032c 100644 --- a/tools/perf/scripts/python/check-perf-trace.py +++ b/tools/perf/scripts/python/check-perf-trace.py | |||
@@ -27,7 +27,7 @@ def trace_end(): | |||
27 | 27 | ||
28 | def irq__softirq_entry(event_name, context, common_cpu, | 28 | def irq__softirq_entry(event_name, context, common_cpu, |
29 | common_secs, common_nsecs, common_pid, common_comm, | 29 | common_secs, common_nsecs, common_pid, common_comm, |
30 | vec): | 30 | common_callchain, vec): |
31 | print_header(event_name, common_cpu, common_secs, common_nsecs, | 31 | print_header(event_name, common_cpu, common_secs, common_nsecs, |
32 | common_pid, common_comm) | 32 | common_pid, common_comm) |
33 | 33 | ||
@@ -38,7 +38,7 @@ def irq__softirq_entry(event_name, context, common_cpu, | |||
38 | 38 | ||
39 | def kmem__kmalloc(event_name, context, common_cpu, | 39 | def kmem__kmalloc(event_name, context, common_cpu, |
40 | common_secs, common_nsecs, common_pid, common_comm, | 40 | common_secs, common_nsecs, common_pid, common_comm, |
41 | call_site, ptr, bytes_req, bytes_alloc, | 41 | common_callchain, call_site, ptr, bytes_req, bytes_alloc, |
42 | gfp_flags): | 42 | gfp_flags): |
43 | print_header(event_name, common_cpu, common_secs, common_nsecs, | 43 | print_header(event_name, common_cpu, common_secs, common_nsecs, |
44 | common_pid, common_comm) | 44 | common_pid, common_comm) |
diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py new file mode 100644 index 000000000000..4cdafd880074 --- /dev/null +++ b/tools/perf/scripts/python/export-to-postgresql.py | |||
@@ -0,0 +1,444 @@ | |||
1 | # export-to-postgresql.py: export perf data to a postgresql database | ||
2 | # Copyright (c) 2014, Intel Corporation. | ||
3 | # | ||
4 | # This program is free software; you can redistribute it and/or modify it | ||
5 | # under the terms and conditions of the GNU General Public License, | ||
6 | # version 2, as published by the Free Software Foundation. | ||
7 | # | ||
8 | # This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | # more details. | ||
12 | |||
13 | import os | ||
14 | import sys | ||
15 | import struct | ||
16 | import datetime | ||
17 | |||
18 | from PySide.QtSql import * | ||
19 | |||
20 | # Need to access PostgreSQL C library directly to use COPY FROM STDIN | ||
21 | from ctypes import * | ||
22 | libpq = CDLL("libpq.so.5") | ||
23 | PQconnectdb = libpq.PQconnectdb | ||
24 | PQconnectdb.restype = c_void_p | ||
25 | PQfinish = libpq.PQfinish | ||
26 | PQstatus = libpq.PQstatus | ||
27 | PQexec = libpq.PQexec | ||
28 | PQexec.restype = c_void_p | ||
29 | PQresultStatus = libpq.PQresultStatus | ||
30 | PQputCopyData = libpq.PQputCopyData | ||
31 | PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] | ||
32 | PQputCopyEnd = libpq.PQputCopyEnd | ||
33 | PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] | ||
34 | |||
35 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | ||
36 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | ||
37 | |||
38 | # These perf imports are not used at present | ||
39 | #from perf_trace_context import * | ||
40 | #from Core import * | ||
41 | |||
42 | perf_db_export_mode = True | ||
43 | perf_db_export_calls = False | ||
44 | |||
45 | def usage(): | ||
46 | print >> sys.stderr, "Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>]" | ||
47 | print >> sys.stderr, "where: columns 'all' or 'branches'" | ||
48 | print >> sys.stderr, " calls 'calls' => create calls table" | ||
49 | raise Exception("Too few arguments") | ||
50 | |||
51 | if (len(sys.argv) < 2): | ||
52 | usage() | ||
53 | |||
54 | dbname = sys.argv[1] | ||
55 | |||
56 | if (len(sys.argv) >= 3): | ||
57 | columns = sys.argv[2] | ||
58 | else: | ||
59 | columns = "all" | ||
60 | |||
61 | if columns not in ("all", "branches"): | ||
62 | usage() | ||
63 | |||
64 | branches = (columns == "branches") | ||
65 | |||
66 | if (len(sys.argv) >= 4): | ||
67 | if (sys.argv[3] == "calls"): | ||
68 | perf_db_export_calls = True | ||
69 | else: | ||
70 | usage() | ||
71 | |||
72 | output_dir_name = os.getcwd() + "/" + dbname + "-perf-data" | ||
73 | os.mkdir(output_dir_name) | ||
74 | |||
75 | def do_query(q, s): | ||
76 | if (q.exec_(s)): | ||
77 | return | ||
78 | raise Exception("Query failed: " + q.lastError().text()) | ||
79 | |||
80 | print datetime.datetime.today(), "Creating database..." | ||
81 | |||
82 | db = QSqlDatabase.addDatabase('QPSQL') | ||
83 | query = QSqlQuery(db) | ||
84 | db.setDatabaseName('postgres') | ||
85 | db.open() | ||
86 | try: | ||
87 | do_query(query, 'CREATE DATABASE ' + dbname) | ||
88 | except: | ||
89 | os.rmdir(output_dir_name) | ||
90 | raise | ||
91 | query.finish() | ||
92 | query.clear() | ||
93 | db.close() | ||
94 | |||
95 | db.setDatabaseName(dbname) | ||
96 | db.open() | ||
97 | |||
98 | query = QSqlQuery(db) | ||
99 | do_query(query, 'SET client_min_messages TO WARNING') | ||
100 | |||
101 | do_query(query, 'CREATE TABLE selected_events (' | ||
102 | 'id bigint NOT NULL,' | ||
103 | 'name varchar(80))') | ||
104 | do_query(query, 'CREATE TABLE machines (' | ||
105 | 'id bigint NOT NULL,' | ||
106 | 'pid integer,' | ||
107 | 'root_dir varchar(4096))') | ||
108 | do_query(query, 'CREATE TABLE threads (' | ||
109 | 'id bigint NOT NULL,' | ||
110 | 'machine_id bigint,' | ||
111 | 'process_id bigint,' | ||
112 | 'pid integer,' | ||
113 | 'tid integer)') | ||
114 | do_query(query, 'CREATE TABLE comms (' | ||
115 | 'id bigint NOT NULL,' | ||
116 | 'comm varchar(16))') | ||
117 | do_query(query, 'CREATE TABLE comm_threads (' | ||
118 | 'id bigint NOT NULL,' | ||
119 | 'comm_id bigint,' | ||
120 | 'thread_id bigint)') | ||
121 | do_query(query, 'CREATE TABLE dsos (' | ||
122 | 'id bigint NOT NULL,' | ||
123 | 'machine_id bigint,' | ||
124 | 'short_name varchar(256),' | ||
125 | 'long_name varchar(4096),' | ||
126 | 'build_id varchar(64))') | ||
127 | do_query(query, 'CREATE TABLE symbols (' | ||
128 | 'id bigint NOT NULL,' | ||
129 | 'dso_id bigint,' | ||
130 | 'sym_start bigint,' | ||
131 | 'sym_end bigint,' | ||
132 | 'binding integer,' | ||
133 | 'name varchar(2048))') | ||
134 | do_query(query, 'CREATE TABLE branch_types (' | ||
135 | 'id integer NOT NULL,' | ||
136 | 'name varchar(80))') | ||
137 | |||
138 | if branches: | ||
139 | do_query(query, 'CREATE TABLE samples (' | ||
140 | 'id bigint NOT NULL,' | ||
141 | 'evsel_id bigint,' | ||
142 | 'machine_id bigint,' | ||
143 | 'thread_id bigint,' | ||
144 | 'comm_id bigint,' | ||
145 | 'dso_id bigint,' | ||
146 | 'symbol_id bigint,' | ||
147 | 'sym_offset bigint,' | ||
148 | 'ip bigint,' | ||
149 | 'time bigint,' | ||
150 | 'cpu integer,' | ||
151 | 'to_dso_id bigint,' | ||
152 | 'to_symbol_id bigint,' | ||
153 | 'to_sym_offset bigint,' | ||
154 | 'to_ip bigint,' | ||
155 | 'branch_type integer,' | ||
156 | 'in_tx boolean)') | ||
157 | else: | ||
158 | do_query(query, 'CREATE TABLE samples (' | ||
159 | 'id bigint NOT NULL,' | ||
160 | 'evsel_id bigint,' | ||
161 | 'machine_id bigint,' | ||
162 | 'thread_id bigint,' | ||
163 | 'comm_id bigint,' | ||
164 | 'dso_id bigint,' | ||
165 | 'symbol_id bigint,' | ||
166 | 'sym_offset bigint,' | ||
167 | 'ip bigint,' | ||
168 | 'time bigint,' | ||
169 | 'cpu integer,' | ||
170 | 'to_dso_id bigint,' | ||
171 | 'to_symbol_id bigint,' | ||
172 | 'to_sym_offset bigint,' | ||
173 | 'to_ip bigint,' | ||
174 | 'period bigint,' | ||
175 | 'weight bigint,' | ||
176 | 'transaction bigint,' | ||
177 | 'data_src bigint,' | ||
178 | 'branch_type integer,' | ||
179 | 'in_tx boolean)') | ||
180 | |||
181 | if perf_db_export_calls: | ||
182 | do_query(query, 'CREATE TABLE call_paths (' | ||
183 | 'id bigint NOT NULL,' | ||
184 | 'parent_id bigint,' | ||
185 | 'symbol_id bigint,' | ||
186 | 'ip bigint)') | ||
187 | do_query(query, 'CREATE TABLE calls (' | ||
188 | 'id bigint NOT NULL,' | ||
189 | 'thread_id bigint,' | ||
190 | 'comm_id bigint,' | ||
191 | 'call_path_id bigint,' | ||
192 | 'call_time bigint,' | ||
193 | 'return_time bigint,' | ||
194 | 'branch_count bigint,' | ||
195 | 'call_id bigint,' | ||
196 | 'return_id bigint,' | ||
197 | 'parent_call_path_id bigint,' | ||
198 | 'flags integer)') | ||
199 | |||
200 | do_query(query, 'CREATE VIEW samples_view AS ' | ||
201 | 'SELECT ' | ||
202 | 'id,' | ||
203 | 'time,' | ||
204 | 'cpu,' | ||
205 | '(SELECT pid FROM threads WHERE id = thread_id) AS pid,' | ||
206 | '(SELECT tid FROM threads WHERE id = thread_id) AS tid,' | ||
207 | '(SELECT comm FROM comms WHERE id = comm_id) AS command,' | ||
208 | '(SELECT name FROM selected_events WHERE id = evsel_id) AS event,' | ||
209 | 'to_hex(ip) AS ip_hex,' | ||
210 | '(SELECT name FROM symbols WHERE id = symbol_id) AS symbol,' | ||
211 | 'sym_offset,' | ||
212 | '(SELECT short_name FROM dsos WHERE id = dso_id) AS dso_short_name,' | ||
213 | 'to_hex(to_ip) AS to_ip_hex,' | ||
214 | '(SELECT name FROM symbols WHERE id = to_symbol_id) AS to_symbol,' | ||
215 | 'to_sym_offset,' | ||
216 | '(SELECT short_name FROM dsos WHERE id = to_dso_id) AS to_dso_short_name,' | ||
217 | '(SELECT name FROM branch_types WHERE id = branch_type) AS branch_type_name,' | ||
218 | 'in_tx' | ||
219 | ' FROM samples') | ||
220 | |||
221 | |||
222 | file_header = struct.pack("!11sii", "PGCOPY\n\377\r\n\0", 0, 0) | ||
223 | file_trailer = "\377\377" | ||
224 | |||
225 | def open_output_file(file_name): | ||
226 | path_name = output_dir_name + "/" + file_name | ||
227 | file = open(path_name, "w+") | ||
228 | file.write(file_header) | ||
229 | return file | ||
230 | |||
231 | def close_output_file(file): | ||
232 | file.write(file_trailer) | ||
233 | file.close() | ||
234 | |||
235 | def copy_output_file_direct(file, table_name): | ||
236 | close_output_file(file) | ||
237 | sql = "COPY " + table_name + " FROM '" + file.name + "' (FORMAT 'binary')" | ||
238 | do_query(query, sql) | ||
239 | |||
240 | # Use COPY FROM STDIN because security may prevent postgres from accessing the files directly | ||
241 | def copy_output_file(file, table_name): | ||
242 | conn = PQconnectdb("dbname = " + dbname) | ||
243 | if (PQstatus(conn)): | ||
244 | raise Exception("COPY FROM STDIN PQconnectdb failed") | ||
245 | file.write(file_trailer) | ||
246 | file.seek(0) | ||
247 | sql = "COPY " + table_name + " FROM STDIN (FORMAT 'binary')" | ||
248 | res = PQexec(conn, sql) | ||
249 | if (PQresultStatus(res) != 4): | ||
250 | raise Exception("COPY FROM STDIN PQexec failed") | ||
251 | data = file.read(65536) | ||
252 | while (len(data)): | ||
253 | ret = PQputCopyData(conn, data, len(data)) | ||
254 | if (ret != 1): | ||
255 | raise Exception("COPY FROM STDIN PQputCopyData failed, error " + str(ret)) | ||
256 | data = file.read(65536) | ||
257 | ret = PQputCopyEnd(conn, None) | ||
258 | if (ret != 1): | ||
259 | raise Exception("COPY FROM STDIN PQputCopyEnd failed, error " + str(ret)) | ||
260 | PQfinish(conn) | ||
261 | |||
262 | def remove_output_file(file): | ||
263 | name = file.name | ||
264 | file.close() | ||
265 | os.unlink(name) | ||
266 | |||
267 | evsel_file = open_output_file("evsel_table.bin") | ||
268 | machine_file = open_output_file("machine_table.bin") | ||
269 | thread_file = open_output_file("thread_table.bin") | ||
270 | comm_file = open_output_file("comm_table.bin") | ||
271 | comm_thread_file = open_output_file("comm_thread_table.bin") | ||
272 | dso_file = open_output_file("dso_table.bin") | ||
273 | symbol_file = open_output_file("symbol_table.bin") | ||
274 | branch_type_file = open_output_file("branch_type_table.bin") | ||
275 | sample_file = open_output_file("sample_table.bin") | ||
276 | if perf_db_export_calls: | ||
277 | call_path_file = open_output_file("call_path_table.bin") | ||
278 | call_file = open_output_file("call_table.bin") | ||
279 | |||
280 | def trace_begin(): | ||
281 | print datetime.datetime.today(), "Writing to intermediate files..." | ||
282 | # id == 0 means unknown. It is easier to create records for them than replace the zeroes with NULLs | ||
283 | evsel_table(0, "unknown") | ||
284 | machine_table(0, 0, "unknown") | ||
285 | thread_table(0, 0, 0, -1, -1) | ||
286 | comm_table(0, "unknown") | ||
287 | dso_table(0, 0, "unknown", "unknown", "") | ||
288 | symbol_table(0, 0, 0, 0, 0, "unknown") | ||
289 | sample_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
290 | if perf_db_export_calls: | ||
291 | call_path_table(0, 0, 0, 0) | ||
292 | |||
293 | unhandled_count = 0 | ||
294 | |||
295 | def trace_end(): | ||
296 | print datetime.datetime.today(), "Copying to database..." | ||
297 | copy_output_file(evsel_file, "selected_events") | ||
298 | copy_output_file(machine_file, "machines") | ||
299 | copy_output_file(thread_file, "threads") | ||
300 | copy_output_file(comm_file, "comms") | ||
301 | copy_output_file(comm_thread_file, "comm_threads") | ||
302 | copy_output_file(dso_file, "dsos") | ||
303 | copy_output_file(symbol_file, "symbols") | ||
304 | copy_output_file(branch_type_file, "branch_types") | ||
305 | copy_output_file(sample_file, "samples") | ||
306 | if perf_db_export_calls: | ||
307 | copy_output_file(call_path_file, "call_paths") | ||
308 | copy_output_file(call_file, "calls") | ||
309 | |||
310 | print datetime.datetime.today(), "Removing intermediate files..." | ||
311 | remove_output_file(evsel_file) | ||
312 | remove_output_file(machine_file) | ||
313 | remove_output_file(thread_file) | ||
314 | remove_output_file(comm_file) | ||
315 | remove_output_file(comm_thread_file) | ||
316 | remove_output_file(dso_file) | ||
317 | remove_output_file(symbol_file) | ||
318 | remove_output_file(branch_type_file) | ||
319 | remove_output_file(sample_file) | ||
320 | if perf_db_export_calls: | ||
321 | remove_output_file(call_path_file) | ||
322 | remove_output_file(call_file) | ||
323 | os.rmdir(output_dir_name) | ||
324 | print datetime.datetime.today(), "Adding primary keys" | ||
325 | do_query(query, 'ALTER TABLE selected_events ADD PRIMARY KEY (id)') | ||
326 | do_query(query, 'ALTER TABLE machines ADD PRIMARY KEY (id)') | ||
327 | do_query(query, 'ALTER TABLE threads ADD PRIMARY KEY (id)') | ||
328 | do_query(query, 'ALTER TABLE comms ADD PRIMARY KEY (id)') | ||
329 | do_query(query, 'ALTER TABLE comm_threads ADD PRIMARY KEY (id)') | ||
330 | do_query(query, 'ALTER TABLE dsos ADD PRIMARY KEY (id)') | ||
331 | do_query(query, 'ALTER TABLE symbols ADD PRIMARY KEY (id)') | ||
332 | do_query(query, 'ALTER TABLE branch_types ADD PRIMARY KEY (id)') | ||
333 | do_query(query, 'ALTER TABLE samples ADD PRIMARY KEY (id)') | ||
334 | if perf_db_export_calls: | ||
335 | do_query(query, 'ALTER TABLE call_paths ADD PRIMARY KEY (id)') | ||
336 | do_query(query, 'ALTER TABLE calls ADD PRIMARY KEY (id)') | ||
337 | |||
338 | print datetime.datetime.today(), "Adding foreign keys" | ||
339 | do_query(query, 'ALTER TABLE threads ' | ||
340 | 'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id),' | ||
341 | 'ADD CONSTRAINT processfk FOREIGN KEY (process_id) REFERENCES threads (id)') | ||
342 | do_query(query, 'ALTER TABLE comm_threads ' | ||
343 | 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),' | ||
344 | 'ADD CONSTRAINT threadfk FOREIGN KEY (thread_id) REFERENCES threads (id)') | ||
345 | do_query(query, 'ALTER TABLE dsos ' | ||
346 | 'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id)') | ||
347 | do_query(query, 'ALTER TABLE symbols ' | ||
348 | 'ADD CONSTRAINT dsofk FOREIGN KEY (dso_id) REFERENCES dsos (id)') | ||
349 | do_query(query, 'ALTER TABLE samples ' | ||
350 | 'ADD CONSTRAINT evselfk FOREIGN KEY (evsel_id) REFERENCES selected_events (id),' | ||
351 | 'ADD CONSTRAINT machinefk FOREIGN KEY (machine_id) REFERENCES machines (id),' | ||
352 | 'ADD CONSTRAINT threadfk FOREIGN KEY (thread_id) REFERENCES threads (id),' | ||
353 | 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),' | ||
354 | 'ADD CONSTRAINT dsofk FOREIGN KEY (dso_id) REFERENCES dsos (id),' | ||
355 | 'ADD CONSTRAINT symbolfk FOREIGN KEY (symbol_id) REFERENCES symbols (id),' | ||
356 | 'ADD CONSTRAINT todsofk FOREIGN KEY (to_dso_id) REFERENCES dsos (id),' | ||
357 | 'ADD CONSTRAINT tosymbolfk FOREIGN KEY (to_symbol_id) REFERENCES symbols (id)') | ||
358 | if perf_db_export_calls: | ||
359 | do_query(query, 'ALTER TABLE call_paths ' | ||
360 | 'ADD CONSTRAINT parentfk FOREIGN KEY (parent_id) REFERENCES call_paths (id),' | ||
361 | 'ADD CONSTRAINT symbolfk FOREIGN KEY (symbol_id) REFERENCES symbols (id)') | ||
362 | do_query(query, 'ALTER TABLE calls ' | ||
363 | 'ADD CONSTRAINT threadfk FOREIGN KEY (thread_id) REFERENCES threads (id),' | ||
364 | 'ADD CONSTRAINT commfk FOREIGN KEY (comm_id) REFERENCES comms (id),' | ||
365 | 'ADD CONSTRAINT call_pathfk FOREIGN KEY (call_path_id) REFERENCES call_paths (id),' | ||
366 | 'ADD CONSTRAINT callfk FOREIGN KEY (call_id) REFERENCES samples (id),' | ||
367 | 'ADD CONSTRAINT returnfk FOREIGN KEY (return_id) REFERENCES samples (id),' | ||
368 | 'ADD CONSTRAINT parent_call_pathfk FOREIGN KEY (parent_call_path_id) REFERENCES call_paths (id)') | ||
369 | do_query(query, 'CREATE INDEX pcpid_idx ON calls (parent_call_path_id)') | ||
370 | |||
371 | if (unhandled_count): | ||
372 | print datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events" | ||
373 | print datetime.datetime.today(), "Done" | ||
374 | |||
375 | def trace_unhandled(event_name, context, event_fields_dict): | ||
376 | global unhandled_count | ||
377 | unhandled_count += 1 | ||
378 | |||
379 | def sched__sched_switch(*x): | ||
380 | pass | ||
381 | |||
382 | def evsel_table(evsel_id, evsel_name, *x): | ||
383 | n = len(evsel_name) | ||
384 | fmt = "!hiqi" + str(n) + "s" | ||
385 | value = struct.pack(fmt, 2, 8, evsel_id, n, evsel_name) | ||
386 | evsel_file.write(value) | ||
387 | |||
388 | def machine_table(machine_id, pid, root_dir, *x): | ||
389 | n = len(root_dir) | ||
390 | fmt = "!hiqiii" + str(n) + "s" | ||
391 | value = struct.pack(fmt, 3, 8, machine_id, 4, pid, n, root_dir) | ||
392 | machine_file.write(value) | ||
393 | |||
394 | def thread_table(thread_id, machine_id, process_id, pid, tid, *x): | ||
395 | value = struct.pack("!hiqiqiqiiii", 5, 8, thread_id, 8, machine_id, 8, process_id, 4, pid, 4, tid) | ||
396 | thread_file.write(value) | ||
397 | |||
398 | def comm_table(comm_id, comm_str, *x): | ||
399 | n = len(comm_str) | ||
400 | fmt = "!hiqi" + str(n) + "s" | ||
401 | value = struct.pack(fmt, 2, 8, comm_id, n, comm_str) | ||
402 | comm_file.write(value) | ||
403 | |||
404 | def comm_thread_table(comm_thread_id, comm_id, thread_id, *x): | ||
405 | fmt = "!hiqiqiq" | ||
406 | value = struct.pack(fmt, 3, 8, comm_thread_id, 8, comm_id, 8, thread_id) | ||
407 | comm_thread_file.write(value) | ||
408 | |||
409 | def dso_table(dso_id, machine_id, short_name, long_name, build_id, *x): | ||
410 | n1 = len(short_name) | ||
411 | n2 = len(long_name) | ||
412 | n3 = len(build_id) | ||
413 | fmt = "!hiqiqi" + str(n1) + "si" + str(n2) + "si" + str(n3) + "s" | ||
414 | value = struct.pack(fmt, 5, 8, dso_id, 8, machine_id, n1, short_name, n2, long_name, n3, build_id) | ||
415 | dso_file.write(value) | ||
416 | |||
417 | def symbol_table(symbol_id, dso_id, sym_start, sym_end, binding, symbol_name, *x): | ||
418 | n = len(symbol_name) | ||
419 | fmt = "!hiqiqiqiqiii" + str(n) + "s" | ||
420 | value = struct.pack(fmt, 6, 8, symbol_id, 8, dso_id, 8, sym_start, 8, sym_end, 4, binding, n, symbol_name) | ||
421 | symbol_file.write(value) | ||
422 | |||
423 | def branch_type_table(branch_type, name, *x): | ||
424 | n = len(name) | ||
425 | fmt = "!hiii" + str(n) + "s" | ||
426 | value = struct.pack(fmt, 2, 4, branch_type, n, name) | ||
427 | branch_type_file.write(value) | ||
428 | |||
429 | def sample_table(sample_id, evsel_id, machine_id, thread_id, comm_id, dso_id, symbol_id, sym_offset, ip, time, cpu, to_dso_id, to_symbol_id, to_sym_offset, to_ip, period, weight, transaction, data_src, branch_type, in_tx, *x): | ||
430 | if branches: | ||
431 | value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiiiB", 17, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 4, branch_type, 1, in_tx) | ||
432 | else: | ||
433 | value = struct.pack("!hiqiqiqiqiqiqiqiqiqiqiiiqiqiqiqiqiqiqiqiiiB", 21, 8, sample_id, 8, evsel_id, 8, machine_id, 8, thread_id, 8, comm_id, 8, dso_id, 8, symbol_id, 8, sym_offset, 8, ip, 8, time, 4, cpu, 8, to_dso_id, 8, to_symbol_id, 8, to_sym_offset, 8, to_ip, 8, period, 8, weight, 8, transaction, 8, data_src, 4, branch_type, 1, in_tx) | ||
434 | sample_file.write(value) | ||
435 | |||
436 | def call_path_table(cp_id, parent_id, symbol_id, ip, *x): | ||
437 | fmt = "!hiqiqiqiq" | ||
438 | value = struct.pack(fmt, 4, 8, cp_id, 8, parent_id, 8, symbol_id, 8, ip) | ||
439 | call_path_file.write(value) | ||
440 | |||
441 | def call_return_table(cr_id, thread_id, comm_id, call_path_id, call_time, return_time, branch_count, call_id, return_id, parent_call_path_id, flags, *x): | ||
442 | fmt = "!hiqiqiqiqiqiqiqiqiqiqii" | ||
443 | value = struct.pack(fmt, 11, 8, cr_id, 8, thread_id, 8, comm_id, 8, call_path_id, 8, call_time, 8, return_time, 8, branch_count, 8, call_id, 8, return_id, 8, parent_call_path_id, 4, flags) | ||
444 | call_file.write(value) | ||
diff --git a/tools/perf/scripts/python/failed-syscalls-by-pid.py b/tools/perf/scripts/python/failed-syscalls-by-pid.py index 85805fac4116..cafeff3d74db 100644 --- a/tools/perf/scripts/python/failed-syscalls-by-pid.py +++ b/tools/perf/scripts/python/failed-syscalls-by-pid.py | |||
@@ -39,7 +39,7 @@ def trace_end(): | |||
39 | 39 | ||
40 | def raw_syscalls__sys_exit(event_name, context, common_cpu, | 40 | def raw_syscalls__sys_exit(event_name, context, common_cpu, |
41 | common_secs, common_nsecs, common_pid, common_comm, | 41 | common_secs, common_nsecs, common_pid, common_comm, |
42 | id, ret): | 42 | common_callchain, id, ret): |
43 | if (for_comm and common_comm != for_comm) or \ | 43 | if (for_comm and common_comm != for_comm) or \ |
44 | (for_pid and common_pid != for_pid ): | 44 | (for_pid and common_pid != for_pid ): |
45 | return | 45 | return |
@@ -50,6 +50,11 @@ def raw_syscalls__sys_exit(event_name, context, common_cpu, | |||
50 | except TypeError: | 50 | except TypeError: |
51 | syscalls[common_comm][common_pid][id][ret] = 1 | 51 | syscalls[common_comm][common_pid][id][ret] = 1 |
52 | 52 | ||
53 | def syscalls__sys_exit(event_name, context, common_cpu, | ||
54 | common_secs, common_nsecs, common_pid, common_comm, | ||
55 | id, ret): | ||
56 | raw_syscalls__sys_exit(**locals()) | ||
57 | |||
53 | def print_error_totals(): | 58 | def print_error_totals(): |
54 | if for_comm is not None: | 59 | if for_comm is not None: |
55 | print "\nsyscall errors for %s:\n\n" % (for_comm), | 60 | print "\nsyscall errors for %s:\n\n" % (for_comm), |
diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py index 11e70a388d41..0f5cf437b602 100644 --- a/tools/perf/scripts/python/futex-contention.py +++ b/tools/perf/scripts/python/futex-contention.py | |||
@@ -21,7 +21,7 @@ thread_blocktime = {} | |||
21 | lock_waits = {} # long-lived stats on (tid,lock) blockage elapsed time | 21 | lock_waits = {} # long-lived stats on (tid,lock) blockage elapsed time |
22 | process_names = {} # long-lived pid-to-execname mapping | 22 | process_names = {} # long-lived pid-to-execname mapping |
23 | 23 | ||
24 | def syscalls__sys_enter_futex(event, ctxt, cpu, s, ns, tid, comm, | 24 | def syscalls__sys_enter_futex(event, ctxt, cpu, s, ns, tid, comm, callchain, |
25 | nr, uaddr, op, val, utime, uaddr2, val3): | 25 | nr, uaddr, op, val, utime, uaddr2, val3): |
26 | cmd = op & FUTEX_CMD_MASK | 26 | cmd = op & FUTEX_CMD_MASK |
27 | if cmd != FUTEX_WAIT: | 27 | if cmd != FUTEX_WAIT: |
@@ -31,7 +31,7 @@ def syscalls__sys_enter_futex(event, ctxt, cpu, s, ns, tid, comm, | |||
31 | thread_thislock[tid] = uaddr | 31 | thread_thislock[tid] = uaddr |
32 | thread_blocktime[tid] = nsecs(s, ns) | 32 | thread_blocktime[tid] = nsecs(s, ns) |
33 | 33 | ||
34 | def syscalls__sys_exit_futex(event, ctxt, cpu, s, ns, tid, comm, | 34 | def syscalls__sys_exit_futex(event, ctxt, cpu, s, ns, tid, comm, callchain, |
35 | nr, ret): | 35 | nr, ret): |
36 | if thread_blocktime.has_key(tid): | 36 | if thread_blocktime.has_key(tid): |
37 | elapsed = nsecs(s, ns) - thread_blocktime[tid] | 37 | elapsed = nsecs(s, ns) - thread_blocktime[tid] |
diff --git a/tools/perf/scripts/python/net_dropmonitor.py b/tools/perf/scripts/python/net_dropmonitor.py index b5740599aabd..0b6ce8c253e8 100755 --- a/tools/perf/scripts/python/net_dropmonitor.py +++ b/tools/perf/scripts/python/net_dropmonitor.py | |||
@@ -66,7 +66,7 @@ def trace_end(): | |||
66 | print_drop_table() | 66 | print_drop_table() |
67 | 67 | ||
68 | # called from perf, when it finds a correspoinding event | 68 | # called from perf, when it finds a correspoinding event |
69 | def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, | 69 | def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, callchain, |
70 | skbaddr, location, protocol): | 70 | skbaddr, location, protocol): |
71 | slocation = str(location) | 71 | slocation = str(location) |
72 | try: | 72 | try: |
diff --git a/tools/perf/scripts/python/netdev-times.py b/tools/perf/scripts/python/netdev-times.py index 9aa0a32972e8..4d21ef2d601d 100644 --- a/tools/perf/scripts/python/netdev-times.py +++ b/tools/perf/scripts/python/netdev-times.py | |||
@@ -224,75 +224,75 @@ def trace_end(): | |||
224 | (len(rx_skb_list), of_count_rx_skb_list) | 224 | (len(rx_skb_list), of_count_rx_skb_list) |
225 | 225 | ||
226 | # called from perf, when it finds a correspoinding event | 226 | # called from perf, when it finds a correspoinding event |
227 | def irq__softirq_entry(name, context, cpu, sec, nsec, pid, comm, vec): | 227 | def irq__softirq_entry(name, context, cpu, sec, nsec, pid, comm, callchain, vec): |
228 | if symbol_str("irq__softirq_entry", "vec", vec) != "NET_RX": | 228 | if symbol_str("irq__softirq_entry", "vec", vec) != "NET_RX": |
229 | return | 229 | return |
230 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, vec) | 230 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, vec) |
231 | all_event_list.append(event_info) | 231 | all_event_list.append(event_info) |
232 | 232 | ||
233 | def irq__softirq_exit(name, context, cpu, sec, nsec, pid, comm, vec): | 233 | def irq__softirq_exit(name, context, cpu, sec, nsec, pid, comm, callchain, vec): |
234 | if symbol_str("irq__softirq_entry", "vec", vec) != "NET_RX": | 234 | if symbol_str("irq__softirq_entry", "vec", vec) != "NET_RX": |
235 | return | 235 | return |
236 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, vec) | 236 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, vec) |
237 | all_event_list.append(event_info) | 237 | all_event_list.append(event_info) |
238 | 238 | ||
239 | def irq__softirq_raise(name, context, cpu, sec, nsec, pid, comm, vec): | 239 | def irq__softirq_raise(name, context, cpu, sec, nsec, pid, comm, callchain, vec): |
240 | if symbol_str("irq__softirq_entry", "vec", vec) != "NET_RX": | 240 | if symbol_str("irq__softirq_entry", "vec", vec) != "NET_RX": |
241 | return | 241 | return |
242 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, vec) | 242 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, vec) |
243 | all_event_list.append(event_info) | 243 | all_event_list.append(event_info) |
244 | 244 | ||
245 | def irq__irq_handler_entry(name, context, cpu, sec, nsec, pid, comm, | 245 | def irq__irq_handler_entry(name, context, cpu, sec, nsec, pid, comm, |
246 | irq, irq_name): | 246 | callchain, irq, irq_name): |
247 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 247 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
248 | irq, irq_name) | 248 | irq, irq_name) |
249 | all_event_list.append(event_info) | 249 | all_event_list.append(event_info) |
250 | 250 | ||
251 | def irq__irq_handler_exit(name, context, cpu, sec, nsec, pid, comm, irq, ret): | 251 | def irq__irq_handler_exit(name, context, cpu, sec, nsec, pid, comm, callchain, irq, ret): |
252 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, irq, ret) | 252 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, irq, ret) |
253 | all_event_list.append(event_info) | 253 | all_event_list.append(event_info) |
254 | 254 | ||
255 | def napi__napi_poll(name, context, cpu, sec, nsec, pid, comm, napi, dev_name): | 255 | def napi__napi_poll(name, context, cpu, sec, nsec, pid, comm, callchain, napi, dev_name): |
256 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 256 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
257 | napi, dev_name) | 257 | napi, dev_name) |
258 | all_event_list.append(event_info) | 258 | all_event_list.append(event_info) |
259 | 259 | ||
260 | def net__netif_receive_skb(name, context, cpu, sec, nsec, pid, comm, skbaddr, | 260 | def net__netif_receive_skb(name, context, cpu, sec, nsec, pid, comm, callchain, skbaddr, |
261 | skblen, dev_name): | 261 | skblen, dev_name): |
262 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 262 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
263 | skbaddr, skblen, dev_name) | 263 | skbaddr, skblen, dev_name) |
264 | all_event_list.append(event_info) | 264 | all_event_list.append(event_info) |
265 | 265 | ||
266 | def net__netif_rx(name, context, cpu, sec, nsec, pid, comm, skbaddr, | 266 | def net__netif_rx(name, context, cpu, sec, nsec, pid, comm, callchain, skbaddr, |
267 | skblen, dev_name): | 267 | skblen, dev_name): |
268 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 268 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
269 | skbaddr, skblen, dev_name) | 269 | skbaddr, skblen, dev_name) |
270 | all_event_list.append(event_info) | 270 | all_event_list.append(event_info) |
271 | 271 | ||
272 | def net__net_dev_queue(name, context, cpu, sec, nsec, pid, comm, | 272 | def net__net_dev_queue(name, context, cpu, sec, nsec, pid, comm, callchain, |
273 | skbaddr, skblen, dev_name): | 273 | skbaddr, skblen, dev_name): |
274 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 274 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
275 | skbaddr, skblen, dev_name) | 275 | skbaddr, skblen, dev_name) |
276 | all_event_list.append(event_info) | 276 | all_event_list.append(event_info) |
277 | 277 | ||
278 | def net__net_dev_xmit(name, context, cpu, sec, nsec, pid, comm, | 278 | def net__net_dev_xmit(name, context, cpu, sec, nsec, pid, comm, callchain, |
279 | skbaddr, skblen, rc, dev_name): | 279 | skbaddr, skblen, rc, dev_name): |
280 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 280 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
281 | skbaddr, skblen, rc ,dev_name) | 281 | skbaddr, skblen, rc ,dev_name) |
282 | all_event_list.append(event_info) | 282 | all_event_list.append(event_info) |
283 | 283 | ||
284 | def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, | 284 | def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, callchain, |
285 | skbaddr, protocol, location): | 285 | skbaddr, protocol, location): |
286 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 286 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
287 | skbaddr, protocol, location) | 287 | skbaddr, protocol, location) |
288 | all_event_list.append(event_info) | 288 | all_event_list.append(event_info) |
289 | 289 | ||
290 | def skb__consume_skb(name, context, cpu, sec, nsec, pid, comm, skbaddr): | 290 | def skb__consume_skb(name, context, cpu, sec, nsec, pid, comm, callchain, skbaddr): |
291 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 291 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
292 | skbaddr) | 292 | skbaddr) |
293 | all_event_list.append(event_info) | 293 | all_event_list.append(event_info) |
294 | 294 | ||
295 | def skb__skb_copy_datagram_iovec(name, context, cpu, sec, nsec, pid, comm, | 295 | def skb__skb_copy_datagram_iovec(name, context, cpu, sec, nsec, pid, comm, callchain, |
296 | skbaddr, skblen): | 296 | skbaddr, skblen): |
297 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, | 297 | event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, |
298 | skbaddr, skblen) | 298 | skbaddr, skblen) |
diff --git a/tools/perf/scripts/python/sched-migration.py b/tools/perf/scripts/python/sched-migration.py index 74d55ec08aed..de66cb3b72c9 100644 --- a/tools/perf/scripts/python/sched-migration.py +++ b/tools/perf/scripts/python/sched-migration.py | |||
@@ -369,93 +369,92 @@ def trace_end(): | |||
369 | 369 | ||
370 | def sched__sched_stat_runtime(event_name, context, common_cpu, | 370 | def sched__sched_stat_runtime(event_name, context, common_cpu, |
371 | common_secs, common_nsecs, common_pid, common_comm, | 371 | common_secs, common_nsecs, common_pid, common_comm, |
372 | comm, pid, runtime, vruntime): | 372 | common_callchain, comm, pid, runtime, vruntime): |
373 | pass | 373 | pass |
374 | 374 | ||
375 | def sched__sched_stat_iowait(event_name, context, common_cpu, | 375 | def sched__sched_stat_iowait(event_name, context, common_cpu, |
376 | common_secs, common_nsecs, common_pid, common_comm, | 376 | common_secs, common_nsecs, common_pid, common_comm, |
377 | comm, pid, delay): | 377 | common_callchain, comm, pid, delay): |
378 | pass | 378 | pass |
379 | 379 | ||
380 | def sched__sched_stat_sleep(event_name, context, common_cpu, | 380 | def sched__sched_stat_sleep(event_name, context, common_cpu, |
381 | common_secs, common_nsecs, common_pid, common_comm, | 381 | common_secs, common_nsecs, common_pid, common_comm, |
382 | comm, pid, delay): | 382 | common_callchain, comm, pid, delay): |
383 | pass | 383 | pass |
384 | 384 | ||
385 | def sched__sched_stat_wait(event_name, context, common_cpu, | 385 | def sched__sched_stat_wait(event_name, context, common_cpu, |
386 | common_secs, common_nsecs, common_pid, common_comm, | 386 | common_secs, common_nsecs, common_pid, common_comm, |
387 | comm, pid, delay): | 387 | common_callchain, comm, pid, delay): |
388 | pass | 388 | pass |
389 | 389 | ||
390 | def sched__sched_process_fork(event_name, context, common_cpu, | 390 | def sched__sched_process_fork(event_name, context, common_cpu, |
391 | common_secs, common_nsecs, common_pid, common_comm, | 391 | common_secs, common_nsecs, common_pid, common_comm, |
392 | parent_comm, parent_pid, child_comm, child_pid): | 392 | common_callchain, parent_comm, parent_pid, child_comm, child_pid): |
393 | pass | 393 | pass |
394 | 394 | ||
395 | def sched__sched_process_wait(event_name, context, common_cpu, | 395 | def sched__sched_process_wait(event_name, context, common_cpu, |
396 | common_secs, common_nsecs, common_pid, common_comm, | 396 | common_secs, common_nsecs, common_pid, common_comm, |
397 | comm, pid, prio): | 397 | common_callchain, comm, pid, prio): |
398 | pass | 398 | pass |
399 | 399 | ||
400 | def sched__sched_process_exit(event_name, context, common_cpu, | 400 | def sched__sched_process_exit(event_name, context, common_cpu, |
401 | common_secs, common_nsecs, common_pid, common_comm, | 401 | common_secs, common_nsecs, common_pid, common_comm, |
402 | comm, pid, prio): | 402 | common_callchain, comm, pid, prio): |
403 | pass | 403 | pass |
404 | 404 | ||
405 | def sched__sched_process_free(event_name, context, common_cpu, | 405 | def sched__sched_process_free(event_name, context, common_cpu, |
406 | common_secs, common_nsecs, common_pid, common_comm, | 406 | common_secs, common_nsecs, common_pid, common_comm, |
407 | comm, pid, prio): | 407 | common_callchain, comm, pid, prio): |
408 | pass | 408 | pass |
409 | 409 | ||
410 | def sched__sched_migrate_task(event_name, context, common_cpu, | 410 | def sched__sched_migrate_task(event_name, context, common_cpu, |
411 | common_secs, common_nsecs, common_pid, common_comm, | 411 | common_secs, common_nsecs, common_pid, common_comm, |
412 | comm, pid, prio, orig_cpu, | 412 | common_callchain, comm, pid, prio, orig_cpu, |
413 | dest_cpu): | 413 | dest_cpu): |
414 | headers = EventHeaders(common_cpu, common_secs, common_nsecs, | 414 | headers = EventHeaders(common_cpu, common_secs, common_nsecs, |
415 | common_pid, common_comm) | 415 | common_pid, common_comm, common_callchain) |
416 | parser.migrate(headers, pid, prio, orig_cpu, dest_cpu) | 416 | parser.migrate(headers, pid, prio, orig_cpu, dest_cpu) |
417 | 417 | ||
418 | def sched__sched_switch(event_name, context, common_cpu, | 418 | def sched__sched_switch(event_name, context, common_cpu, |
419 | common_secs, common_nsecs, common_pid, common_comm, | 419 | common_secs, common_nsecs, common_pid, common_comm, common_callchain, |
420 | prev_comm, prev_pid, prev_prio, prev_state, | 420 | prev_comm, prev_pid, prev_prio, prev_state, |
421 | next_comm, next_pid, next_prio): | 421 | next_comm, next_pid, next_prio): |
422 | 422 | ||
423 | headers = EventHeaders(common_cpu, common_secs, common_nsecs, | 423 | headers = EventHeaders(common_cpu, common_secs, common_nsecs, |
424 | common_pid, common_comm) | 424 | common_pid, common_comm, common_callchain) |
425 | parser.sched_switch(headers, prev_comm, prev_pid, prev_prio, prev_state, | 425 | parser.sched_switch(headers, prev_comm, prev_pid, prev_prio, prev_state, |
426 | next_comm, next_pid, next_prio) | 426 | next_comm, next_pid, next_prio) |
427 | 427 | ||
428 | def sched__sched_wakeup_new(event_name, context, common_cpu, | 428 | def sched__sched_wakeup_new(event_name, context, common_cpu, |
429 | common_secs, common_nsecs, common_pid, common_comm, | 429 | common_secs, common_nsecs, common_pid, common_comm, |
430 | comm, pid, prio, success, | 430 | common_callchain, comm, pid, prio, success, |
431 | target_cpu): | 431 | target_cpu): |
432 | headers = EventHeaders(common_cpu, common_secs, common_nsecs, | 432 | headers = EventHeaders(common_cpu, common_secs, common_nsecs, |
433 | common_pid, common_comm) | 433 | common_pid, common_comm, common_callchain) |
434 | parser.wake_up(headers, comm, pid, success, target_cpu, 1) | 434 | parser.wake_up(headers, comm, pid, success, target_cpu, 1) |
435 | 435 | ||
436 | def sched__sched_wakeup(event_name, context, common_cpu, | 436 | def sched__sched_wakeup(event_name, context, common_cpu, |
437 | common_secs, common_nsecs, common_pid, common_comm, | 437 | common_secs, common_nsecs, common_pid, common_comm, |
438 | comm, pid, prio, success, | 438 | common_callchain, comm, pid, prio, success, |
439 | target_cpu): | 439 | target_cpu): |
440 | headers = EventHeaders(common_cpu, common_secs, common_nsecs, | 440 | headers = EventHeaders(common_cpu, common_secs, common_nsecs, |
441 | common_pid, common_comm) | 441 | common_pid, common_comm, common_callchain) |
442 | parser.wake_up(headers, comm, pid, success, target_cpu, 0) | 442 | parser.wake_up(headers, comm, pid, success, target_cpu, 0) |
443 | 443 | ||
444 | def sched__sched_wait_task(event_name, context, common_cpu, | 444 | def sched__sched_wait_task(event_name, context, common_cpu, |
445 | common_secs, common_nsecs, common_pid, common_comm, | 445 | common_secs, common_nsecs, common_pid, common_comm, |
446 | comm, pid, prio): | 446 | common_callchain, comm, pid, prio): |
447 | pass | 447 | pass |
448 | 448 | ||
449 | def sched__sched_kthread_stop_ret(event_name, context, common_cpu, | 449 | def sched__sched_kthread_stop_ret(event_name, context, common_cpu, |
450 | common_secs, common_nsecs, common_pid, common_comm, | 450 | common_secs, common_nsecs, common_pid, common_comm, |
451 | ret): | 451 | common_callchain, ret): |
452 | pass | 452 | pass |
453 | 453 | ||
454 | def sched__sched_kthread_stop(event_name, context, common_cpu, | 454 | def sched__sched_kthread_stop(event_name, context, common_cpu, |
455 | common_secs, common_nsecs, common_pid, common_comm, | 455 | common_secs, common_nsecs, common_pid, common_comm, |
456 | comm, pid): | 456 | common_callchain, comm, pid): |
457 | pass | 457 | pass |
458 | 458 | ||
459 | def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs, | 459 | def trace_unhandled(event_name, context, event_fields_dict): |
460 | common_pid, common_comm): | ||
461 | pass | 460 | pass |
diff --git a/tools/perf/scripts/python/sctop.py b/tools/perf/scripts/python/sctop.py index 42c267e292fa..61621b93affb 100644 --- a/tools/perf/scripts/python/sctop.py +++ b/tools/perf/scripts/python/sctop.py | |||
@@ -44,7 +44,7 @@ def trace_begin(): | |||
44 | 44 | ||
45 | def raw_syscalls__sys_enter(event_name, context, common_cpu, | 45 | def raw_syscalls__sys_enter(event_name, context, common_cpu, |
46 | common_secs, common_nsecs, common_pid, common_comm, | 46 | common_secs, common_nsecs, common_pid, common_comm, |
47 | id, args): | 47 | common_callchain, id, args): |
48 | if for_comm is not None: | 48 | if for_comm is not None: |
49 | if common_comm != for_comm: | 49 | if common_comm != for_comm: |
50 | return | 50 | return |
@@ -53,6 +53,11 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu, | |||
53 | except TypeError: | 53 | except TypeError: |
54 | syscalls[id] = 1 | 54 | syscalls[id] = 1 |
55 | 55 | ||
56 | def syscalls__sys_enter(event_name, context, common_cpu, | ||
57 | common_secs, common_nsecs, common_pid, common_comm, | ||
58 | id, args): | ||
59 | raw_syscalls__sys_enter(**locals()) | ||
60 | |||
56 | def print_syscall_totals(interval): | 61 | def print_syscall_totals(interval): |
57 | while 1: | 62 | while 1: |
58 | clear_term() | 63 | clear_term() |
diff --git a/tools/perf/scripts/python/syscall-counts-by-pid.py b/tools/perf/scripts/python/syscall-counts-by-pid.py index c64d1c55d745..daf314cc5dd3 100644 --- a/tools/perf/scripts/python/syscall-counts-by-pid.py +++ b/tools/perf/scripts/python/syscall-counts-by-pid.py | |||
@@ -38,7 +38,7 @@ def trace_end(): | |||
38 | 38 | ||
39 | def raw_syscalls__sys_enter(event_name, context, common_cpu, | 39 | def raw_syscalls__sys_enter(event_name, context, common_cpu, |
40 | common_secs, common_nsecs, common_pid, common_comm, | 40 | common_secs, common_nsecs, common_pid, common_comm, |
41 | id, args): | 41 | common_callchain, id, args): |
42 | 42 | ||
43 | if (for_comm and common_comm != for_comm) or \ | 43 | if (for_comm and common_comm != for_comm) or \ |
44 | (for_pid and common_pid != for_pid ): | 44 | (for_pid and common_pid != for_pid ): |
@@ -48,6 +48,11 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu, | |||
48 | except TypeError: | 48 | except TypeError: |
49 | syscalls[common_comm][common_pid][id] = 1 | 49 | syscalls[common_comm][common_pid][id] = 1 |
50 | 50 | ||
51 | def syscalls__sys_enter(event_name, context, common_cpu, | ||
52 | common_secs, common_nsecs, common_pid, common_comm, | ||
53 | id, args): | ||
54 | raw_syscalls__sys_enter(**locals()) | ||
55 | |||
51 | def print_syscall_totals(): | 56 | def print_syscall_totals(): |
52 | if for_comm is not None: | 57 | if for_comm is not None: |
53 | print "\nsyscall events for %s:\n\n" % (for_comm), | 58 | print "\nsyscall events for %s:\n\n" % (for_comm), |
diff --git a/tools/perf/scripts/python/syscall-counts.py b/tools/perf/scripts/python/syscall-counts.py index b435d3f188e8..e66a7730aeb5 100644 --- a/tools/perf/scripts/python/syscall-counts.py +++ b/tools/perf/scripts/python/syscall-counts.py | |||
@@ -35,7 +35,7 @@ def trace_end(): | |||
35 | 35 | ||
36 | def raw_syscalls__sys_enter(event_name, context, common_cpu, | 36 | def raw_syscalls__sys_enter(event_name, context, common_cpu, |
37 | common_secs, common_nsecs, common_pid, common_comm, | 37 | common_secs, common_nsecs, common_pid, common_comm, |
38 | id, args): | 38 | common_callchain, id, args): |
39 | if for_comm is not None: | 39 | if for_comm is not None: |
40 | if common_comm != for_comm: | 40 | if common_comm != for_comm: |
41 | return | 41 | return |
@@ -44,6 +44,11 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu, | |||
44 | except TypeError: | 44 | except TypeError: |
45 | syscalls[id] = 1 | 45 | syscalls[id] = 1 |
46 | 46 | ||
47 | def syscalls__sys_enter(event_name, context, common_cpu, | ||
48 | common_secs, common_nsecs, common_pid, common_comm, | ||
49 | id, args): | ||
50 | raw_syscalls__sys_enter(**locals()) | ||
51 | |||
47 | def print_syscall_totals(): | 52 | def print_syscall_totals(): |
48 | if for_comm is not None: | 53 | if for_comm is not None: |
49 | print "\nsyscall events for %s:\n\n" % (for_comm), | 54 | print "\nsyscall events for %s:\n\n" % (for_comm), |