[eluser]CroNiX[/eluser]
Benchmarking just needs a unique starting identifier and ending identifier. You can easily use array keys to track that when using in a loop, just adding the key to the end of the start and end points and then tracking them so you can get at them later.
Code:
$keys = array();
foreach ($files as $key => $file) {
$keys[] = $key;
// S3: download profile file
$this->benchmark->mark("s3_download_start_" . $key);
$this->s3->downloadFile($file);
$this->benchmark->mark("s3_download_end_" . $key);
// PROFILE: import file to db
$this->benchmark->mark("profile_import_start_" . $key);
$this->profile->import($file);
$this->benchmark->mark("profile_import_end_" . $key);
}
//Get the elapsed time for each timer
foreach ($keys as $key)
{
echo "DL:$key: " . $this->benchmark->elapsed_time("s3_download_start_" . $key, "s3_download_end_" . $key) . '<br />';
echo "Import:$key: " . $this->benchmark->elapsed_time("profile_import_start_" . $key, "profile_import_end_" . $key) . '<br />';
}