summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/syscall-counts.py
blob: e66a7730aeb5de966b25d9f6401188d0db7c305b (plain)
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
# 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,
	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\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),
0'>2018-03-21Docs: Added a pointer to the formatted docs to READMEJonathan Corbet Kernel.org nicely maintains an online copy of the formatted documentation; tell our users that it exists. Signed-off-by: Jonathan Corbet <corbet@lwn.net> 2018-03-21README: Improve documentation descriptionsMartin Kepplinger "This file" indeed was moved once, but at some point "this file", the top-level README, becomes a file in itself. Now that time has come :) Let's describe how things are, and suggest reading "this file" first, "this file" simply being a the admin-guide README file, not a file that was once moved. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net> 2016-10-24README: add a new README file, pointing to the Documentation/Mauro Carvalho Chehab As we moved the real README file to Documentation/admin-guide/README.rst, let's add a replacement, pointing to it, and giving the main directions about documentation. In the future, perhaps it would be worth to move the contents of Documentation/00-Index into this README. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> 2016-10-24docs-rst: create an user's manual bookMauro Carvalho Chehab Place README, REPORTING-BUGS, SecurityBugs and kernel-parameters on an user's manual book. As we'll be numbering the user's manual, remove the manual numbering from SecurityBugs. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> 2016-10-24README: convert it to ReST markupMauro Carvalho Chehab Adjust the readme file for it to use the ReST markup: - add chapter/section markups; - use ``foo`` for commands; - use :: for verbatim and script blocks; - replace unsupported markup _foo_ by **foo**; - add cross-references to other ReST files; - use lower case on the section titles, to match other ReST files. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> 2016-08-14README: Delete obsolete i386 info + update arch/i386/ pathsØyvind A. Holm Support for i386 was removed in v3.8, delete the paragraph that says processor types above 386 won't work on that architecture. It's obsolete information and potentially confusing. Also change a couple of "arch/i386/" paths to one that exists now, using "arch/x86/" instead. Signed-off-by: Øyvind A. Holm <sunny@sunbase.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> 2016-04-15README: remove trailing whitespaceDiego Viola Signed-off-by: Diego Viola <diego.viola@gmail.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> 2016-01-25README: cosmetic fixesDiego Viola Signed-off-by: Diego Viola <diego.viola@gmail.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> 2015-09-18README: Add ARC architectureVineet Gupta ARC support was added back in 2013 but I missed updating here Reported-by: Francois Bedard <fbedard@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> 2015-07-10README: GTK+ is a acronymDiego Viola Signed-off-by: Diego Viola <diego.viola@gmail.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> 2015-03-20README: Change gzip/bzip2 to xz compression formatYaowei Bai Kernel.org is only hosting patches and kernel compressed with xz, so change the old gzip/bzip2 instances to xz. Signed-off-by: Yaowei Bai <bywxiaobai@163.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> 2015-03-20README: Update version number referenceJeff Kirsher When 4.0 is released, the README should reflect the new numbering. Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> 2012-10-28Merge branch 'master' into for-nextJiri Kosina Sync up with Linus' tree to be able to apply Cesar's patch against newer version of the code. Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2012-10-25README: document "make olddefconfig"Kees Cook While "olddefconfig" was documented in "make help", it was not mentioned in the README. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2012-10-08localmodconfig: Document localmodconfig in READMESteven Rostedt Someone (over a year ago :-p) asked me to document localmodconfig in the README file in the source code. I thought it was a good idea but other things were more important and I simply forgot about it. Well, I stumbled on the email asking me about this and I'm sending it out now. Signed-off-by: Steven "Mr. Procrastinator" Rostedt <rostedt@goodmis.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> 2012-04-17README: Remove sporadic tabsMichael Witten Indentation was already done mainly with spaces, so this commit removes the tabs and makes some of the whitespace more consistent. Signed-off-by: Michael Witten <mfwitten@gmail.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2012-04-17README: Consolidate discussions of -stable patchesMichael Witten The nature of the patches for the -stable kernels was discussed twice; this commit consolidates those discussions into one paragraph. Signed-off-by: Michael Witten <mfwitten@gmail.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2012-04-17README: Capitalize start of sentenceMichael Witten Signed-off-by: Michael Witten <mfwitten@gmail.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2012-04-17README: More consistent and readable white spaceMichael Witten Mainly, this just separates paragraphs, so that the text is easier on the eyes. Signed-off-by: Michael Witten <mfwitten@gmail.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2012-04-17README: `Alternately' -> `Alternatively'Michael Witten Also, one `Alternate' was changed to `Alternative' for the sake of consistency. Signed-off-by: Michael Witten <mfwitten@gmail.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2012-04-17README: Better comma usageMichael Witten For the most part, this commit simply introduces commas to offset modifiers. Signed-off-by: Michael Witten <mfwitten@gmail.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2012-04-17README: Grammar: `me has' -> `I have'Michael Witten Signed-off-by: Michael Witten <mfwitten@gmail.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2012-04-17README: Use `X' and `x' consistentlyMichael Witten The text referred to `XX', when only a single `X' actually existed, so this commit changes it to just `X'; a similar change has been made for `xx'. Also, `N' was used when it would have been more consistent to use `X' again, so this commit replaces `N' with `X'. This commit also chooses to leave `X' as the placeholder for the current version of the source, and then makes `x' the placeholder for any version number; fortunately nothing really depends on this subtlety being understood. Because `x' is already being used when discussing version numbers, this commit changes such filename references as `xxx.rej' to `some-file-name.rej'. Signed-off-by: Michael Witten <mfwitten@gmail.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz> 2011-07-01Update version number references in READMEJesper Juhl When 3.0 is released I believe the README should reflect the new numbering. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> 2011-02-23Readme: Add architectureTracey Dent Add Tilera Tile architecture to the list of the architectures that Linux at least runs on. Signed-off-by: Tracey Dent <tdent48227@gmail.com> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> 2010-10-13README: cite nconfigAndrea Gelmini Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz> 2009-06-14README: fix misleading pointer to the defconf directoryPatrick Ringl Signed-off-by: Patrick Ringl <patrick_@freenet.de> Cc: Arnd Bergmann <arnd@arndb.de> 2009-06-09kconfig: add a note about the deps to the 'silentoldconfig' helpMarkus Heidelberg Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> 2009-02-20README: fix a wrong filenameLi Zefan It should be Documentation/build/kconfig.txt. Introduced by commit 2af238e455ef5fd31c2f7a06c2db3f13d843b9bf ("kbuild: make *config usage docs"). Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> 2009-01-02kbuild: make *config usage docsRandy Dunlap Create a kconfig user assistance guide, with a few tips and hints about using menuconfig, xconfig, and gconfig. Mostly contains user interface, environment variables, and search topics, along with mini.config/custom.config usage. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>