What I understand is that you want to do a benchmark.
To know how much time a function needs, you can do it with this function :
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$timeStart = microtime_float();
// your function
$timeEnd = microtime_float();
echo $timeEnd - $timeStart , ' seconds.';
The advantage of this function is that you will obtain a result in miliseconds, so it will be way more precise than a timestamp.
I would advise you to execute the function in a loop to obtain an average time, and to be more accurate.
For the network traffic, I think the simplest is to count the number of bytes you send, and the number of byte you receive.
In case of a curl for example, it should be pretty straigh forward.
I hope this helps.