Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
1ee6db5b
Commit
1ee6db5b
authored
May 29, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add argument parsing to process_stackmap.py
parent
bf75c321
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
19 deletions
+35
-19
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+1
-1
tools/process_stackdump.py
tools/process_stackdump.py
+34
-18
No files found.
src/codegen/irgen/irgenerator.cpp
View file @
1ee6db5b
...
...
@@ -2611,7 +2611,7 @@ public:
#if ENABLE_SAMPLING_PROFILER
auto
stmt
=
block
->
body
[
i
];
if
(
stmt
->
type
!=
AST_TYPE
::
Assign
)
// could be a landingpad
if
(
!
(
i
==
0
&&
stmt
->
type
==
AST_TYPE
::
Assign
)
&&
stmt
->
lineno
>
0
)
// could be a landingpad
doSafePoint
(
block
->
body
[
i
]);
#endif
...
...
tools/process_stackdump.py
View file @
1ee6db5b
import
argparse
import
sys
if
__name__
==
"__main__"
:
fn
=
sys
.
argv
[
1
]
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"tracebacks_file"
,
action
=
"store"
,
default
=
None
)
parser
.
add_argument
(
"--num-display"
,
action
=
"store"
,
default
=
6
,
type
=
int
)
parser
.
add_argument
(
"--dedup-frames"
,
action
=
"store"
,
default
=
None
,
type
=
int
)
parser
.
add_argument
(
"--dedup-file"
,
action
=
"store_true"
)
parser
.
add_argument
(
"--dedup-function"
,
action
=
"store_true"
)
args
=
parser
.
parse_args
()
num_display
=
args
.
num_display
key_func
=
None
def
traceback_locations
(
t
):
return
[
l
for
l
in
t
.
split
(
'
\
n
'
)
if
l
.
startswith
(
" File"
)]
if
args
.
dedup_frames
:
assert
not
key_func
key_func
=
lambda
t
:
'
\
n
'
.
join
(
t
.
split
(
'
\
n
'
)[
-
2
*
args
.
dedup_frames
:])
# last 4 stack frames
if
args
.
dedup_file
:
assert
not
key_func
key_func
=
lambda
t
:
traceback_locations
(
t
)[
-
1
].
split
(
'"'
)[
1
]
if
args
.
dedup_function
:
assert
not
key_func
def
key_func
(
t
):
locations
=
traceback_locations
(
t
)
last_file
=
locations
[
-
1
].
split
(
'"'
)[
1
]
last_function
=
locations
[
-
1
].
split
()[
-
1
][:
-
1
]
return
"%s::%s()"
%
(
last_file
,
last_function
)
if
not
key_func
:
key_func
=
lambda
t
:
t
tracebacks
=
[]
cur_traceback
=
[]
with
open
(
fn
)
as
f
:
with
open
(
args
.
tracebacks_file
)
as
f
:
for
l
in
f
:
if
l
.
startswith
(
"Traceback"
):
if
cur_traceback
:
...
...
@@ -22,36 +50,24 @@ if __name__ == "__main__":
counts
=
{}
for
t
in
tracebacks
:
locations
=
[
l
for
l
in
t
.
split
(
'
\
n
'
)
if
l
.
startswith
(
" File"
)]
last_file
=
locations
[
-
1
].
split
(
'"'
)[
1
]
last_function
=
locations
[
-
1
].
split
()[
-
1
][:
-
1
]
# dedupe on:
# key = t # full traceback
# key = '\n'.join(t.split('\n')[-8:]) # last 4 stack frames
# key = '\n'.join(t.split('\n')[-4:]) # last 2 stack frames
# key = '\n'.join(t.split('\n')[-2:]) # last stack frame
# key = last_file, last_function
key
=
last_file
key
=
key_func
(
t
)
counts
[
key
]
=
counts
.
get
(
key
,
0
)
+
1
n
=
len
(
tracebacks
)
NUM_DISPLAY
=
6
entries
=
sorted
(
counts
.
items
(),
key
=
lambda
(
k
,
v
):
v
)
if
len
(
counts
)
>
NUM_DISPLAY
:
if
len
(
counts
)
>
num_display
:
num_hidden
=
0
counts_hidden
=
0
for
k
,
v
in
entries
[:
-
NUM_DISPLAY
]:
for
k
,
v
in
entries
[:
-
num_display
]:
num_hidden
+=
1
counts_hidden
+=
v
print
"Hiding %d entries that occurred %d (%.1f%%) times"
%
(
num_hidden
,
counts_hidden
,
100.0
*
counts_hidden
/
n
)
for
k
,
v
in
sorted
(
counts
.
items
(),
key
=
lambda
(
k
,
v
):
v
)[
-
NUM_DISPLAY
:]:
for
k
,
v
in
sorted
(
counts
.
items
(),
key
=
lambda
(
k
,
v
):
v
)[
-
num_display
:]:
print
print
"Occurs %d (%.1f%%) times:"
%
(
v
,
100.0
*
v
/
n
)
print
k
...
...
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