Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Get a function argument's name

by slaniel (Acolyte)
on Jul 05, 2006 at 17:51 UTC ( #559399=note: print w/replies, xml ) Need Help??


in reply to Re: Get a function argument's name
in thread Get a function argument's name

Sure. I'm writing a little function to run another function on a given set of arguments and time how long it takes. Looks like so:
sub run_and_time(&@) { use Time::HiRes; my $func = shift; my $funcName = [some bit of code to get $func's name] my $start_time = [gettimeofday]; my @retlist = &{$func}(@_); print "Time to run $funcName: ", tv_interval($start_time), "\n"; }
So I need some way to get $funcName. Does that clarify things?

Replies are listed 'Best First'.
Re^3: Get a function argument's name
by BUU (Prior) on Jul 06, 2006 at 15:32 UTC
    Er, is there something wrong with Benchmark? Specifically: "timethis - run a chunk of code several times". Or maybe "timethese - run several chunks of code several times".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://559399]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2021-06-15 18:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (73 votes). Check out past polls.

    Notices?