Skip to content

Commit

Permalink
Merge pull request iovisor#1044 from goldshtn/ausyscall
Browse files Browse the repository at this point in the history
syscount: Use ausyscalls if available to get syscall list
  • Loading branch information
4ast committed Mar 11, 2017
2 parents 3da7b4a + 51803bf commit eea18dc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tools/syscount.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from itertools import izip_longest
from time import sleep, strftime
import argparse
import subprocess
import sys

#
Expand Down Expand Up @@ -343,6 +344,21 @@
313: "finit_module",
}

# Try to use ausyscall if it is available, because it can give us an up-to-date
# list of syscalls for various architectures, rather than the x86-64 hardcoded
# list above.
def parse_syscall(line):
parts = line.split()
return (int(parts[0]), parts[1].strip())

try:
# Skip the first line, which is a header. The rest of the lines are simply
# SYSCALL_NUM\tSYSCALL_NAME pairs.
out = subprocess.check_output('ausyscall --dump | tail -n +2', shell=True)
syscalls = dict(map(parse_syscall, out.strip().split('\n')))
except Exception as e:
pass

parser = argparse.ArgumentParser(
description="Summarize syscall counts and latencies.")
parser.add_argument("-p", "--pid", type=int, help="trace only this pid")
Expand Down

0 comments on commit eea18dc

Please sign in to comment.