You are here

function perfmon_test_filesop in Performance monitor 8

Same name and namespace in other branches
  1. 7 perfmon.inc \perfmon_test_filesop()

Test file operations.

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

File

./perfmon.module, line 205
Stand-alone perfmon test system.

Code

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