You are here

function perfmon_test_filesop in Performance monitor 7

Same name and namespace in other branches
  1. 8 perfmon.module \perfmon_test_filesop()

Test file operations.

1 string reference to 'perfmon_test_filesop'
_perfmon_performance_tests in ./perfmon.inc
Core Perfmon checks.

File

./perfmon.inc, line 217
Stand-alone perfmon test system.

Code

function perfmon_test_filesop() {
  $tempdir = file_directory_temp();
  $count = 1000;
  $exectime = microtime(TRUE);
  for ($i = 0; $i < $count; $i++) {
    $filecont = "<?php phpinfo(); print(''" . $i . "'')";
    $filename = $tempdir . "/phptest" . $i . ".php";
    $file = fopen($filename, "w");
    fwrite($file, $filecont);
    unlink($filename);
  }
  $exectime = microtime(TRUE) - $exectime;
  return array(
    'result' => round(1 / ($exectime / $count), 0),
    'value' => '0',
  );
}