updat20131129

This commit is contained in:
stubbfel
2013-11-29 13:03:50 +01:00
parent ef0cc3ff22
commit 8f2a689e92
3 changed files with 150 additions and 8 deletions

View File

@@ -10,8 +10,13 @@ class TestViewSequenz {
public $msgCount;
public $name;
public $path;
public $lockRunTime;
public $lockTimeMsgCount;
public function __construct($testFile) {
public function __construct($testFile = null) {
if (!$testFile) {
return;
}
$this->path = $testFile;
$sourceString = file_get_contents($testFile);
@@ -37,6 +42,8 @@ class TestViewSequenz {
}
$this->name = str_replace(".json", "", basename($testFile));
$this->lockRunTime = $this->lockTime / $this->runTime;
$this->lockTimeMsgCount = $this->lockTime / $this->msgCount;
}
public function toHTML() {

140
index.php
View File

@@ -23,7 +23,6 @@ function cmpLockTime($a, $b) {
return ($a->lockTime < $b->lockTime) ? -1 : 1;
}
function cmpMsgCount($a, $b) {
if ($a->msgCount == $b->msgCount) {
return 0;
@@ -31,29 +30,156 @@ function cmpMsgCount($a, $b) {
return ($a->msgCount < $b->msgCount) ? 1 : -1;
}
function aggrateTest($querry, $tests, $name) {
$tmpTest = new TestViewSequenz();
$count = 0;
foreach ($tests as $key => $value) {
if (preg_match($querry, $key) == true) {
$count++;
$tmpTest->msgCount += $value->msgCount;
$tmpTest->lockTime += $value->lockTime;
$tmpTest->runTime += $value->runTime;
$tmpTest->lockTimeMsgCount += $value->lockTimeMsgCount;
$tmpTest->lockRunTime += $value->lockRunTime;
}
}
$tmpTest->msgCount /= $count;
$tmpTest->lockTime /= $count;
$tmpTest->runTime /= $count;
$tmpTest->lockTimeMsgCount /= $count;
$tmpTest->lockRunTime /= $count;
$tmpTest->name = $name;
return $tmpTest;
}
function createAggKeyList() {
$maxFirst = 2;
$firstX = "[0-$maxFirst]";
$maxSecond = 2;
$secondX = "[0-$maxSecond]";
$maxThird = 5;
$thirdX = "[0-$maxThird]";
$keyList = array();
for ($i = 0; $i <= $maxFirst + 1; $i++) {
if ($i > $maxFirst) {
$firstChar = "x";
$firstRegex = $firstX;
} else {
$firstChar = "$i";
$firstRegex = "$i";
}
for ($j = 0; $j <= $maxSecond + 1; $j++) {
if ($j > $maxSecond) {
$secondChar = "x";
$secondRegex = $secondX;
} else {
$secondChar = "$j";
$secondRegex = "$j";
}
for ($k = 0; $k <= $maxThird + 1; $k++) {
if ($k > $maxThird) {
$thirdChar = "x";
$thirdRegex = $thirdX;
} else {
$thirdChar = "$k";
$thirdRegex = "$k";
}
$tmpName = $firstChar . $secondChar . $thirdChar;
$tmpRegex = '/^' . $firstRegex . $secondRegex . $thirdRegex . '$/';
if (strpos($tmpName, "x") === false) {
continue;
}
$keyList["$tmpName"] = $tmpRegex;
}
}
}
return $keyList;
}
$sortMethod = $_GET["sort"];
if (!$sortMethod) {
$sortMethod = "cmpName";
}
$commandCount = 10;
$tests = array();
$testPath = $_GET["path"];
if (!$sortMethod) {
$testPath = "evol/20131009/";
}
$commandCount = 1;
$commands;
$tests = array();
$dir = opendir($testPath);
while ($file = readdir($dir)) {
if (eregi("[0-9]{3}.json", $file)) {
array_push($tests, new TestViewSequenz($testPath . $file));
if (eregi("[0-9]{2,3}.json", $file) && !eregi("[0-9]{2,3}.json_", $file)) {
$tmpTest = new TestViewSequenz($testPath . $file);
$tests["$tmpTest->name"] = $tmpTest;
} else if (eregi("commands.json", $file)) {
$sourceString = file_get_contents($testPath . $file);
$source = json_decode($sourceString, true);
$commandCount = count($source);
$commands = $source;
}
}
$keys = createAggKeyList();
foreach ($keys as $key => $value) {
$tests["$key"] = aggrateTest($value, $tests, "$key");
}
echo "<table border=\"1\">";
echo "<tr><th><a href=\"?sort=cmpName\">Setting</a></th><th>command</th><th><a href=\"?sort=cmpRuneTime\">Runetime</a></th><th><a href=\"?sort=cmpLockTime\">Locktime</a></th><th><a href=\"?sort=cmpMsgCount\">Msgcount</a></th><th>Locktime per Msg</th><th>Locktime per Command</th></tr>";
echo "<tr><th><a href=\"?path=$testPath&sort=cmpName\">Setting</a></th><th><a href=\"?path=$testPath&sort=cmpRuneTime\">Runetime</a></th><th><a href=\"?path=$testPath&sort=cmpLockTime\">Locktime</a></th><th><a href=\"?path=$testPath&sort=cmpMsgCount\">Msgcount</a></th><th>Locktime per Msg</th><th>Locktime per runtime</th></tr>";
usort($tests, $sortMethod);
foreach ($tests as $testcase) {
echo "<tr>";
echo "<td style=\"padding:35px\"><a href=\"testdetails.php?testfile=$testcase->path\" target=\"_blank\">$testcase->name</a></td><td style=\"padding:35px\">$commandCount</td><td style=\"padding:35px\">$testcase->runTime</td><td style=\"padding:35px\">$testcase->lockTime</td><td style=\"padding:35px\">$testcase->msgCount</td><td style=\"padding:35px\">" . $testcase->lockTime / $testcase->msgCount . "</td><td style=\"padding:35px\">" . $testcase->lockTime / $commandCount . "</td>";
echo "<td style=\"padding:35px\"><a href=\"testdetails.php?testfile=$testcase->path\" target=\"_blank\">$testcase->name</a></td><td style=\"padding:35px\">$testcase->runTime</td><td style=\"padding:35px\">$testcase->lockTime</td><td style=\"padding:35px\">$testcase->msgCount</td><td style=\"padding:35px\">" . $testcase->lockTimeMsgCount . "</td><td style=\"padding:35px\">" . $testcase->lockRunTime . "</td>";
echo "</tr>";
}
echo "</table>";
echo "Settings: <PeerPlacingStrategyType><PeerPlacingStrategyMetricType><MaintanceMomentMetricType><br/>";
echo " <pre>
enum PeerPlacingStrategyType {
BALANCED_PEER_PLACING = 0,
CREATE_MASTER_FIRST,
DYNAMIC_PEER_PLACING
};
enum PeerPlacingStrategyMetricType {
OUCMETRIC_CLUSTERSIZE = 0,
OUCMETRIC_RESOURCEVALUE,
OUCMETRIC_RESOURCEVALUECLUSTERSIZE
};
enum MaintanceMomentMetricType {
NOMOMENTMETRIC = 0,
RESOURCEVALUEMOMENTMETRIC,
MESSAGESEQCOUNTMOMENTMETRIC,
LOGICTIMEMOMENTMETRIC,
MESSAGECOUNTMOMENTMETRIC
};
</pre><br/>";
echo "commands: <br>";
$index = 0;
foreach ($commands as $command) {
echo $index++ . " => " . $command . "<br>";
}
?>

View File

@@ -1,4 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/stubbfel/projects/Mranalysis/evol/20131114/50_50/setup.dat</file>
<file>file:/home/stubbfel/projects/Mranalysis/testlist.html</file>
<file>file:/home/stubbfel/projects/Mranalysis/createplot.php</file>
<file>file:/home/stubbfel/projects/Mranalysis/TestViewSequenz.php</file>
<file>file:/home/stubbfel/projects/Mranalysis/index.php</file>
</group>
</open-files>
</project-private>