MCPcopy Create free account
hub / github.com/iovisor/bcc / attach

Method attach

tools/stackcount.py:84–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

82 return self.type == "t" or (self.type == "p" and self.library == "")
83
84 def attach(self):
85 if self.type == "p":
86 if self.library:
87 self.bpf.attach_uprobe(name=self.library,
88 sym_re=self.pattern,
89 fn_name="trace_count",
90 pid=self.pid or -1)
91 self.matched = self.bpf.num_open_uprobes()
92 else:
93 self.bpf.attach_kprobe(event_re=self.pattern,
94 fn_name="trace_count")
95 self.matched = self.bpf.num_open_kprobes()
96 elif self.type == "t":
97 self.bpf.attach_tracepoint(tp_re=self.pattern,
98 fn_name="trace_count")
99 self.matched = self.bpf.num_open_tracepoints()
100 elif self.type == "u":
101 pass # Nothing to do -- attach already happened in `load`
102
103 if self.matched == 0:
104 raise Exception("No functions matched by pattern %s" %
105 self.pattern)
106
107 def load(self):
108 ctx_name = "ctx"

Callers 1

runMethod · 0.45

Calls 6

num_open_uprobesMethod · 0.80
num_open_kprobesMethod · 0.80
num_open_tracepointsMethod · 0.80
attach_uprobeMethod · 0.45
attach_kprobeMethod · 0.45
attach_tracepointMethod · 0.45

Tested by

no test coverage detected