Commit b778ccd9 authored by Sasha Goldshtein's avatar Sasha Goldshtein

stackcount: Style fixes for linter (pep8)

parent ac297c1e
......@@ -99,7 +99,8 @@ class Probe(object):
pass # Nothing to do -- attach already happened in `load`
if self.matched == 0:
raise Exception("No functions matched by pattern %s" % self.pattern)
raise Exception("No functions matched by pattern %s" %
self.pattern)
def load(self):
trace_count_text = """
......@@ -142,7 +143,8 @@ BPF_STACK_TRACE(stack_traces, 1024);
trace_count_text = trace_count_text.replace('GET_PID',
'bpf_get_current_pid_tgid() >> 32')
else:
trace_count_text = trace_count_text.replace('GET_PID', '0xffffffff')
trace_count_text = trace_count_text.replace(
'GET_PID', '0xffffffff')
stack_flags = 'BPF_F_REUSE_STACKID'
if not self.is_kernel_probe():
......@@ -173,8 +175,8 @@ BPF_STACK_TRACE(stack_traces, 1024);
if debug:
print(bpf_text)
self.bpf = BPF(text=bpf_text, usdt_contexts=
[self.usdt] if self.usdt else [])
self.bpf = BPF(text=bpf_text,
usdt_contexts=[self.usdt] if self.usdt else [])
class Tool(object):
def __init__(self):
......@@ -187,7 +189,7 @@ class Tool(object):
./stackcount -Ti 5 ip_output # output every 5 seconds, with timestamps
./stackcount -p 185 ip_output # count ip_output stacks for PID 185 only
./stackcount -p 185 c:malloc # count stacks for malloc in PID 185
./stackcount t:sched:sched_fork # count stacks for the sched_fork tracepoint
./stackcount t:sched:sched_fork # count stacks for sched_fork tracepoint
./stackcount -p 185 u:node:* # count stacks for all USDT probes in node
"""
parser = argparse.ArgumentParser(
......@@ -287,4 +289,3 @@ if __name__ == "__main__":
traceback.print_exc()
elif sys.exc_info()[0] is not SystemExit:
print(sys.exc_info()[1])
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