Welcome Guest, Not a member yet? Register   Sign In
Enhanced Benchmarking: aggregating marks
#4

[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 />';
}


Messages In This Thread
Enhanced Benchmarking: aggregating marks - by El Forum - 03-21-2012, 02:57 PM
Enhanced Benchmarking: aggregating marks - by El Forum - 05-14-2012, 12:30 PM
Enhanced Benchmarking: aggregating marks - by El Forum - 06-27-2012, 12:28 AM
Enhanced Benchmarking: aggregating marks - by El Forum - 06-27-2012, 10:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB