1 function this
.listcalls(this
)
2 table.foreach( this
.functions
, function(key
, value
)
3 print( string.format("%.4x", key
) )
4 table.foreach(value
, print)
8 function this
.addcall(this
, address
, functionname
)
9 table.insert( this
.stack
, address
)
11 if( this
.functions
[ address
] == nil ) then
12 this
.functions
[address
] = {
20 f
= this
.functions
[address
]
21 f
.frequency
= ((f
.frequency
* (f
.calls
- 1)) + (this
.ticks
- f
.start
)) / f
.calls
27 function this
.endcall(this
)
28 address
= table.remove( this
.stack
)
30 f
= this
.functions
[address
]
32 len
= this
.ticks
- f
.start
33 if( len
> f
.maxlength
) then
39 function this
.finish(this
)
43 function this
.call(this
, address
, push
)
45 -- print( "Call ", string.format("%.4x", address), " ", Program:functionName(address) )
46 this
:addcall(address
, Program
:functionName(address
) )
50 function this
.interrupt(this
, vector
, address
)
51 -- print( "Int ", string.format("%.2d %.4x", vector, address) )
52 this
:addcall( address
, string.format("vector_%.2d", vector
) )
55 function this
.ret(this
, interrupt
)