aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/syscall-counts.py
blob: b435d3f188e84c421819802cb2efcefd62cff0d2 (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
# 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.

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,
	id, args):
	if for_comm is not None:
		if common_comm != for_comm:
			return
	try:
		syscalls[id] += 1
	except TypeError:
		syscalls[id] = 1

def print_syscall_totals():
    if for_comm is not None:
	    print "\nsyscall events for %s:\n\n" % (for_comm),
    else:
	    print "\nsyscall events:\n\n",

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

    for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
				  reverse = True):
	    print "%-40s  %10d\n" % (syscall_name(id), val),
cetree/bindings/regulator/rohm,bd71847-regulator.yaml?id=2bdfd4fbcb857344939071b5883a7ff088ce16f6&follow=1'>dt-bindings: Fix erroneous 'additionalProperties'Rob Herring6-7/+17 2020-04-24dt-bindings: Fix command line length limit calling dt-mk-schemaRob Herring1-8/+10 2020-04-22dt-bindings: Re-enable core schemas for dtbs_checkRob Herring1-1/+2 2020-04-20dt-bindings: Add an entry for Würth Elektronik, weSaravanan Sekar1-0/+2 2020-04-20dt-bindings: mailbox: imx-mu: correct examplePeng Fan1-1/+1 2020-04-20dt-bindings: MIPS: Require SoC compatible string after board stringPaul Cercueil1-0/+4 2020-04-20dt-bindings: usb: ingenic,musb: Add usb-role-switch propertyPaul Cercueil1-0/+3 2020-04-20dt-bindings: dma: Convert jz4740-dma doc to YAMLPaul Cercueil2-64/+80 2020-04-20dt-bindings: mmc: Convert jz4740-mmc doc to YAMLPaul Cercueil2-41/+79 2020-04-20dt-bindings: timer: Convert ingenic,tcu.txt to YAMLPaul Cercueil2-138/+281 2020-04-20dt-bindings: nvmem: Convert rockchip-efuse bindings to yamlRicardo Cañuelo2-54/+70 2020-04-20dt-bindings: gpu: mali-utgard: Add the #cooling-cells propertyMartin Blumenstingl1-0/+4 2020-04-20dt-bindings: sram: convert rockchip-pmu-sram bindings to yamlJohan Jonker2-19/+23 2020-04-20of: fix the warnings from command line.tangjianqiang1-1/+1 2020-04-17kbuild: check libyaml installation for 'make dt_binding_check'Masahiro Yamada1-1/+1 2020-04-17of: unittest: kmemleak in duplicate property updateFrank Rowand2-10/+25 2020-04-17of: overlay: kmemleak in dup_and_fixup_symbol_prop()Frank Rowand1-0/+2 2020-04-17of: unittest: kmemleak in of_unittest_overlay_high_level()Frank Rowand1-1/+4 2020-04-17of: unittest: kmemleak in of_unittest_platform_populate()Frank Rowand1-2/+5 2020-04-17of: unittest: kmemleak on changeset destroyFrank Rowand1-0/+4 2020-04-17MAINTAINERS: dt: fix pointers for ARM Integrator, Versatile and RealViewMauro Carvalho Chehab1-1/+4 2020-04-17MAINTAINERS: dt: update display/allwinner file entryMauro Carvalho Chehab1-1/+1 2020-04-17dt-bindings: iio: dac: AD5570R fix bindings errorsAlexandru Tachici1-49/+44 2020-04-16dt-bindings: Clean-up schema indentation formattingRob Herring77-450/+450 2020-04-16dt-bindings: input: Convert gpio-keys bindings to schemaRob Herring3-103/+152 2020-04-16dt-bindings: Fix misspellings of "Analog Devices"Geert Uytterhoeven4-6/+6 2020-04-15dt-bindings: pwm: Fix cros-ec-pwm example dtc 'reg' warningRob Herring1-5/+12