In perl running multiple threads at the same time, each one calling the same HTTP API how do I measure how long the response time of the API took?
My thoughts were something like this
my $start_time = [gettimeofday];
my $response = $ua->get($url);
my $end_time = [gettimeofday];
my $elapsed_time = tv_interval($start_time,$end_time);
$elapsed_time = $elapsed_time * 1000;
but i am unsure if under multiple threads calling the same API if the time variables will be overwritten. I want to simulate load on the API.