diff options
| author | Ingo Molnar <mingo@elte.hu> | 2010-10-26 03:30:22 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-10-26 03:30:22 -0400 |
| commit | 5df414c61e1b6f15bdc3759f292c7404286c9827 (patch) | |
| tree | 41b50a595fc53de595edcc20b350c048ce2856fc /tools/perf/scripts/python/Perf-Trace-Util | |
| parent | 0b849ee88846e3488a34007c5b8b4249579ff159 (diff) | |
| parent | 7f6c1bd50d73d12f8b4ea09edb4515997f6527f5 (diff) | |
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/urgent
Diffstat (limited to 'tools/perf/scripts/python/Perf-Trace-Util')
| -rw-r--r-- | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py index 9689bc0acd9f..99ff1b7a0d2c 100644 --- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py +++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | # Public License ("GPL") version 2 as published by the Free Software | 6 | # Public License ("GPL") version 2 as published by the Free Software |
| 7 | # Foundation. | 7 | # Foundation. |
| 8 | 8 | ||
| 9 | import errno, os | ||
| 10 | |||
| 9 | NSECS_PER_SEC = 1000000000 | 11 | NSECS_PER_SEC = 1000000000 |
| 10 | 12 | ||
| 11 | def avg(total, n): | 13 | def avg(total, n): |
| @@ -26,3 +28,41 @@ def nsecs_str(nsecs): | |||
| 26 | 28 | ||
| 27 | def clear_term(): | 29 | def clear_term(): |
| 28 | print("\x1b[H\x1b[2J") | 30 | print("\x1b[H\x1b[2J") |
| 31 | |||
| 32 | audit_package_warned = False | ||
| 33 | |||
| 34 | try: | ||
| 35 | import audit | ||
| 36 | machine_to_id = { | ||
| 37 | 'x86_64': audit.MACH_86_64, | ||
| 38 | 'alpha' : audit.MACH_ALPHA, | ||
| 39 | 'ia64' : audit.MACH_IA64, | ||
| 40 | 'ppc' : audit.MACH_PPC, | ||
| 41 | 'ppc64' : audit.MACH_PPC64, | ||
| 42 | 's390' : audit.MACH_S390, | ||
| 43 | 's390x' : audit.MACH_S390X, | ||
| 44 | 'i386' : audit.MACH_X86, | ||
| 45 | 'i586' : audit.MACH_X86, | ||
| 46 | 'i686' : audit.MACH_X86, | ||
| 47 | } | ||
| 48 | try: | ||
| 49 | machine_to_id['armeb'] = audit.MACH_ARMEB | ||
| 50 | except: | ||
| 51 | pass | ||
| 52 | machine_id = machine_to_id[os.uname()[4]] | ||
| 53 | except: | ||
| 54 | if not audit_package_warned: | ||
| 55 | audit_package_warned = True | ||
| 56 | print "Install the audit-libs-python package to get syscall names" | ||
| 57 | |||
| 58 | def syscall_name(id): | ||
| 59 | try: | ||
| 60 | return audit.audit_syscall_to_name(id, machine_id) | ||
| 61 | except: | ||
| 62 | return str(id) | ||
| 63 | |||
| 64 | def strerror(nr): | ||
| 65 | try: | ||
| 66 | return errno.errorcode[abs(nr)] | ||
| 67 | except: | ||
| 68 | return "Unknown %d errno" % nr | ||
