我有一些代码:
for my $t (1..$threads) {
push @threads, threads->create(\&action_, $t);
}
for my $t (@threads) {
$t->join();
}
sub action_ {
while (@sites) {
my $url = shift @sites;
for my $data1 (@data) {
for my $data2 (@data2) {
something($url, $data1, $data2);
}
}
}
}
如何获得每秒(或每分钟)的速度(调用方法“某物”的次数)?谢谢。