"""Statistics analyzer for HotShot."""
from hotshot
.log
import ENTER
, EXIT
return StatsLoader(filename
).load()
def __init__(self
, logfn
):
self
.pop_frame
= self
._stack
.pop
# The timer selected by the profiler should never be used, so make
p
.get_time
= _brokentimer
log
= hotshot
.log
.LogReader(self
._logfn
)
what
, (filename
, lineno
, funcname
), tdelta
= event
# We multiply taccum to convert from the microseconds we
# have to the seconds that the profile/pstats module work
# with; this allows the numbers to have some basis in
# reality (ignoring calibration issues for now).
frame
= self
.new_frame(filename
, lineno
, funcname
)
p
.trace_dispatch_call(frame
, taccum
* .000001)
p
.trace_dispatch_return(frame
, taccum
* .000001)
# no further work for line events
def new_frame(self
, *args
):
# args must be filename, firstlineno, funcname
# our code objects are cached since we don't need to create
# frame objects are create fresh, since the back pointer will
frame
= FakeFrame(code
, back
)
self
._stack
.append(frame
)
class Profile(profile
.Profile
):
def simulate_cmd_complete(self
):
def __init__(self
, filename
, firstlineno
, funcname
):
self
.co_filename
= filename
self
.co_firstlineno
= firstlineno
self
.co_name
= self
.__name
__ = funcname
def __init__(self
, code
, back
):
raise RuntimeError, "this timer should not be called"