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
aaca976c
Commit
aaca976c
authored
Jan 11, 2019
by
Teng Qin
Committed by
yonghong-song
Jan 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Misc fixes on Python tools (#2136)
Misc fixes on Python tools
parent
6a0a7918
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
11 additions
and
11 deletions
+11
-11
tools/biotop.py
tools/biotop.py
+1
-1
tools/cachetop.py
tools/cachetop.py
+3
-3
tools/criticalstat.py
tools/criticalstat.py
+1
-1
tools/fileslower.py
tools/fileslower.py
+1
-1
tools/filetop.py
tools/filetop.py
+1
-1
tools/lib/uflow_example.txt
tools/lib/uflow_example.txt
+2
-2
tools/llcstat.py
tools/llcstat.py
+1
-1
tools/runqslower.py
tools/runqslower.py
+1
-1
No files found.
tools/biotop.py
View file @
aaca976c
...
@@ -53,7 +53,7 @@ loadavg = "/proc/loadavg"
...
@@ -53,7 +53,7 @@ loadavg = "/proc/loadavg"
diskstats
=
"/proc/diskstats"
diskstats
=
"/proc/diskstats"
# signal handler
# signal handler
def
signal_ignore
(
signal
,
frame
):
def
signal_ignore
(
signal
_value
,
frame
):
print
()
print
()
# load BPF program
# load BPF program
...
...
tools/cachetop.py
View file @
aaca976c
...
@@ -40,7 +40,7 @@ FIELDS = (
...
@@ -40,7 +40,7 @@ FIELDS = (
"WRITE_HIT%"
"WRITE_HIT%"
)
)
DEFAULT_FIELD
=
"HITS"
DEFAULT_FIELD
=
"HITS"
DEFAULT_SORT_FIELD
=
FIELDS
.
index
(
DEFAULT_FIELD
)
# signal handler
# signal handler
def
signal_ignore
(
signal
,
frame
):
def
signal_ignore
(
signal
,
frame
):
...
@@ -61,7 +61,7 @@ def get_meminfo():
...
@@ -61,7 +61,7 @@ def get_meminfo():
def
get_processes_stats
(
def
get_processes_stats
(
bpf
,
bpf
,
sort_field
=
FIELDS
.
index
(
DEFAULT_FIELD
)
,
sort_field
=
DEFAULT_SORT_FIELD
,
sort_reverse
=
False
):
sort_reverse
=
False
):
'''
'''
Return a tuple containing:
Return a tuple containing:
...
@@ -223,7 +223,7 @@ def handle_loop(stdscr, args):
...
@@ -223,7 +223,7 @@ def handle_loop(stdscr, args):
uid
=
int
(
stat
[
1
])
uid
=
int
(
stat
[
1
])
try
:
try
:
username
=
pwd
.
getpwuid
(
uid
)[
0
]
username
=
pwd
.
getpwuid
(
uid
)[
0
]
except
KeyError
as
ex
:
except
KeyError
:
# `pwd` throws a KeyError if the user cannot be found. This can
# `pwd` throws a KeyError if the user cannot be found. This can
# happen e.g. when the process is running in a cgroup that has
# happen e.g. when the process is running in a cgroup that has
# different users from the host.
# different users from the host.
...
...
tools/criticalstat.py
View file @
aaca976c
...
@@ -319,7 +319,7 @@ def print_event(cpu, data, size):
...
@@ -319,7 +319,7 @@ def print_event(cpu, data, size):
print
(
"NO STACK FOUND DUE TO COLLISION"
)
print
(
"NO STACK FOUND DUE TO COLLISION"
)
print
(
"==================================="
)
print
(
"==================================="
)
print
(
""
)
print
(
""
)
except
:
except
Exception
:
sys
.
exit
(
0
)
sys
.
exit
(
0
)
b
[
"events"
].
open_perf_buffer
(
print_event
,
page_cnt
=
256
)
b
[
"events"
].
open_perf_buffer
(
print_event
,
page_cnt
=
256
)
...
...
tools/fileslower.py
View file @
aaca976c
...
@@ -205,7 +205,7 @@ b.attach_kretprobe(event="__vfs_read", fn_name="trace_read_return")
...
@@ -205,7 +205,7 @@ b.attach_kretprobe(event="__vfs_read", fn_name="trace_read_return")
try
:
try
:
b
.
attach_kprobe
(
event
=
"__vfs_write"
,
fn_name
=
"trace_write_entry"
)
b
.
attach_kprobe
(
event
=
"__vfs_write"
,
fn_name
=
"trace_write_entry"
)
b
.
attach_kretprobe
(
event
=
"__vfs_write"
,
fn_name
=
"trace_write_return"
)
b
.
attach_kretprobe
(
event
=
"__vfs_write"
,
fn_name
=
"trace_write_return"
)
except
:
except
Exception
:
# older kernels don't have __vfs_write so try vfs_write instead
# older kernels don't have __vfs_write so try vfs_write instead
b
.
attach_kprobe
(
event
=
"vfs_write"
,
fn_name
=
"trace_write_entry"
)
b
.
attach_kprobe
(
event
=
"vfs_write"
,
fn_name
=
"trace_write_entry"
)
b
.
attach_kretprobe
(
event
=
"vfs_write"
,
fn_name
=
"trace_write_return"
)
b
.
attach_kretprobe
(
event
=
"vfs_write"
,
fn_name
=
"trace_write_return"
)
...
...
tools/filetop.py
View file @
aaca976c
...
@@ -60,7 +60,7 @@ debug = 0
...
@@ -60,7 +60,7 @@ debug = 0
loadavg
=
"/proc/loadavg"
loadavg
=
"/proc/loadavg"
# signal handler
# signal handler
def
signal_ignore
(
signal
,
frame
):
def
signal_ignore
(
signal
_value
,
frame
):
print
()
print
()
# define BPF program
# define BPF program
...
...
tools/lib/uflow_example.txt
View file @
aaca976c
...
@@ -48,8 +48,8 @@ CPU PID TID TIME(us) METHOD
...
@@ -48,8 +48,8 @@ CPU PID TID TIME(us) METHOD
3 27722 27731 3.144 <- java/lang/ThreadGroup.checkAccess
3 27722 27731 3.144 <- java/lang/ThreadGroup.checkAccess
3 27722 27731 3.144 -> java/lang/ThreadGroup.addUnstarted
3 27722 27731 3.144 -> java/lang/ThreadGroup.addUnstarted
3 27722 27731 3.144 <- java/lang/ThreadGroup.addUnstarted
3 27722 27731 3.144 <- java/lang/ThreadGroup.addUnstarted
3 27722 27731 3.145 -> java/lang/Thread.isDaemon
3 27722 27731 3.145 -> java/lang/Thread.isDaemon
3 27722 27731 3.145 <- java/lang/Thread.isDaemon
3 27722 27731 3.145 <- java/lang/Thread.isDaemon
3 27722 27731 3.145 -> java/lang/Thread.getPriority
3 27722 27731 3.145 -> java/lang/Thread.getPriority
3 27722 27731 3.145 <- java/lang/Thread.getPriority
3 27722 27731 3.145 <- java/lang/Thread.getPriority
3 27722 27731 3.145 -> java/lang/Thread.getContextClassLoader
3 27722 27731 3.145 -> java/lang/Thread.getContextClassLoader
...
...
tools/llcstat.py
View file @
aaca976c
...
@@ -85,7 +85,7 @@ try:
...
@@ -85,7 +85,7 @@ try:
b
.
attach_perf_event
(
b
.
attach_perf_event
(
ev_type
=
PerfType
.
HARDWARE
,
ev_config
=
PerfHWConfig
.
CACHE_REFERENCES
,
ev_type
=
PerfType
.
HARDWARE
,
ev_config
=
PerfHWConfig
.
CACHE_REFERENCES
,
fn_name
=
"on_cache_ref"
,
sample_period
=
args
.
sample_period
)
fn_name
=
"on_cache_ref"
,
sample_period
=
args
.
sample_period
)
except
:
except
Exception
:
print
(
"Failed to attach to a hardware event. Is this a virtual machine?"
)
print
(
"Failed to attach to a hardware event. Is this a virtual machine?"
)
exit
()
exit
()
...
...
tools/runqslower.py
View file @
aaca976c
...
@@ -218,7 +218,7 @@ if min_us == 0:
...
@@ -218,7 +218,7 @@ if min_us == 0:
else
:
else
:
bpf_text
=
bpf_text
.
replace
(
'FILTER_US'
,
'delta_us <= %s'
%
str
(
min_us
))
bpf_text
=
bpf_text
.
replace
(
'FILTER_US'
,
'delta_us <= %s'
%
str
(
min_us
))
if
args
.
pid
:
if
args
.
pid
:
bpf_text
=
bpf_text
.
replace
(
'FILTER_PID'
,
'pid != %s'
%
pid
)
bpf_text
=
bpf_text
.
replace
(
'FILTER_PID'
,
'pid != %s'
%
args
.
pid
)
else
:
else
:
bpf_text
=
bpf_text
.
replace
(
'FILTER_PID'
,
'0'
)
bpf_text
=
bpf_text
.
replace
(
'FILTER_PID'
,
'0'
)
if
debug
or
args
.
ebpf
:
if
debug
or
args
.
ebpf
:
...
...
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