diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-24 14:16:27 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-24 14:16:27 -0400 |
| commit | 49ef015632ab3fcc19b2cb37b199d6d7ebcfa5f8 (patch) | |
| tree | 576fad1d27341e9f16e62df9175fcb2615ad4975 /tools/perf/scripts/python/export-to-sqlite.py | |
| parent | 19caf581ba441659f1a71e9a5baed032fdcfceef (diff) | |
| parent | d8b5297f6d985d785b2d2869102933e81ca51c80 (diff) | |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Thomas Gleixner:
"A larger set of perf updates.
Not all of them are strictly fixes, but that's solely the tip
maintainers fault as they let the timely -rc1 pull request fall
through the cracks for various reasons including travel. So I'm
sending this nevertheless because rebasing and distangling fixes and
updates would be a mess and risky as well. As of tomorrow, a strict
fixes separation is happening again. Sorry for the slip-up.
Kernel:
- Handle RECORD_MMAP vs. RECORD_MMAP2 correctly so different
consumers of the mmap event get what they requested.
Tools:
- A larger set of updates to perf record/report/scripts vs. time
stamp handling
- More Python3 fixups
- A pile of memory leak plumbing
- perf BPF improvements and fixes
- Finalize the perf.data directory storage"
[ Note: the kernel part is strictly a fix, the updates are purely to
tooling - Linus ]
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (75 commits)
perf bpf: Show more BPF program info in print_bpf_prog_info()
perf bpf: Extract logic to create program names from perf_event__synthesize_one_bpf_prog()
perf tools: Save bpf_prog_info and BTF of new BPF programs
perf evlist: Introduce side band thread
perf annotate: Enable annotation of BPF programs
perf build: Check what binutils's 'disassembler()' signature to use
perf bpf: Process PERF_BPF_EVENT_PROG_LOAD for annotation
perf symbols: Introduce DSO_BINARY_TYPE__BPF_PROG_INFO
perf feature detection: Add -lopcodes to feature-libbfd
perf top: Add option --no-bpf-event
perf bpf: Save BTF information as headers to perf.data
perf bpf: Save BTF in a rbtree in perf_env
perf bpf: Save bpf_prog_info information as headers to perf.data
perf bpf: Save bpf_prog_info in a rbtree in perf_env
perf bpf: Make synthesize_bpf_events() receive perf_session pointer instead of perf_tool
perf bpf: Synthesize bpf events with bpf_program__get_prog_info_linear()
bpftool: use bpf_program__get_prog_info_linear() in prog.c:do_dump()
tools lib bpf: Introduce bpf_program__get_prog_info_linear()
perf record: Replace option --bpf-event with --no-bpf-event
perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test()
...
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
| -rw-r--r-- | tools/perf/scripts/python/export-to-sqlite.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py index eb63e6c7107f..3b71902a5a21 100644 --- a/tools/perf/scripts/python/export-to-sqlite.py +++ b/tools/perf/scripts/python/export-to-sqlite.py | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | 10 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | # more details. | 11 | # more details. |
| 12 | 12 | ||
| 13 | from __future__ import print_function | ||
| 14 | |||
| 13 | import os | 15 | import os |
| 14 | import sys | 16 | import sys |
| 15 | import struct | 17 | import struct |
| @@ -60,11 +62,17 @@ perf_db_export_mode = True | |||
| 60 | perf_db_export_calls = False | 62 | perf_db_export_calls = False |
| 61 | perf_db_export_callchains = False | 63 | perf_db_export_callchains = False |
| 62 | 64 | ||
| 65 | def printerr(*args, **keyword_args): | ||
| 66 | print(*args, file=sys.stderr, **keyword_args) | ||
| 67 | |||
| 68 | def printdate(*args, **kw_args): | ||
| 69 | print(datetime.datetime.today(), *args, sep=' ', **kw_args) | ||
| 70 | |||
| 63 | def usage(): | 71 | def usage(): |
| 64 | print >> sys.stderr, "Usage is: export-to-sqlite.py <database name> [<columns>] [<calls>] [<callchains>]" | 72 | printerr("Usage is: export-to-sqlite.py <database name> [<columns>] [<calls>] [<callchains>]"); |
| 65 | print >> sys.stderr, "where: columns 'all' or 'branches'" | 73 | printerr("where: columns 'all' or 'branches'"); |
| 66 | print >> sys.stderr, " calls 'calls' => create calls and call_paths table" | 74 | printerr(" calls 'calls' => create calls and call_paths table"); |
| 67 | print >> sys.stderr, " callchains 'callchains' => create call_paths table" | 75 | printerr(" callchains 'callchains' => create call_paths table"); |
| 68 | raise Exception("Too few arguments") | 76 | raise Exception("Too few arguments") |
| 69 | 77 | ||
| 70 | if (len(sys.argv) < 2): | 78 | if (len(sys.argv) < 2): |
| @@ -100,7 +108,7 @@ def do_query_(q): | |||
| 100 | return | 108 | return |
| 101 | raise Exception("Query failed: " + q.lastError().text()) | 109 | raise Exception("Query failed: " + q.lastError().text()) |
| 102 | 110 | ||
| 103 | print datetime.datetime.today(), "Creating database..." | 111 | printdate("Creating database ...") |
| 104 | 112 | ||
| 105 | db_exists = False | 113 | db_exists = False |
| 106 | try: | 114 | try: |
| @@ -378,7 +386,7 @@ if perf_db_export_calls: | |||
| 378 | call_query.prepare("INSERT INTO calls VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") | 386 | call_query.prepare("INSERT INTO calls VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") |
| 379 | 387 | ||
| 380 | def trace_begin(): | 388 | def trace_begin(): |
| 381 | print datetime.datetime.today(), "Writing records..." | 389 | printdate("Writing records...") |
| 382 | do_query(query, 'BEGIN TRANSACTION') | 390 | do_query(query, 'BEGIN TRANSACTION') |
| 383 | # id == 0 means unknown. It is easier to create records for them than replace the zeroes with NULLs | 391 | # id == 0 means unknown. It is easier to create records for them than replace the zeroes with NULLs |
| 384 | evsel_table(0, "unknown") | 392 | evsel_table(0, "unknown") |
| @@ -397,14 +405,14 @@ unhandled_count = 0 | |||
| 397 | def trace_end(): | 405 | def trace_end(): |
| 398 | do_query(query, 'END TRANSACTION') | 406 | do_query(query, 'END TRANSACTION') |
| 399 | 407 | ||
| 400 | print datetime.datetime.today(), "Adding indexes" | 408 | printdate("Adding indexes") |
| 401 | if perf_db_export_calls: | 409 | if perf_db_export_calls: |
| 402 | do_query(query, 'CREATE INDEX pcpid_idx ON calls (parent_call_path_id)') | 410 | do_query(query, 'CREATE INDEX pcpid_idx ON calls (parent_call_path_id)') |
| 403 | do_query(query, 'CREATE INDEX pid_idx ON calls (parent_id)') | 411 | do_query(query, 'CREATE INDEX pid_idx ON calls (parent_id)') |
| 404 | 412 | ||
| 405 | if (unhandled_count): | 413 | if (unhandled_count): |
| 406 | print datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events" | 414 | printdate("Warning: ", unhandled_count, " unhandled events") |
| 407 | print datetime.datetime.today(), "Done" | 415 | printdate("Done") |
| 408 | 416 | ||
| 409 | def trace_unhandled(event_name, context, event_fields_dict): | 417 | def trace_unhandled(event_name, context, event_fields_dict): |
| 410 | global unhandled_count | 418 | global unhandled_count |
