Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
bc57d5a6
Commit
bc57d5a6
authored
Mar 24, 2014
by
Luke Campagnola
Browse files
Minor corrections to debug.Profiler
parent
5b47eff2
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyqtgraph/debug.py
View file @
bc57d5a6
...
@@ -430,7 +430,7 @@ class Profiler(object):
...
@@ -430,7 +430,7 @@ class Profiler(object):
try
:
try
:
caller_object_type
=
type
(
caller_frame
.
f_locals
[
"self"
])
caller_object_type
=
type
(
caller_frame
.
f_locals
[
"self"
])
except
KeyError
:
# we are in a regular function
except
KeyError
:
# we are in a regular function
qualifier
=
caller_frame
.
f_globals
[
"__name__"
].
split
(
"."
,
1
)[
1
]
qualifier
=
caller_frame
.
f_globals
[
"__name__"
].
split
(
"."
,
1
)[
-
1
]
else
:
# we are in a method
else
:
# we are in a method
qualifier
=
caller_object_type
.
__name__
qualifier
=
caller_object_type
.
__name__
func_qualname
=
qualifier
+
"."
+
caller_frame
.
f_code
.
co_name
func_qualname
=
qualifier
+
"."
+
caller_frame
.
f_code
.
co_name
...
@@ -469,6 +469,7 @@ class Profiler(object):
...
@@ -469,6 +469,7 @@ class Profiler(object):
if
self
.
_delayed
:
if
self
.
_delayed
:
self
.
_msgs
.
append
((
msg
,
args
))
self
.
_msgs
.
append
((
msg
,
args
))
else
:
else
:
self
.
flush
()
print
(
msg
%
args
)
print
(
msg
%
args
)
def
__del__
(
self
):
def
__del__
(
self
):
...
@@ -485,10 +486,13 @@ class Profiler(object):
...
@@ -485,10 +486,13 @@ class Profiler(object):
self
.
_newMsg
(
"< Exiting %s, total time: %0.4f ms"
,
self
.
_newMsg
(
"< Exiting %s, total time: %0.4f ms"
,
self
.
_name
,
(
ptime
.
time
()
-
self
.
_firstTime
)
*
1000
)
self
.
_name
,
(
ptime
.
time
()
-
self
.
_firstTime
)
*
1000
)
type
(
self
).
_depth
-=
1
type
(
self
).
_depth
-=
1
if
self
.
_depth
<
1
and
self
.
_msgs
:
if
self
.
_depth
<
1
:
self
.
flush
()
def
flush
(
self
):
if
self
.
_msgs
:
print
(
"
\n
"
.
join
([
m
[
0
]
%
m
[
1
]
for
m
in
self
.
_msgs
]))
print
(
"
\n
"
.
join
([
m
[
0
]
%
m
[
1
]
for
m
in
self
.
_msgs
]))
type
(
self
).
_msgs
=
[]
type
(
self
).
_msgs
=
[]
def
profile
(
code
,
name
=
'profile_run'
,
sort
=
'cumulative'
,
num
=
30
):
def
profile
(
code
,
name
=
'profile_run'
,
sort
=
'cumulative'
,
num
=
30
):
...
...
Write
Preview
Supports
Markdown
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