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
4af50a89
Commit
4af50a89
authored
Dec 06, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor measure_loc improvements
parent
ee277f56
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
tools/measure_loc.py
tools/measure_loc.py
+3
-0
tools/measure_loc_ext/measure_loc.cpp
tools/measure_loc_ext/measure_loc.cpp
+18
-3
No files found.
tools/measure_loc.py
View file @
4af50a89
...
...
@@ -124,6 +124,9 @@ def run(sampler, kind):
except
KeyboardInterrupt
:
print
"Interrupted!"
traceback
.
print_exc
()
except
:
print
"ERROR!"
traceback
.
print_exc
()
times
=
sampler
.
stop
()
...
...
tools/measure_loc_ext/measure_loc.cpp
View file @
4af50a89
...
...
@@ -34,11 +34,25 @@ double floattime() {
return
(
double
)
t
.
tv_sec
+
t
.
tv_usec
*
0.000001
;
}
static
double
time_to_log
=
0.0
;
// Run calibrate.py and divide the time accounted to calibrate.py:2 by the loop count (10M)
#define CALIBRATION_CONSTANT 0.0000001
static
PyObject
*
trace
(
PyObject
*
self
,
PyObject
*
args
)
{
if
(
next_time
)
*
next_time
+=
(
floattime
()
-
prev_time
);
bool
log
=
false
;
if
(
next_time
)
{
double
f
=
(
floattime
()
-
prev_time
);
f
-=
CALIBRATION_CONSTANT
;
*
next_time
+=
f
;
time_to_log
-=
f
;
if
(
time_to_log
<
0
)
{
time_to_log
=
0.1
;
log
=
true
;
}
}
PyObject
*
_frame
;
char
*
event
;
...
...
@@ -51,7 +65,8 @@ trace(PyObject *self, PyObject *args)
PyObject
*
fn
=
frame
->
f_code
->
co_filename
;
char
*
fn_str
=
PyString_AsString
(
fn
);
//printf("'%s': %s:%d (%p)\n", event, fn_str, frame->f_lineno, frame->f_back);
if
(
log
)
printf
(
"'%s': %s:%d (%p)
\n
"
,
event
,
fn_str
,
frame
->
f_lineno
,
frame
->
f_back
);
if
(
strcmp
(
event
,
"call"
)
==
0
)
{
Position
p
(
fn_str
,
frame
->
f_lineno
);
...
...
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