| Revision 945,
559 bytes
checked in by bogdan2412, 4 years ago
(diff) |
|
Merge changes from live
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #! /usr/bin/env php |
|---|
| 2 | <?php |
|---|
| 3 | require_once(dirname($argv[0]) . "/utilities.php"); |
|---|
| 4 | |
|---|
| 5 | // validate argv |
|---|
| 6 | log_assert(2 == $argc, "Expecting a single argument: path to some directory"); |
|---|
| 7 | $dir = $argv[1]; |
|---|
| 8 | |
|---|
| 9 | $num_reads = 100; |
|---|
| 10 | |
|---|
| 11 | $files = glob($dir."/*"); |
|---|
| 12 | $t = microtime(true); |
|---|
| 13 | $bytes = 0; |
|---|
| 14 | for ($i = 0; $i < $num_reads; ++$i) { |
|---|
| 15 | $k = rand() % count($files); |
|---|
| 16 | |
|---|
| 17 | $f = fopen($files[$k], "r"); |
|---|
| 18 | $bytes += strlen(fread($f, 2048)); |
|---|
| 19 | fclose($f); |
|---|
| 20 | } |
|---|
| 21 | $total_time = microtime(true) - $t; |
|---|
| 22 | |
|---|
| 23 | //echo sprintf("%.2f MB\n", $bytes/1024/1024); |
|---|
| 24 | echo sprintf("%.4f\n", $total_time); |
|---|
| 25 | |
|---|
| 26 | ?> |
|---|
Note: See
TracBrowser
for help on using the repository browser.