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
0bd1a6d1
Commit
0bd1a6d1
authored
Jun 29, 2017
by
Taekho Nam
Committed by
Sasha Goldshtein
Jun 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an option to strip leading zeros from histograms (#1226)
parent
1ffe18f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
src/python/bcc/table.py
src/python/bcc/table.py
+19
-10
tools/funclatency_example.txt
tools/funclatency_example.txt
+1
-1
No files found.
src/python/bcc/table.py
View file @
0bd1a6d1
...
...
@@ -54,7 +54,7 @@ def _stars(val, val_max, width):
return
text
def
_print_log2_hist
(
vals
,
val_type
):
def
_print_log2_hist
(
vals
,
val_type
,
strip_leading_zero
):
global
stars_max
log2_dist_max
=
64
idx_max
=
-
1
...
...
@@ -74,15 +74,23 @@ def _print_log2_hist(vals, val_type):
stars
=
int
(
stars_max
/
2
)
if
idx_max
>
0
:
print
(
header
%
val_type
);
print
(
header
%
val_type
)
for
i
in
range
(
1
,
idx_max
+
1
):
low
=
(
1
<<
i
)
>>
1
high
=
(
1
<<
i
)
-
1
if
(
low
==
high
):
low
-=
1
val
=
vals
[
i
]
print
(
body
%
(
low
,
high
,
val
,
stars
,
_stars
(
val
,
val_max
,
stars
)))
if
strip_leading_zero
:
if
val
:
print
(
body
%
(
low
,
high
,
val
,
stars
,
_stars
(
val
,
val_max
,
stars
)))
strip_leading_zero
=
False
else
:
print
(
body
%
(
low
,
high
,
val
,
stars
,
_stars
(
val
,
val_max
,
stars
)))
def
_print_linear_hist
(
vals
,
val_type
):
global
stars_max
...
...
@@ -281,7 +289,7 @@ class TableBase(MutableMapping):
return
next_key
def
print_log2_hist
(
self
,
val_type
=
"value"
,
section_header
=
"Bucket ptr"
,
section_print_fn
=
None
,
bucket_fn
=
None
):
section_print_fn
=
None
,
bucket_fn
=
None
,
strip_leading_zero
=
None
):
"""print_log2_hist(val_type="value", section_header="Bucket ptr",
section_print_fn=None, bucket_fn=None)
...
...
@@ -292,8 +300,10 @@ class TableBase(MutableMapping):
If section_print_fn is not None, it will be passed the bucket value
to format into a string as it sees fit. If bucket_fn is not None,
it will be used to produce a bucket value for the histogram keys.
The maximum index allowed is log2_index_max (65), which will
accomodate any 64-bit integer in the histogram.
If the value of strip_leading_zero is not False, prints a histogram
that is omitted leading zeros from the beginning. The maximum index
allowed is log2_index_max (65), which will accomodate any 64-bit
integer in the histogram.
"""
if
isinstance
(
self
.
Key
(),
ct
.
Structure
):
tmp
=
{}
...
...
@@ -312,12 +322,12 @@ class TableBase(MutableMapping):
section_print_fn
(
bucket
)))
else
:
print
(
"
\
n
%s = %r"
%
(
section_header
,
bucket
))
_print_log2_hist
(
vals
,
val_type
)
_print_log2_hist
(
vals
,
val_type
,
strip_leading_zero
)
else
:
vals
=
[
0
]
*
log2_index_max
for
k
,
v
in
self
.
items
():
vals
[
k
.
value
]
=
v
.
value
_print_log2_hist
(
vals
,
val_type
)
_print_log2_hist
(
vals
,
val_type
,
strip_leading_zero
)
def
print_linear_hist
(
self
,
val_type
=
"value"
,
section_header
=
"Bucket ptr"
,
section_print_fn
=
None
,
bucket_fn
=
None
):
...
...
@@ -709,4 +719,3 @@ class StackTrace(TableBase):
def
clear
(
self
):
pass
tools/funclatency_example.txt
View file @
0bd1a6d1
...
...
@@ -76,7 +76,7 @@ Tracing 1 function for "pthread:pthread_mutex_lock"... Hit Ctrl-C to end.
1048576 -> 2097151 : 9 | |
Detaching...
It seems that most calls to pthread_mutex_lock completed rather quickly (in
It seems that most calls to pthread_mutex_lock completed rather quickly (in
under 4us), but there were some cases of considerable contention, sometimes
over a full millisecond.
...
...
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