New "profile" command

dj_d

Member
a) Rocks
b) Thank you JH
c) What's "net" refer to?
d) If you invoke the function from the command line and dawdle about entering parameters, which function (if any) is that time counted against?
e) If you use user_confirm, is dawdle time counted?

For those who haven't tried it yet, "profile foo.ash" gives you a report on the performance of each function after the script exits, even if you exit by hitting ESC. It tells you how many times the function was called and how many seconds was spent (in total) in that function.
 
Last edited:

jasonharper

Developer
"Total" includes the entire time from the start of a function call until its finish - including time spent in functions called by that function. "Net" excludes time spent in sub-calls.

Another way of looking at it: every moment of time gets counted towards the net time of exactly one function, but may be counted towards the total time of any number of functions. The sum of all the net times will be exactly the time taken to run the script, the sum of all total times will be larger (potentially much larger, depending on how deeply nested your function calls are).

I assume that time spent entering parameters would count against 'toplevel' - that's not something I ever tried. You would probably be better off specifying all parameters on the command line to eliminate that uncertainty.

Time spent staring at a confirmation prompt would count towards the net time of user_confirm, and the total times of user_confirm, the function(s) that called it, the function(s) that called those, and so on all the way back to 'toplevel'.
 

dj_d

Member
Aha! Now it's clear.

It does get counted against toplevel (just tried it). How do you invoke profile and pass parameters from the command line? profile foo.ash(true) didn't work.
 
Top