blob: 9a7ee1708c4a79dc253663206ffde8463935b6f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
$log_file = file_get_contents(getenv("LOG_FILE"));
// find the line with "reclean" on it
$BENCHMARK_RESULTS = substr($log_file, strrpos($log_file, "reclen"));
// skip to the next line
$BENCHMARK_RESULTS = substr($BENCHMARK_RESULTS, 1+strpos($BENCHMARK_RESULTS, "\n"));
// remove stuff after this line
$BENCHMARK_RESULTS = substr($BENCHMARK_RESULTS, 0, strpos($BENCHMARK_RESULTS, "\n"));
// break up the line into columns based on whitespace
$BENCHMARK_RESULTS = explode(" ", $BENCHMARK_RESULTS);
$R_count = 0;
$result = 0;
/* This loop picks out the result value from either the 3rd or the 5th
column. If both columns contain a value then the 5th column is
used, which is the read time. If only the 3rd column contains a
value then it is used as the write time.
Example:
KB reclen write rewrite read reread read write ...
512000 1 47591 19718 129991 106731
*/
foreach($BENCHMARK_RESULTS as $R)
{
if(!empty($R))
{
$R_count++;
if($R_count == 3 || $R_count == 5)
{
$result = $R;
}
}
}
if($result != 0)
$result = $result / 1024;
echo $result;
?>
|