Commit 3083c85c authored by Brenden Blanco's avatar Brenden Blanco

Merge pull request #312 from iovisor/ast_dev

fix pep8 lint errors in the rest of the tools
parents a0aa7f28 bdf0773f
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# funccount Count kernel function calls. # funccount Count kernel function calls.
# For Linux, uses BCC, eBPF. See .c file. # For Linux, uses BCC, eBPF. See .c file.
...@@ -96,7 +97,7 @@ while (1): ...@@ -96,7 +97,7 @@ while (1):
try: try:
sleep(int(args.interval)) sleep(int(args.interval))
except KeyboardInterrupt: except KeyboardInterrupt:
exiting=1 exiting = 1
# as cleanup can take many seconds, trap Ctrl-C: # as cleanup can take many seconds, trap Ctrl-C:
signal.signal(signal.SIGINT, signal_ignore) signal.signal(signal.SIGINT, signal_ignore)
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# funclatency Time kernel funcitons and print latency as a histogram. # funclatency Time kernel funcitons and print latency as a histogram.
# For Linux, uses BCC, eBPF. # For Linux, uses BCC, eBPF.
...@@ -168,7 +169,7 @@ while (1): ...@@ -168,7 +169,7 @@ while (1):
try: try:
sleep(int(args.interval)) sleep(int(args.interval))
except KeyboardInterrupt: except KeyboardInterrupt:
exiting=1 exiting = 1
# as cleanup can take many seconds, trap Ctrl-C: # as cleanup can take many seconds, trap Ctrl-C:
signal.signal(signal.SIGINT, signal_ignore) signal.signal(signal.SIGINT, signal_ignore)
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# hardirqs Summarize hard IRQ (interrupt) event time. # hardirqs Summarize hard IRQ (interrupt) event time.
# For Linux, uses BCC, eBPF. # For Linux, uses BCC, eBPF.
...@@ -136,7 +137,7 @@ while (1): ...@@ -136,7 +137,7 @@ while (1):
try: try:
sleep(int(args.interval)) sleep(int(args.interval))
except KeyboardInterrupt: except KeyboardInterrupt:
exiting=1 exiting = 1
print() print()
if args.timestamp: if args.timestamp:
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# killsnoop Trace signals issued by the kill() syscall. # killsnoop Trace signals issued by the kill() syscall.
# For Linux, uses BCC, eBPF. Embedded C. # For Linux, uses BCC, eBPF. Embedded C.
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# opensnoop Trace open() syscalls. # opensnoop Trace open() syscalls.
# For Linux, uses BCC, eBPF. Embedded C. # For Linux, uses BCC, eBPF. Embedded C.
...@@ -97,9 +98,11 @@ while 1: ...@@ -97,9 +98,11 @@ while 1:
# split return value into FD and errno columns # split return value into FD and errno columns
if ret >= 0: if ret >= 0:
fd_s = ret; err = 0 fd_s = ret
err = 0
else: else:
fd_s = "-1"; err = - ret fd_s = "-1"
err = - ret
# print columns # print columns
if args.timestamp: if args.timestamp:
......
...@@ -79,12 +79,6 @@ PID COMM FD ERR PATH ...@@ -79,12 +79,6 @@ PID COMM FD ERR PATH
18384 df -1 2 /usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo 18384 df -1 2 /usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo
18384 df -1 2 /usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo 18384 df -1 2 /usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo
18384 df -1 2 /usr/share/locale/en/LC_MESSAGES/coreutils.mo 18384 df -1 2 /usr/share/locale/en/LC_MESSAGES/coreutils.mo
18384 df -1 2 /usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/coreutils.mo
18384 df -1 2 /usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/coreutils.mo
18384 df -1 2 /usr/share/locale-langpack/en_US/LC_MESSAGES/coreutils.mo
18384 df -1 2 /usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/coreutils.mo
18384 df -1 2 /usr/share/locale-langpack/en.utf8/LC_MESSAGES/coreutils.mo
18384 df -1 2 /usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo
18385 run -1 6 /dev/tty 18385 run -1 6 /dev/tty
18386 run -1 6 /dev/tty 18386 run -1 6 /dev/tty
......
#!/usr/bin/python #!/usr/bin/python
# vim: ts=8 noet sw=8 # @lint-avoid-python-3-compatibility-imports
# #
# pidpersec Count new processes (via fork). # pidpersec Count new processes (via fork).
# For Linux, uses BCC, eBPF. See .c file. # For Linux, uses BCC, eBPF. See .c file.
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
# 11-Aug-2015 Brendan Gregg Created this. # 11-Aug-2015 Brendan Gregg Created this.
from bcc import BPF from bcc import BPF
from ctypes import c_ushort, c_int, c_ulonglong from ctypes import c_int
from time import sleep, strftime from time import sleep, strftime
# load BPF program # load BPF program
b = BPF(src_file = "pidpersec.c") b = BPF(src_file="pidpersec.c")
b.attach_kprobe(event="sched_fork", fn_name="do_count") b.attach_kprobe(event="sched_fork", fn_name="do_count")
# stat indexes # stat indexes
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# softirqs Summarize soft IRQ (interrupt) event time. # softirqs Summarize soft IRQ (interrupt) event time.
# For Linux, uses BCC, eBPF. # For Linux, uses BCC, eBPF.
...@@ -126,7 +127,7 @@ while (1): ...@@ -126,7 +127,7 @@ while (1):
try: try:
sleep(int(args.interval)) sleep(int(args.interval))
except KeyboardInterrupt: except KeyboardInterrupt:
exiting=1 exiting = 1
print() print()
if args.timestamp: if args.timestamp:
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# syncsnoop Trace sync() syscall. # syncsnoop Trace sync() syscall.
# For Linux, uses BCC, eBPF. Embedded C. # For Linux, uses BCC, eBPF. Embedded C.
...@@ -15,7 +16,7 @@ from __future__ import print_function ...@@ -15,7 +16,7 @@ from __future__ import print_function
from bcc import BPF from bcc import BPF
# load BPF program # load BPF program
b = BPF(text = """ b = BPF(text="""
void kprobe__sys_sync(void *ctx) { void kprobe__sys_sync(void *ctx) {
bpf_trace_printk("sync()\\n"); bpf_trace_printk("sync()\\n");
}; };
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# tcpaccept Trace TCP accept()s. # tcpaccept Trace TCP accept()s.
# For Linux, uses BCC, eBPF. Embedded C. # For Linux, uses BCC, eBPF. Embedded C.
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# tcpconnect Trace TCP connect()s. # tcpconnect Trace TCP connect()s.
# For Linux, uses BCC, eBPF. Embedded C. # For Linux, uses BCC, eBPF. Embedded C.
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# vfscount Count VFS calls ("vfs_*"). # vfscount Count VFS calls ("vfs_*").
# For Linux, uses BCC, eBPF. See .c file. # For Linux, uses BCC, eBPF. See .c file.
...@@ -15,7 +16,7 @@ from bcc import BPF ...@@ -15,7 +16,7 @@ from bcc import BPF
from time import sleep from time import sleep
# load BPF program # load BPF program
b = BPF(src_file = "vfscount.c") b = BPF(src_file="vfscount.c")
b.attach_kprobe(event_re="^vfs_.*", fn_name="do_count") b.attach_kprobe(event_re="^vfs_.*", fn_name="do_count")
# header # header
......
#!/usr/bin/python #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
# #
# vfsstat Count some VFS calls. # vfsstat Count some VFS calls.
# For Linux, uses BCC, eBPF. See .c file. # For Linux, uses BCC, eBPF. See .c file.
...@@ -14,7 +15,7 @@ ...@@ -14,7 +15,7 @@
from __future__ import print_function from __future__ import print_function
from bcc import BPF from bcc import BPF
from ctypes import c_ushort, c_int, c_ulonglong from ctypes import c_int
from time import sleep, strftime from time import sleep, strftime
from sys import argv from sys import argv
...@@ -36,7 +37,7 @@ if len(argv) > 1: ...@@ -36,7 +37,7 @@ if len(argv) > 1:
usage() usage()
# load BPF program # load BPF program
b = BPF(src_file = "vfsstat.c") b = BPF(src_file="vfsstat.c")
b.attach_kprobe(event="vfs_read", fn_name="do_read") b.attach_kprobe(event="vfs_read", fn_name="do_read")
b.attach_kprobe(event="vfs_write", fn_name="do_write") b.attach_kprobe(event="vfs_write", fn_name="do_write")
b.attach_kprobe(event="vfs_fsync", fn_name="do_fsync") b.attach_kprobe(event="vfs_fsync", fn_name="do_fsync")
...@@ -45,11 +46,11 @@ b.attach_kprobe(event="vfs_create", fn_name="do_create") ...@@ -45,11 +46,11 @@ b.attach_kprobe(event="vfs_create", fn_name="do_create")
# stat column labels and indexes # stat column labels and indexes
stat_types = { stat_types = {
"READ" : 1, "READ": 1,
"WRITE" : 2, "WRITE": 2,
"FSYNC" : 3, "FSYNC": 3,
"OPEN" : 4, "OPEN": 4,
"CREATE" : 5 "CREATE": 5
} }
# header # header
...@@ -69,7 +70,8 @@ while (1): ...@@ -69,7 +70,8 @@ while (1):
try: try:
sleep(interval) sleep(interval)
except KeyboardInterrupt: except KeyboardInterrupt:
pass; exit() pass
exit()
print("%-8s: " % strftime("%H:%M:%S"), end="") print("%-8s: " % strftime("%H:%M:%S"), end="")
# print each statistic as a column # print each statistic as a column
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment