Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bcc
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
la
platform
external
bcc
Commits
0cf81665
Commit
0cf81665
authored
3 years ago
by
chenyue.zhou
Committed by
yonghong-song
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
update
parent
c76cd926
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
man/man8/funclatency.8
+3
-0
3 additions, 0 deletions
man/man8/funclatency.8
tools/funclatency.py
+6
-7
6 additions, 7 deletions
tools/funclatency.py
tools/funclatency_example.txt
+3
-1
3 additions, 1 deletion
tools/funclatency_example.txt
with
12 additions
and
8 deletions
man/man8/funclatency.8
+
3
−
0
View file @
0cf81665
...
...
@@ -40,6 +40,9 @@ Print output every interval seconds.
\-d DURATION
Total duration of trace, in seconds.
.TP
\-l LEVEL
Set the level of nested or recursive functions.
.TP
\-T
Include timestamps on output.
.TP
...
...
This diff is collapsed.
Click to expand it.
tools/funclatency.py
+
6
−
7
View file @
0cf81665
...
...
@@ -12,11 +12,16 @@
# The pattern is a string with optional '*' wildcards, similar to file
# globbing. If you'd prefer to use regular expressions, use the -r option.
#
# Without the '-l' option, only the innermost calls will be recorded.
# Use '-l LEVEL' to record the outermost n levels of nested/recursive functions.
#
# Copyright (c) 2015 Brendan Gregg.
# Copyright (c) 2021 Chenyue Zhou.
# Licensed under the Apache License, Version 2.0 (the "License")
#
# 20-Sep-2015 Brendan Gregg Created this.
# 06-Oct-2016 Sasha Goldshtein Added user function support.
# 14-Apr-2021 Chenyue Zhou Added nested or recursive function support.
from
__future__
import
print_function
from
bcc
import
BPF
...
...
@@ -173,7 +178,7 @@ else:
if
need_key
:
pid
=
'
-1
'
if
not
library
else
'
tgid
'
if
args
.
level
>
1
:
if
args
.
level
and
args
.
level
>
1
:
bpf_text
=
bpf_text
.
replace
(
'
TYPEDEF
'
,
"""
#define STACK_DEPTH %s
...
...
@@ -204,7 +209,6 @@ static inline int stack_pop(func_stack_t *stack, func_cache_t *cache) {
}
u32 index = --stack->head;
if (index < STACK_DEPTH) {
/* bound check */
cache->ip = stack->cache[index].ip;
...
...
@@ -219,12 +223,10 @@ static inline int stack_push(func_stack_t *stack, func_cache_t *cache) {
if (index > STACK_DEPTH - 1) {
/* bound check */
return -1;
}
stack->head++;
stack->cache[index].ip = cache->ip;
stack->cache[index].start_ts = cache->start_ts;
...
...
@@ -264,7 +266,6 @@ static inline int stack_push(func_stack_t *stack, func_cache_t *cache) {
func_stack_t *stack = func_stack.lookup(&pid);
if (!stack) {
/* miss start */
return 0;
}
...
...
@@ -274,7 +275,6 @@ static inline int stack_push(func_stack_t *stack, func_cache_t *cache) {
return 0;
}
ip = cache.ip;
start_ts = cache.start_ts;
delta = bpf_ktime_get_ns() - start_ts;
...
...
@@ -290,7 +290,6 @@ static inline int stack_push(func_stack_t *stack, func_cache_t *cache) {
if (stack->head == 0) {
/* empty */
func_stack.delete(&pid);
}
"""
%
pid
)
...
...
This diff is collapsed.
Click to expand it.
tools/funclatency_example.txt
+
3
−
1
View file @
0cf81665
...
...
@@ -29,7 +29,7 @@ Tracing do_sys_open... Hit Ctrl-C to end.
524288 -> 1048575 : 0 | |
1048576 -> 2097151 : 0 | |
2097152 -> 4194303 : 1 | |
avg = 13746 nsecs, total: 6543360 nsecs, count: 476
Detaching...
...
...
@@ -383,6 +383,8 @@ optional arguments:
-F, --function show a separate histogram per function
-r, --regexp use regular expressions. Default is "*" wildcards
only.
-l LEVEL, --level LEVEL
set the level of nested or recursive functions
-v, --verbose print the BPF program (for debugging purposes)
examples:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment