Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
91734d35
Commit
91734d35
authored
Sep 21, 2015
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some simplifications
parent
665c5b03
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
tools/funccount
tools/funccount
+4
-8
No files found.
tools/funccount
View file @
91734d35
...
...
@@ -17,7 +17,6 @@ from __future__ import print_function
from
bcc
import
BPF
from
time
import
sleep
,
strftime
import
argparse
import
re
import
signal
# arguments
...
...
@@ -63,24 +62,21 @@ struct key_t {
BPF_HASH(counts, struct key_t);
int trace_count(struct pt_regs *ctx) {
FILTER
_START
FILTER
struct key_t key = {};
u64 zero = 0, *val;
key.ip = ctx->ip;
val = counts.lookup_or_init(&key, &zero);
(*val)++;
FILTER_DONE
return 0;
}
"""
if
args
.
pid
:
bpf_text
=
bpf_text
.
replace
(
'FILTER
_START
'
,
bpf_text
=
bpf_text
.
replace
(
'FILTER'
,
(
'u32 pid; pid = bpf_get_current_pid_tgid(); '
+
'if (pid == %s) {'
)
%
(
args
.
pid
))
bpf_text
=
bpf_text
.
replace
(
'FILTER_DONE'
,
'}'
)
'if (pid != %s) { return 0; }'
)
%
(
args
.
pid
))
else
:
bpf_text
=
bpf_text
.
replace
(
'FILTER_START'
,
''
)
bpf_text
=
bpf_text
.
replace
(
'FILTER_DONE'
,
''
)
bpf_text
=
bpf_text
.
replace
(
'FILTER'
,
''
)
if
debug
:
print
(
bpf_text
)
b
=
BPF
(
text
=
bpf_text
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment