# system call counts, by pid # (c) 2010, Tom Zanussi # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. from __future__ import print_function import os, sys sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import * from Core import * from Util import syscall_name usage = "perf script -s syscall-counts-by-pid.py [comm]\n"; for_comm = None for_pid = None if len(sys.argv) > 2: sys.exit(usage) if len(sys.argv) > 1: try: for_pid = int(sys.argv[1]) except: for_comm = sys.argv[1] syscalls = autodict() def trace_begin(): print("Press control+C to stop and show the summary") def trace_end(): print_syscall_totals() def raw_syscalls__sys_enter(event_name, context, common_cpu, common_secs, common_nsecs, common_pid, common_comm, common_callchain, id, args): if (for_comm and common_comm != for_comm) or \ (for_pid and common_pid != for_pid ): return try: syscalls[common_comm][common_pid][id] += 1 except TypeError: syscalls[common_comm][common_pid][id] = 1 def syscalls__sys_enter(event_name, context, common_cpu, common_secs, common_nsecs, common_pid, common_comm, id, args): raw_syscalls__sys_enter(**locals()) def print_syscall_totals(): if for_comm is not None: print("\nsyscall events for %s:\n" % (for_comm)) else: print("\nsyscall events by comm/pid:\n") print("%-40s %10s" % ("comm [pid]/syscalls", "count")) print("%-40s %10s" % ("----------------------------------------", "----------")) comm_keys = syscalls.keys() for comm in comm_keys: pid_keys = syscalls[comm].keys() for pid in pid_keys: print("\n%s [%d]" % (comm, pid)) id_keys = syscalls[comm][pid].keys() for id, val in sorted(syscalls[comm][pid].items(), key = lambda kv: (kv[1], kv[0]), reverse = True): print(" %-38s %10d" % (syscall_name(id), val)) .y'>linux-2.6.30.y Hosts the 0x221E linux distro kernel.Ubuntu
summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/export-to-postgresql.py
AgeCommit message (Expand)Author
2022-02-15perf scripts python: export-to-postgresql.py: Export all sample flagsAdrian Hunter
2020-07-03perf scripts python: export-to-postgresql.py: Fix struct.pack() int argumentAdrian Hunter
2019-07-10perf scripts python: export-to-postgresql.py: Export switch eventsAdrian Hunter
2019-07-10perf scripts python: export-to-postgresql.py: Add has_calls column to comms t...Adrian Hunter
2019-07-10perf scripts python: export-to-postgresql.py: Export comm detailsAdrian Hunter
2019-07-09perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_viewAdrian Hunter
2019-06-25perf scripts python: export-to-postgresql.py: Export Intel PT power and ptwri...Adrian Hunter
2019-06-05perf scripts python: export-to-postgresql.py: Export IPC informationAdrian Hunter
2019-05-28perf scripts python: export-to-postgresql.py: Add support for pyside2Adrian Hunter
2019-03-11perf script python: Add printdate function to SQL exportersTony Jones
2019-03-11perf script python: Add Python3 support to export-to-postgresql.pyTony Jones
2019-03-01perf scripts python: export-to-postgresql.py: Export calls parent_idAdrian Hunter
2019-03-01perf scripts python: export-to-postgresql.py: Fix invalid input syntax for in...Adrian Hunter
2019-02-06perf thread-stack: Represent jmps to the start of a different symbolAdrian Hunter
2018-10-23perf scripts python: call-graph-from-sql.py: Rename to exported-sql-viewer.pyAdrian Hunter
2018-09-25perf script python: Fix export-to-postgresql.py occasional failureAdrian Hunter
2017-08-15perf script python: Rename call-graph-from-postgresql.py to call-graph-from-s...Adrian Hunter
2017-08-15perf scripts python: Fix missing call_path_id in export-to-postgresql scriptAdrian Hunter
2016-05-06perf script: Update export-to-postgresql to support callchain exportChris Phlipot
2016-04-19perf script: Fix postgresql ubuntu install instructionsChris Phlipot
2015-09-28perf tools: Add more documentation to export-to-postgresql.py scriptAdrian Hunter
2015-08-21perf tools: Add example call-graph scriptAdrian Hunter
2014-11-03perf tools: Add call information to Python exportAdrian Hunter
2014-11-03perf tools: Add branch_type and in_tx to Python exportAdrian Hunter
2014-10-29perf script: Add Python script to export to postgresqlAdrian Hunter