Getrusage()
Honza Pazdziora
adelton na informatics.muni.cz
Sobota Leden 16 17:44:32 MET 1999
>
> jake jsou moznosti profilovani programu v Perlu? Mam kod,
> o kterem bych rad zjistil, jestli je skutecne pomaly on sam, nebo
> jestli tak dlouho trva inicializace vsech modulu, ktere do neho taham
> (a neni jich malo). V C bych na prislusnem miste zavolal getrusage(2)
> nebo times(2) a zjistil bych, kolik casu proces doposud spotreboval.
>
> Jak je zvykem tohle delat v Perlu?
Merit kod je zvykem pomoci
use Benchmark;
timethese( $count, { 'tag1' => sub { 'code1' },
'tag2' => sub { 'code2' } } );
Jinak man perlfunc(1) -> times:
Returns a four-element list giving the user and
system times, in seconds, for this process and the
children of this process.
($user,$system,$cuser,$csystem) = times;
ale v zivote jsem to takhle nepouzil, takze budes prvni a reknes nam,
jestli to funguje ;-)
Jinak merit cas i behem inicializace muzes pomoci BEGIN bloku
vlozenych mezi ty use prikazy.
------------------------------------------------------------------------
Honza Pazdziora | adelton na fi.muni.cz | http://www.fi.muni.cz/~adelton/
Boycott the Czech Telecom -- www.bojkot.cz
------------------------------------------------------------------------
Další informace o konferenci Perl