Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/urgent

This commit is contained in:
Ingo Molnar 2010-10-26 09:30:22 +02:00
commit 5df414c61e
20 changed files with 106 additions and 40 deletions

View File

@ -15,6 +15,23 @@ DESCRIPTION
This command displays the symbolic event types which can be selected in the
various perf commands with the -e option.
EVENT MODIFIERS
---------------
Events can optionally have a modifer by appending a colon and one or
more modifiers. Modifiers allow the user to restrict when events are
counted with 'u' for user-space, 'k' for kernel, 'h' for hypervisor.
The 'p' modifier can be used for specifying how precise the instruction
address should be. The 'p' modifier is currently only implemented for
Intel PEBS and can be specified multiple times:
0 - SAMPLE_IP can have arbitrary skid
1 - SAMPLE_IP must have constant skid
2 - SAMPLE_IP requested to have 0 skid
3 - SAMPLE_IP must have 0 skid
The PEBS implementation now supports up to 2.
RAW HARDWARE EVENT DESCRIPTOR
-----------------------------
Even when an event is not available in a symbolic form within perf right now,

View File

@ -46,9 +46,6 @@ static struct scripting_ops *scripting_ops;
static void setup_scripting(void)
{
/* make sure PERF_EXEC_PATH is set for scripts */
perf_set_argv_exec_path(perf_exec_path());
setup_perl_scripting();
setup_python_scripting();
@ -285,7 +282,7 @@ static int parse_scriptname(const struct option *opt __used,
script++;
} else {
script = str;
ext = strchr(script, '.');
ext = strrchr(script, '.');
if (!ext) {
fprintf(stderr, "invalid script extension");
return -1;
@ -593,6 +590,9 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used)
suffix = REPORT_SUFFIX;
}
/* make sure PERF_EXEC_PATH is set for scripts */
perf_set_argv_exec_path(perf_exec_path());
if (!suffix && argc >= 2 && strncmp(argv[1], "-", strlen("-")) != 0) {
char *record_script_path, *report_script_path;
int live_pipe[2];

View File

@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then
shift
fi
fi
perf trace $@ -s ~/libexec/perf-core/scripts/perl/failed-syscalls.pl $comm
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/failed-syscalls.pl $comm

View File

@ -7,7 +7,7 @@ if [ $# -lt 1 ] ; then
fi
comm=$1
shift
perf trace $@ -s ~/libexec/perf-core/scripts/perl/rw-by-file.pl $comm
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-file.pl $comm

View File

@ -1,6 +1,6 @@
#!/bin/bash
# description: system-wide r/w activity
perf trace $@ -s ~/libexec/perf-core/scripts/perl/rw-by-pid.pl
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rw-by-pid.pl

View File

@ -17,7 +17,7 @@ if [ "$n_args" -gt 0 ] ; then
interval=$1
shift
fi
perf trace $@ -s ~/libexec/perf-core/scripts/perl/rwtop.pl $interval
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/rwtop.pl $interval

View File

@ -1,6 +1,6 @@
#!/bin/bash
# description: system-wide min/max/avg wakeup latency
perf trace $@ -s ~/libexec/perf-core/scripts/perl/wakeup-latency.pl
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/wakeup-latency.pl

View File

@ -1,6 +1,6 @@
#!/bin/bash
# description: workqueue stats (ins/exe/create/destroy)
perf trace $@ -s ~/libexec/perf-core/scripts/perl/workqueue-stats.pl
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/perl/workqueue-stats.pl

View File

@ -6,6 +6,8 @@
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
import errno, os
NSECS_PER_SEC = 1000000000
def avg(total, n):
@ -26,3 +28,41 @@ def nsecs_str(nsecs):
def clear_term():
print("\x1b[H\x1b[2J")
audit_package_warned = False
try:
import audit
machine_to_id = {
'x86_64': audit.MACH_86_64,
'alpha' : audit.MACH_ALPHA,
'ia64' : audit.MACH_IA64,
'ppc' : audit.MACH_PPC,
'ppc64' : audit.MACH_PPC64,
's390' : audit.MACH_S390,
's390x' : audit.MACH_S390X,
'i386' : audit.MACH_X86,
'i586' : audit.MACH_X86,
'i686' : audit.MACH_X86,
}
try:
machine_to_id['armeb'] = audit.MACH_ARMEB
except:
pass
machine_id = machine_to_id[os.uname()[4]]
except:
if not audit_package_warned:
audit_package_warned = True
print "Install the audit-libs-python package to get syscall names"
def syscall_name(id):
try:
return audit.audit_syscall_to_name(id, machine_id)
except:
return str(id)
def strerror(nr):
try:
return errno.errorcode[abs(nr)]
except:
return "Unknown %d errno" % nr

View File

@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then
shift
fi
fi
perf trace $@ -s ~/libexec/perf-core/scripts/python/failed-syscalls-by-pid.py $comm
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/failed-syscalls-by-pid.py $comm

View File

@ -2,4 +2,4 @@
# description: display a process of packet and processing time
# args: [tx] [rx] [dev=] [debug]
perf trace -s ~/libexec/perf-core/scripts/python/netdev-times.py $@
perf trace -s "$PERF_EXEC_PATH"/scripts/python/netdev-times.py $@

View File

@ -1,3 +1,3 @@
#!/bin/bash
# description: sched migration overview
perf trace $@ -s ~/libexec/perf-core/scripts/python/sched-migration.py
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/sched-migration.py

View File

@ -21,4 +21,4 @@ elif [ "$n_args" -gt 0 ] ; then
interval=$1
shift
fi
perf trace $@ -s ~/libexec/perf-core/scripts/python/sctop.py $comm $interval
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/sctop.py $comm $interval

View File

@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then
shift
fi
fi
perf trace $@ -s ~/libexec/perf-core/scripts/python/syscall-counts-by-pid.py $comm
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts-by-pid.py $comm

View File

@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then
shift
fi
fi
perf trace $@ -s ~/libexec/perf-core/scripts/python/syscall-counts.py $comm
perf trace $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts.py $comm

View File

@ -13,21 +13,26 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \
from perf_trace_context import *
from Core import *
from Util import *
usage = "perf trace -s syscall-counts-by-pid.py [comm]\n";
usage = "perf trace -s syscall-counts-by-pid.py [comm|pid]\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():
pass
print "Press control+C to stop and show the summary"
def trace_end():
print_error_totals()
@ -35,8 +40,8 @@ def trace_end():
def raw_syscalls__sys_exit(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
id, ret):
if for_comm is not None:
if common_comm != for_comm:
if (for_comm and common_comm != for_comm) or \
(for_pid and common_pid != for_pid ):
return
if ret < 0:
@ -62,7 +67,7 @@ def print_error_totals():
print "\n%s [%d]\n" % (comm, pid),
id_keys = syscalls[comm][pid].keys()
for id in id_keys:
print " syscall: %-16d\n" % (id),
print " syscall: %-16s\n" % syscall_name(id),
ret_keys = syscalls[comm][pid][id].keys()
for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda(k, v): (v, k), reverse = True):
print " err = %-20d %10d\n" % (ret, val),
print " err = %-20s %10d\n" % (strerror(ret), val),

View File

@ -8,10 +8,7 @@
# will be refreshed every [interval] seconds. The default interval is
# 3 seconds.
import thread
import time
import os
import sys
import os, sys, thread, time
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
@ -71,7 +68,7 @@ def print_syscall_totals(interval):
for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
reverse = True):
try:
print "%-40d %10d\n" % (id, val),
print "%-40s %10d\n" % (syscall_name(id), val),
except TypeError:
pass
syscalls.clear()

View File

@ -5,29 +5,33 @@
# 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
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 trace -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():
pass
print "Press control+C to stop and show the summary"
def trace_end():
print_syscall_totals()
@ -35,8 +39,9 @@ def trace_end():
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:
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
@ -61,4 +66,4 @@ def print_syscall_totals():
id_keys = syscalls[comm][pid].keys()
for id, val in sorted(syscalls[comm][pid].iteritems(), \
key = lambda(k, v): (v, k), reverse = True):
print " %-38d %10d\n" % (id, val),
print " %-38s %10d\n" % (syscall_name(id), val),

View File

@ -13,6 +13,7 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \
from perf_trace_context import *
from Core import *
from Util import syscall_name
usage = "perf trace -s syscall-counts.py [comm]\n";
@ -27,7 +28,7 @@ if len(sys.argv) > 1:
syscalls = autodict()
def trace_begin():
pass
print "Press control+C to stop and show the summary"
def trace_end():
print_syscall_totals()
@ -55,4 +56,4 @@ def print_syscall_totals():
for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
reverse = True):
print "%-40d %10d\n" % (id, val),
print "%-40s %10d\n" % (syscall_name(id), val),

View File

@ -1731,7 +1731,8 @@ static int line_range_search_cb(Dwarf_Die *sp_die, void *data)
struct line_finder *lf = param->data;
struct line_range *lr = lf->lr;
pr_debug("find (%lx) %s\n", dwarf_dieoffset(sp_die),
pr_debug("find (%llx) %s\n",
(unsigned long long)dwarf_dieoffset(sp_die),
dwarf_diename(sp_die));
if (dwarf_tag(sp_die) == DW_TAG_subprogram &&
die_compare_name(sp_die, lr->function)) {