aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/syscall-counts.py
blob: 8adb95ff16641af505836a90a6edb7d46fe58c7f (plain) (blame)
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
# system call counts
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# 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
import 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.py [comm]\n";

for_comm = None

if len(sys.argv) > 2:
	sys.exit(usage)

if len(sys.argv) > 1:
	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 is not None:
		if common_comm != for_comm:
			return
	try:
		syscalls[id] += 1
	except TypeError:
		syscalls[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:\n")

	print("%-40s  %10s" % ("event", "count"))
	print("%-40s  %10s" % ("----------------------------------------",
				"-----------"))

	for id, val in sorted(syscalls.items(),
			key = lambda kv: (kv[1], kv[0]), reverse = True):
		print("%-40s  %10d" % (syscall_name(id), val))
b634b479abeeae58e08c03db4293f47078ff87d&follow=1'>drm/panel: rm67191: Remove CLOCK_NON_CONTINUOUS flagRobert Chiras1-2/+1 2020-08-29drm/panel: simple: Add AM-1280800N3TZQW-T00HJagan Teki1-0/+29 2020-08-29dt-bindings: display: simple: Add AM-1280800N3TZQW-T00HJagan Teki1-0/+2 2020-08-27drm/sun4i: lvds: Invert the LVDS polarityMaxime Ripard1-3/+1 2020-08-27drm/mgag200: fix spelling mistake "expeced" -> "expected"Colin Ian King1-1/+1 2020-08-26drm/bridge: ps8640: Print an error if VDO control failsEnric Balletbo i Serra1-7/+6 2020-08-26drm/bridge: ps8640: Return an error for incorrect attach flagsEnric Balletbo i Serra1-0/+4 2020-08-26drm/bridge: ps8640: Get the EDID from eDP controlEnric Balletbo i Serra1-0/+12 2020-08-26drm/bridge_connector: Set default status connected for eDP connectorsEnric Balletbo i Serra1-0/+1 2020-08-25drm/hisilicon: Use drm_err instead of DRM_ERROR in hibmc_drm_drvTian Tao1-12/+12 2020-08-25drm/hisilicon: Use drm_err instead of DRM_ERROR in hibmc_drm_deTian Tao1-7/+7 2020-08-25drm/hisilicon: Use drm_err instead of DRM_ERROR in hibmc_drm_vdacTian Tao1-2/+2 2020-08-25drm/hisilicon: Use drm_err instead of DRM_ERROR in hibmc_ttmTian Tao1-1/+1 2020-08-24drm/ttm: drop bus.size from bus placement.Dave Airlie4-9/+10 2020-08-24drm/ttm: init mem->bus in common code.Dave Airlie7-36/+5 2020-08-23drm/brige/megachips: Add checking if ge_b850v3_lvds_init() is working correctlyNadezda Lutovinova1-2/+10 2020-08-23drm/bridge/tc358775: Fix for PTR_ERRVinay Simha BN1-1/+1 2020-08-21drm: panel: simple: Add KD116N21-30NV-A010Douglas Anderson1-0/+31 2020-08-21dt-bindings: display: simple: Add KD116N21-30NV-A010 compatibleDouglas Anderson1-0/+2 2020-08-21drm/tidss: implement WA for AM65xx erratum i2000Tomi Valkeinen2-4/+32 2020-08-21drm/omap: fix spelling mistake "propert" -> "property"Colin Ian King1-1/+1 2020-08-21drm: omapdrm: Delete surplus GPIO includesLinus Walleij2-2/+0 2020-08-20drm/panel: novatek,nt39016: Remove 'dev' field in priv structPaul Cercueil1-6/+4 2020-08-20drm/panel: novatek,nt39016: Reorder calls in probePaul Cercueil1-3/+3 2020-08-20drm/ttm: fix broken merge between drm-next and drm-misc-nextChristian König2-2/+4 2020-08-19drm/gma500: fix error checkTom Rix1-1/+1 2020-08-19drm: gma500: Convert to GPIO descriptorsLinus Walleij6-29/+49 2020-08-19drm: ast: fix double __iomem sparse warningRandy Dunlap1-1/+2 2020-08-19virtio: fix build for configs without dma-bufsDavid Stevens4-1/+13 2020-08-18drm/panel: Use dev_ based loggingSam Ravnborg15-345/+200 2020-08-18drm/panel: sitronix: Use dev_ based loggingSam Ravnborg2-44/+27 2020-08-18drm/panel: raydium: Use dev_ based loggingSam Ravnborg2-28/+23 2020-08-18drm/panel: leadtek: Use dev_ based loggingSam Ravnborg2-70/+37 2020-08-18drm/panel: samsung: Use dev_ based loggingSam Ravnborg6-36/+21 2020-08-18drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panelGuido Günther4-0/+347