From 1d66db3625e4cd6d69ed78b0cdb052393719d19b Mon Sep 17 00:00:00 2001 From: Horst Schirmeier Date: Thu, 20 Nov 2014 10:27:53 +0100 Subject: [PATCH] visualfail: UNIX line endings Change-Id: I5d26ec25d070e98b977ff3130c597a388a4c2c96 --- tools/analysis/VisualFAIL/CONFIGURATION.php | 20 +- tools/analysis/VisualFAIL/core.php | 950 ++++++++++---------- tools/analysis/VisualFAIL/css/myStyle.css | 36 +- tools/analysis/VisualFAIL/index.php | 258 +++--- tools/analysis/VisualFAIL/js/myscript.js | 420 ++++----- 5 files changed, 842 insertions(+), 842 deletions(-) diff --git a/tools/analysis/VisualFAIL/CONFIGURATION.php b/tools/analysis/VisualFAIL/CONFIGURATION.php index 6282fb84..60a71568 100644 --- a/tools/analysis/VisualFAIL/CONFIGURATION.php +++ b/tools/analysis/VisualFAIL/CONFIGURATION.php @@ -1,10 +1,10 @@ - + diff --git a/tools/analysis/VisualFAIL/core.php b/tools/analysis/VisualFAIL/core.php index 5c84d6a4..198a7b5c 100644 --- a/tools/analysis/VisualFAIL/core.php +++ b/tools/analysis/VisualFAIL/core.php @@ -1,475 +1,475 @@ -'); - return; - } - - $abfrage = "SELECT 1 FROM fulltrace;"; - - $ergebnis = mysql_query($abfrage); - - if(!$ergebnis) { - echo json_encode('Tabelle fulltrace nicht gefunden
'); - return; - } - - $abfrage = "SELECT 1 FROM dbg_filename;"; - - $ergebnis = mysql_query($abfrage); - - if(!$ergebnis) { - echo json_encode('Tabelle dbg_filename nicht gefunden
'); - return; - } - - $abfrage = "SELECT 1 FROM dbg_mapping;"; - - $ergebnis = mysql_query($abfrage); - - if(!$ergebnis) { - echo json_encode('Tabelle dbg_mapping nicht gefunden
'); - return; - } - - $abfrage = "SELECT 1 FROM dbg_methods;"; - - - $ergebnis = mysql_query($abfrage); - - if(!$ergebnis) { - echo json_encode('Tabelle dbg_methods nicht gefunden
'); - return; - } - - $abfrage = "SELECT 1 FROM dbg_source;"; - - $ergebnis = mysql_query($abfrage); - - if(!$ergebnis) { - echo json_encode('Tabelle dbg_source nicht gefunden
'); - return; - } - - $abfrage = "SELECT 1 FROM dbg_stacktrace;"; - - $ergebnis = mysql_query($abfrage); - - if(!$ergebnis) { - echo json_encode('Tabelle dbg_stacktrace nicht gefunden
'); - return; - } - - $abfrage = "SELECT 1 FROM dbg_variables;"; - - $ergebnis = mysql_query($abfrage); - - if(!$ergebnis) { - echo json_encode('Tabelle dbg_variables nicht gefunden
'); - return; - } -} - -function getBinarys() -{ - $binarys = array(); - - $abfrage = "SELECT benchmark FROM variant;"; - - $ergebnis = mysql_query($abfrage); - - mysql_close($verbindung); - - while($row = mysql_fetch_object($ergebnis)) - { - array_push($binarys, $row->benchmark); - } - - $result = array_unique($binarys); - - echo json_encode($result); -} - -function getVariants() -{ - $variants = array(); - - $abfrage = "SELECT id, variant FROM variant WHERE benchmark = '" . $_GET['datei'] ."';"; - - $ergebnis = mysql_query($abfrage); - - mysql_close($verbindung); - - while($row = mysql_fetch_object($ergebnis)) - { - $variants[$row->id] = $row->variant; - } - - echo json_encode($variants); -} - -function getSourceFiles() -{ - $sourceFiles = array(); - - $abfrage = "SELECT file_id, path FROM dbg_filename WHERE variant_id = '" . $_GET['variant']. "';"; - - $ergebnis = mysql_query($abfrage); - - mysql_close($verbindung); - - while($row = mysql_fetch_object($ergebnis)) - { - $sourceFiles[$row->file_id] = $row->path; - } - - echo json_encode($sourceFiles); -} - -function asmCode() -{ - $content = ""; - - $abfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id'] ."' ORDER BY instr_address;"; - - $ergebnis = mysql_query($abfrage); - - mysql_close($verbindung); - $content = $content; - while($row = mysql_fetch_object($ergebnis)) - { - $content = $content . '' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; - } - echo json_encode($content); -} - -function getAsmCode() -{ - $content = ""; - $resulttypes = array(); - - $asmAbfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id'] ."' ORDER BY instr_address;"; - - $asmcode = mysql_query($asmAbfrage); - - getResulttypes($resulttypes); - - $fehlerdaten = resultsDB($_GET['variant_id'], $_GET['version'], $resulttypes); - //$fehlerdaten = askDBFehler($_GET['variant_id'], $resulttypes, $_GET['version']); - - //print_r($fehlerdaten); - $content = '
'; - while($row = mysql_fetch_object($asmcode)) - { - if (array_key_exists($row->instr_address,$fehlerdaten[Daten])) { - $content = $content . '' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; - } else { - $content = $content . '' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; - } - } - - $content = $content . '
'; - - echo json_encode($content); -} - -function getHighlevelCode() -{ - $content = ""; - $resulttypes = array(); - - getResulttypes($resulttypes); - - $kleinsteAdresseAbfrage = "SELECT instr_address FROM objdump WHERE variant_id = '" . $_GET['variant_id']. "' ORDER BY instr_address LIMIT 1;"; - $kleinsteAdresseErgebnis = mysql_query($kleinsteAdresseAbfrage); - $kleinsteAdresse = mysql_fetch_object($kleinsteAdresseErgebnis); - - $highlevelCodeAbfrage = "SELECT linenumber, line FROM dbg_source WHERE variant_id = '" . $_GET['variant_id']. "' AND file_id = '" . $_GET['file_id']. "' ORDER BY linenumber;"; - $mappingAbfrage = "SELECT instr_absolute, linenumber FROM dbg_mapping WHERE variant_id = '" . $_GET['variant_id']. "' AND file_id = '" . $_GET['file_id'] . "' AND instr_absolute >= '" . $kleinsteAdresse->instr_address . "' ORDER BY instr_absolute;"; - - $highlevelCode = mysql_query($highlevelCodeAbfrage); - $mappingInfo = mysql_query($mappingAbfrage); - - $fehlerdaten = resultsDB($_GET['variant_id'], $_GET['version'], $resulttypes); - - $mappingRanges = array(); - $numEntrysMapping = mysql_num_rows($mappingInfo); - - $row = mysql_fetch_object($mappingInfo); - - for ($i = 0; $i < $numEntrysMapping-1; $i++) - { - if(!is_array($mappingRanges[$row->linenumber])) { - $mappingRanges[$row->linenumber] = array(); - } - $oldLineNumber = $row->linenumber; - $firstAddr = $row->instr_absolute; - $row = mysql_fetch_object($mappingInfo); - array_push($mappingRanges[$oldLineNumber], array($firstAddr, $row->instr_absolute)); - } - - $mapping = array(); - $maxFehlerMapping = array(); - - foreach ($mappingRanges as $lineNumber => $value) { - $maxFehler = array(); - foreach ($resulttypes as $val) { - $maxFehler[$val] = 0; - } - foreach ($value as $index => $ranges) { - $InstrMappingAbfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id']. "' AND instr_address > '" . $ranges[0] . "' AND instr_address < '" . $ranges[1] . "' ORDER BY instr_address;"; - $mappingErgebnis = mysql_query($InstrMappingAbfrage); - //Leerzeile - $mapping[$lineNumber] [] = '
'; - while($row = mysql_fetch_object($mappingErgebnis)) { - - if (array_key_exists($row->instr_address,$fehlerdaten[Daten])) { - $newline = $newline . 'instr_address][$value]; - } - - $newline = $newline . ' cursor: pointer;>' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; - } else { - $newline = '' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; - } - $mapping[$lineNumber] [] = $newline; - } - - //Leerzeile - $mapping[$lineNumber] [] = '
'; - } - foreach ($resulttypes as $value) { - $maxFehlerMapping[$lineNumber][$value] = $maxFehler[$value]; - } - } - - while($row = mysql_fetch_object($highlevelCode)) - { - $content = $content . '' . $row->linenumber . ' : ' . $row->line . '
'; - if(array_key_exists($row->linenumber, $mapping)) { - $content = $content . '
'; - foreach ($mapping[$row->linenumber] as $index => $span) { - $content = $content . $span; - } - $content = $content . '
'; - $content = $content .'
'; - } - } - - mysql_close($verbindung); - - echo json_encode($content); -} - -function getResulttypes(&$resulttypes) -{ - $abfrage = "SELECT resulttype FROM " . $GLOBALS['result_table'] . " GROUP BY resulttype;"; - - $ergebnis = mysql_query($abfrage); - - mysql_close($verbindung); - - while ($row = mysql_fetch_object($ergebnis)) { - //echo $row->resulttype; - array_push($resulttypes, $row->resulttype); - } -} - -function getResulttypesOUT() -{ - $resulttypes = array(); - - $abfrage = "SELECT resulttype FROM " . $GLOBALS['result_table'] . " GROUP BY resulttype;"; - - $ergebnis = mysql_query($abfrage); - - mysql_close($verbindung); - - while ($row = mysql_fetch_object($ergebnis)) { - //echo $row->resulttype; - array_push($resulttypes, $row->resulttype); - } - - echo json_encode($resulttypes); -} - -function askDBFehler($variant_id, $resulttypes, $version) -{ - if($version == 'onlyRightEdge') { - $abfrage = "SELECT ft.instr, ft.instr_absolute "; - foreach ( $resulttypes as $value) { - $temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value; - $abfrage = $abfrage . $temp; - } - $abfrage = $abfrage . " FROM fulltrace ft - LEFT JOIN trace t - ON ft.variant_id = '" . $variant_id . "' - AND t.variant_id = '" . $variant_id . "' - AND ft.instr = t.instr2 - AND t.accesstype = 'R' - JOIN fsppilot p - ON t.variant_id = '" . $variant_id . "' - AND p.variant_id = '" . $variant_id . "' - AND t.data_address = p.data_address - AND p.instr2 = t.instr2 - JOIN " . $GLOBALS['result_table'] . " r - ON p.id = r.pilot_id - GROUP BY ft.instr_absolute;"; - } else if ($version == 'latestip') { - $abfrage = "SELECT r.latest_ip "; - foreach ( $resulttypes as $value) { - $temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value; - $abfrage = $abfrage . $temp; - } - $abfrage = $abfrage . " FROM trace t - JOIN fsppilot p - ON t.variant_id = p.variant_id - AND t.data_address = p.data_address - AND p.instr2 = t.instr2 - JOIN " . $GLOBALS['result_table'] . " r - ON p.id = r.pilot_id - WHERE t.variant_id = '" . $variant_id . "' AND t.accesstype = 'R' - GROUP BY r.latest_ip;"; - } else { - $abfrage = "SELECT ft.instr, ft.instr_absolute "; - foreach ( $resulttypes as $value) { - $temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value; - $abfrage = $abfrage . $temp; - } - $abfrage = $abfrage . " FROM fulltrace ft - LEFT JOIN trace t - ON ft.variant_id = '" . $variant_id . "' - AND t.variant_id = '" . $variant_id . "' - AND ft.instr BETWEEN t.instr1 AND t.instr2 - AND t.accesstype = 'R' - JOIN fsppilot p - ON t.variant_id = '" . $variant_id . "' - AND p.variant_id = '" . $variant_id . "' - AND t.data_address = p.data_address - AND p.instr2 = t.instr2 - JOIN " . $GLOBALS['result_table'] . " r - ON p.id = r.pilot_id - GROUP BY ft.instr_absolute;"; - } - - //echo $abfrage; - - $ergebnis = mysql_query($abfrage); - - mysql_close($verbindung); - - return $ergebnis; -} - -function resultsDB($variant_id, $version, $resulttypes) -{ - - getResulttypes($resulttypes); - - //print_r($resulttypes); - - $ergebnis = askDBFehler($variant_id, $resulttypes, $version); - - //print_r($ergebnis); - - $results = array(); - - // We find the fields number - $numfields=mysql_num_fields($ergebnis); - - for($i=0;$i<$numfields;$i++){ - $fieldname[$i]=mysql_field_name($ergebnis, $i); - } - - for($i=2;$i<$numfields;$i++){ - $results["max"][$fieldname[$i]] = 0; - } - - $maxFehler = 0; - while($row = mysql_fetch_object($ergebnis)) - { - if($version != 'latestip'){ - if($row->instr_absolute != NULL) - { - $results["Daten"][$row->instr_absolute] = array(); - for ($i = 1 ; $i < $numfields ; $i++) - { - $results["Daten"][$row->instr_absolute][$fieldname[$i]] = $row->$fieldname[$i]; - - if($row->$fieldname[$i] > $results["max"][$fieldname[$i]]) - { - $results["max"][$fieldname[$i]] = $row->$fieldname[$i]; - } - } - } - } else { - if($row->latest_ip != NULL) - { - $results["Daten"][$row->latest_ip] = array(); - for ($i = 0 ; $i < $numfields ; $i++) - { - $results["Daten"][$row->latest_ip][$fieldname[$i]] = $row->$fieldname[$i]; - - if($row->$fieldname[$i] > $results["max"][$fieldname[$i]]) - { - $results["max"][$fieldname[$i]] = $row->$fieldname[$i]; - } - } - } - } - } - - return $results; -} - -?> +'); + return; + } + + $abfrage = "SELECT 1 FROM fulltrace;"; + + $ergebnis = mysql_query($abfrage); + + if(!$ergebnis) { + echo json_encode('Tabelle fulltrace nicht gefunden
'); + return; + } + + $abfrage = "SELECT 1 FROM dbg_filename;"; + + $ergebnis = mysql_query($abfrage); + + if(!$ergebnis) { + echo json_encode('Tabelle dbg_filename nicht gefunden
'); + return; + } + + $abfrage = "SELECT 1 FROM dbg_mapping;"; + + $ergebnis = mysql_query($abfrage); + + if(!$ergebnis) { + echo json_encode('Tabelle dbg_mapping nicht gefunden
'); + return; + } + + $abfrage = "SELECT 1 FROM dbg_methods;"; + + + $ergebnis = mysql_query($abfrage); + + if(!$ergebnis) { + echo json_encode('Tabelle dbg_methods nicht gefunden
'); + return; + } + + $abfrage = "SELECT 1 FROM dbg_source;"; + + $ergebnis = mysql_query($abfrage); + + if(!$ergebnis) { + echo json_encode('Tabelle dbg_source nicht gefunden
'); + return; + } + + $abfrage = "SELECT 1 FROM dbg_stacktrace;"; + + $ergebnis = mysql_query($abfrage); + + if(!$ergebnis) { + echo json_encode('Tabelle dbg_stacktrace nicht gefunden
'); + return; + } + + $abfrage = "SELECT 1 FROM dbg_variables;"; + + $ergebnis = mysql_query($abfrage); + + if(!$ergebnis) { + echo json_encode('Tabelle dbg_variables nicht gefunden
'); + return; + } +} + +function getBinarys() +{ + $binarys = array(); + + $abfrage = "SELECT benchmark FROM variant;"; + + $ergebnis = mysql_query($abfrage); + + mysql_close($verbindung); + + while($row = mysql_fetch_object($ergebnis)) + { + array_push($binarys, $row->benchmark); + } + + $result = array_unique($binarys); + + echo json_encode($result); +} + +function getVariants() +{ + $variants = array(); + + $abfrage = "SELECT id, variant FROM variant WHERE benchmark = '" . $_GET['datei'] ."';"; + + $ergebnis = mysql_query($abfrage); + + mysql_close($verbindung); + + while($row = mysql_fetch_object($ergebnis)) + { + $variants[$row->id] = $row->variant; + } + + echo json_encode($variants); +} + +function getSourceFiles() +{ + $sourceFiles = array(); + + $abfrage = "SELECT file_id, path FROM dbg_filename WHERE variant_id = '" . $_GET['variant']. "';"; + + $ergebnis = mysql_query($abfrage); + + mysql_close($verbindung); + + while($row = mysql_fetch_object($ergebnis)) + { + $sourceFiles[$row->file_id] = $row->path; + } + + echo json_encode($sourceFiles); +} + +function asmCode() +{ + $content = ""; + + $abfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id'] ."' ORDER BY instr_address;"; + + $ergebnis = mysql_query($abfrage); + + mysql_close($verbindung); + $content = $content; + while($row = mysql_fetch_object($ergebnis)) + { + $content = $content . '' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; + } + echo json_encode($content); +} + +function getAsmCode() +{ + $content = ""; + $resulttypes = array(); + + $asmAbfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id'] ."' ORDER BY instr_address;"; + + $asmcode = mysql_query($asmAbfrage); + + getResulttypes($resulttypes); + + $fehlerdaten = resultsDB($_GET['variant_id'], $_GET['version'], $resulttypes); + //$fehlerdaten = askDBFehler($_GET['variant_id'], $resulttypes, $_GET['version']); + + //print_r($fehlerdaten); + $content = '
'; + while($row = mysql_fetch_object($asmcode)) + { + if (array_key_exists($row->instr_address,$fehlerdaten[Daten])) { + $content = $content . '' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; + } else { + $content = $content . '' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; + } + } + + $content = $content . '
'; + + echo json_encode($content); +} + +function getHighlevelCode() +{ + $content = ""; + $resulttypes = array(); + + getResulttypes($resulttypes); + + $kleinsteAdresseAbfrage = "SELECT instr_address FROM objdump WHERE variant_id = '" . $_GET['variant_id']. "' ORDER BY instr_address LIMIT 1;"; + $kleinsteAdresseErgebnis = mysql_query($kleinsteAdresseAbfrage); + $kleinsteAdresse = mysql_fetch_object($kleinsteAdresseErgebnis); + + $highlevelCodeAbfrage = "SELECT linenumber, line FROM dbg_source WHERE variant_id = '" . $_GET['variant_id']. "' AND file_id = '" . $_GET['file_id']. "' ORDER BY linenumber;"; + $mappingAbfrage = "SELECT instr_absolute, linenumber FROM dbg_mapping WHERE variant_id = '" . $_GET['variant_id']. "' AND file_id = '" . $_GET['file_id'] . "' AND instr_absolute >= '" . $kleinsteAdresse->instr_address . "' ORDER BY instr_absolute;"; + + $highlevelCode = mysql_query($highlevelCodeAbfrage); + $mappingInfo = mysql_query($mappingAbfrage); + + $fehlerdaten = resultsDB($_GET['variant_id'], $_GET['version'], $resulttypes); + + $mappingRanges = array(); + $numEntrysMapping = mysql_num_rows($mappingInfo); + + $row = mysql_fetch_object($mappingInfo); + + for ($i = 0; $i < $numEntrysMapping-1; $i++) + { + if(!is_array($mappingRanges[$row->linenumber])) { + $mappingRanges[$row->linenumber] = array(); + } + $oldLineNumber = $row->linenumber; + $firstAddr = $row->instr_absolute; + $row = mysql_fetch_object($mappingInfo); + array_push($mappingRanges[$oldLineNumber], array($firstAddr, $row->instr_absolute)); + } + + $mapping = array(); + $maxFehlerMapping = array(); + + foreach ($mappingRanges as $lineNumber => $value) { + $maxFehler = array(); + foreach ($resulttypes as $val) { + $maxFehler[$val] = 0; + } + foreach ($value as $index => $ranges) { + $InstrMappingAbfrage = "SELECT instr_address, disassemble FROM objdump WHERE variant_id = '" . $_GET['variant_id']. "' AND instr_address > '" . $ranges[0] . "' AND instr_address < '" . $ranges[1] . "' ORDER BY instr_address;"; + $mappingErgebnis = mysql_query($InstrMappingAbfrage); + //Leerzeile + $mapping[$lineNumber] [] = '
'; + while($row = mysql_fetch_object($mappingErgebnis)) { + + if (array_key_exists($row->instr_address,$fehlerdaten[Daten])) { + $newline = $newline . 'instr_address][$value]; + } + + $newline = $newline . ' cursor: pointer;>' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; + } else { + $newline = '' . dechex($row->instr_address) . ' ' . htmlspecialchars($row->disassemble) . '
'; + } + $mapping[$lineNumber] [] = $newline; + } + + //Leerzeile + $mapping[$lineNumber] [] = '
'; + } + foreach ($resulttypes as $value) { + $maxFehlerMapping[$lineNumber][$value] = $maxFehler[$value]; + } + } + + while($row = mysql_fetch_object($highlevelCode)) + { + $content = $content . '' . $row->linenumber . ' : ' . $row->line . '
'; + if(array_key_exists($row->linenumber, $mapping)) { + $content = $content . '
'; + foreach ($mapping[$row->linenumber] as $index => $span) { + $content = $content . $span; + } + $content = $content . '
'; + $content = $content .'
'; + } + } + + mysql_close($verbindung); + + echo json_encode($content); +} + +function getResulttypes(&$resulttypes) +{ + $abfrage = "SELECT resulttype FROM " . $GLOBALS['result_table'] . " GROUP BY resulttype;"; + + $ergebnis = mysql_query($abfrage); + + mysql_close($verbindung); + + while ($row = mysql_fetch_object($ergebnis)) { + //echo $row->resulttype; + array_push($resulttypes, $row->resulttype); + } +} + +function getResulttypesOUT() +{ + $resulttypes = array(); + + $abfrage = "SELECT resulttype FROM " . $GLOBALS['result_table'] . " GROUP BY resulttype;"; + + $ergebnis = mysql_query($abfrage); + + mysql_close($verbindung); + + while ($row = mysql_fetch_object($ergebnis)) { + //echo $row->resulttype; + array_push($resulttypes, $row->resulttype); + } + + echo json_encode($resulttypes); +} + +function askDBFehler($variant_id, $resulttypes, $version) +{ + if($version == 'onlyRightEdge') { + $abfrage = "SELECT ft.instr, ft.instr_absolute "; + foreach ( $resulttypes as $value) { + $temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value; + $abfrage = $abfrage . $temp; + } + $abfrage = $abfrage . " FROM fulltrace ft + LEFT JOIN trace t + ON ft.variant_id = '" . $variant_id . "' + AND t.variant_id = '" . $variant_id . "' + AND ft.instr = t.instr2 + AND t.accesstype = 'R' + JOIN fsppilot p + ON t.variant_id = '" . $variant_id . "' + AND p.variant_id = '" . $variant_id . "' + AND t.data_address = p.data_address + AND p.instr2 = t.instr2 + JOIN " . $GLOBALS['result_table'] . " r + ON p.id = r.pilot_id + GROUP BY ft.instr_absolute;"; + } else if ($version == 'latestip') { + $abfrage = "SELECT r.latest_ip "; + foreach ( $resulttypes as $value) { + $temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value; + $abfrage = $abfrage . $temp; + } + $abfrage = $abfrage . " FROM trace t + JOIN fsppilot p + ON t.variant_id = p.variant_id + AND t.data_address = p.data_address + AND p.instr2 = t.instr2 + JOIN " . $GLOBALS['result_table'] . " r + ON p.id = r.pilot_id + WHERE t.variant_id = '" . $variant_id . "' AND t.accesstype = 'R' + GROUP BY r.latest_ip;"; + } else { + $abfrage = "SELECT ft.instr, ft.instr_absolute "; + foreach ( $resulttypes as $value) { + $temp = ", SUM(IF(r.resulttype = '" . $value . "', 1, 0)*(t.time2-t.time1+1)) AS " . $value; + $abfrage = $abfrage . $temp; + } + $abfrage = $abfrage . " FROM fulltrace ft + LEFT JOIN trace t + ON ft.variant_id = '" . $variant_id . "' + AND t.variant_id = '" . $variant_id . "' + AND ft.instr BETWEEN t.instr1 AND t.instr2 + AND t.accesstype = 'R' + JOIN fsppilot p + ON t.variant_id = '" . $variant_id . "' + AND p.variant_id = '" . $variant_id . "' + AND t.data_address = p.data_address + AND p.instr2 = t.instr2 + JOIN " . $GLOBALS['result_table'] . " r + ON p.id = r.pilot_id + GROUP BY ft.instr_absolute;"; + } + + //echo $abfrage; + + $ergebnis = mysql_query($abfrage); + + mysql_close($verbindung); + + return $ergebnis; +} + +function resultsDB($variant_id, $version, $resulttypes) +{ + + getResulttypes($resulttypes); + + //print_r($resulttypes); + + $ergebnis = askDBFehler($variant_id, $resulttypes, $version); + + //print_r($ergebnis); + + $results = array(); + + // We find the fields number + $numfields=mysql_num_fields($ergebnis); + + for($i=0;$i<$numfields;$i++){ + $fieldname[$i]=mysql_field_name($ergebnis, $i); + } + + for($i=2;$i<$numfields;$i++){ + $results["max"][$fieldname[$i]] = 0; + } + + $maxFehler = 0; + while($row = mysql_fetch_object($ergebnis)) + { + if($version != 'latestip'){ + if($row->instr_absolute != NULL) + { + $results["Daten"][$row->instr_absolute] = array(); + for ($i = 1 ; $i < $numfields ; $i++) + { + $results["Daten"][$row->instr_absolute][$fieldname[$i]] = $row->$fieldname[$i]; + + if($row->$fieldname[$i] > $results["max"][$fieldname[$i]]) + { + $results["max"][$fieldname[$i]] = $row->$fieldname[$i]; + } + } + } + } else { + if($row->latest_ip != NULL) + { + $results["Daten"][$row->latest_ip] = array(); + for ($i = 0 ; $i < $numfields ; $i++) + { + $results["Daten"][$row->latest_ip][$fieldname[$i]] = $row->$fieldname[$i]; + + if($row->$fieldname[$i] > $results["max"][$fieldname[$i]]) + { + $results["max"][$fieldname[$i]] = $row->$fieldname[$i]; + } + } + } + } + } + + return $results; +} + +?> diff --git a/tools/analysis/VisualFAIL/css/myStyle.css b/tools/analysis/VisualFAIL/css/myStyle.css index 7ed2b0ee..5f6292a1 100644 --- a/tools/analysis/VisualFAIL/css/myStyle.css +++ b/tools/analysis/VisualFAIL/css/myStyle.css @@ -1,19 +1,19 @@ -body { - min-height: 2000px; - padding-top: 70px; -} - -/* Custom container */ -.container-full { - margin: 0 auto; - padding: 0 15px; - width: 100%; -} - -.logo { - padding: 0 0 0 30px; -} - -#analyse { - margin: 20px 0 0 0; +body { + min-height: 2000px; + padding-top: 70px; +} + +/* Custom container */ +.container-full { + margin: 0 auto; + padding: 0 15px; + width: 100%; +} + +.logo { + padding: 0 0 0 30px; +} + +#analyse { + margin: 20px 0 0 0; } \ No newline at end of file diff --git a/tools/analysis/VisualFAIL/index.php b/tools/analysis/VisualFAIL/index.php index 46485ace..325c849f 100644 --- a/tools/analysis/VisualFAIL/index.php +++ b/tools/analysis/VisualFAIL/index.php @@ -1,129 +1,129 @@ - - - - - - - - - - - Visual FAIL* - - - - - - - - - - - - - - - - - -
- - -
-
- -
-
Färbung
-
- -
-
- -
-
Benchmark
-
- -
-
- -
-
Variante
-
- -
- -
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-						
-
-						
-
-
-
-
- - - - - - - - + + + + + + + + + + + Visual FAIL* + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
Färbung
+
+ +
+
+ +
+
Benchmark
+
+ +
+
+ +
+
Variante
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+						
+
+						
+
+
+
+
+ + + + + + + + diff --git a/tools/analysis/VisualFAIL/js/myscript.js b/tools/analysis/VisualFAIL/js/myscript.js index 3b02dd59..5495139d 100644 --- a/tools/analysis/VisualFAIL/js/myscript.js +++ b/tools/analysis/VisualFAIL/js/myscript.js @@ -1,210 +1,210 @@ -$.ajaxSetup({ -async: false -}); - - -//Umwandlung von dezimal zu hexadezimal -function dec2hex(dec) { - var hex = ""; - - if (dec < 0) { - dec = 0xFFFFFFFF + dec + 1; - } - - hex = parseInt(dec, 10).toString(16); - - return hex; -} - -//Berechne den Farbwert (z.B.: #FFFFFF) fuer gegebene Fehlerwerte -function calcColor(fehler, maxFehler) { - //console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler); - - var part = 0; - - if (fehler != 0) { - var x = 255/Math.log(maxFehler); - part = x*Math.log(fehler); - } - - //console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler + " Part: " + part); - - var hex = dec2hex(255-part); - - //console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler + " Part: " + part + " Farbcode: " + ("#FF" + hex + hex)); - - if (hex >= 0 && hex <= 9 ) { - return "#FF" + hex + hex + hex + hex; - } else { - return "#FF" + hex + hex; - } -} - -//Tooltip für Instruktionszeilen mit Fehler -$('body').popover({ - selector: ".hasFehler", - html: true, - title: function() { return $(this).attr("id"); }, - content: function() { - var ausgabe = ''; - var caller = $(this); - - $.getJSON("core.php", {kommando: 'getResultTypes'}, function(data) { - $.each(data, function(key, val) { - ausgabe = ausgabe + val +': ' + caller.attr(val) + '
'; - }); - }); - return ausgabe; - } -}); - -//Einblenden des Modal "Loading" fuer Ajax Requests -/*$(document).ajaxStart(function(){ - //console.log("ajaxstart"); - $("body").addClass("loading"); -}).ajaxStop(function(){ - //console.log("ajaxstop"); - $("body").removeClass("loading"); -});*/ - -//User-Interaktionen nachdem das DOM geladen ist -$(document).ready(function() { - - //DB check - $.getJSON("core.php", {kommando: 'dbTest'}, function(data) { - - if(data != "ok") { - $('html').html(data); - } - }); - - //Holen der Binarys, die in der DB in der Tabelle Variant vorkommen - $.getJSON("core.php", {kommando: 'getBinarys'}, function(data) { - $.each(data, function(key, val) { - $('#binary').append(''); - }); - }); - - //Auswahl eines Eintrages aus den Source-Files für die Darstellung des Hochsprachencode - $('#sourceFiles').change(function() { - if($(this).val() != 'none') { - $.getJSON("core.php", {kommando: 'getHighlevelCode', variant_id: $('#variant').val(), file_id: $(this).val(), version: $('#faerbung').val()}, function(data) { - - $('#hcode').html(data); - - $('.maxFehlerMapping').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) { - var newFehler = 0; - var actualRow = $(this); - - $.each(activeFehlertypes, function(key, val) { - newFehler = newFehler + parseInt(actualRow.attr(val)); - }); - - console.log("jepp" + newMaxFehler + " " + newFehler); - - $(this).prev().prev().prev().css("background-color", calcColor(newFehler, newMaxFehler)) - .css('cursor', 'pointer'); - }); - - $('.hasFehler').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) { - var newFehler = 0; - var actualRow = $(this); - - $.each(activeFehlertypes, function(key, val) { - newFehler = newFehler + parseInt(actualRow.attr(val)); - }); - - $(this).css("background-color", calcColor(newFehler, newMaxFehler)) - .css('cursor', 'pointer'); - }); - }); - - - setTimeout(function(){ - var activeFehlertypes = new Array(); - var newMaxFehler = 0; - - $('#fehlertypenset > .active').each(function(){ - activeFehlertypes.push($(this).attr("id")); - //console.log("Hinzugefuegt: " + $(this).attr("id")); - }); - - - $.each(activeFehlertypes,function(key, name){ - - //Neuen MaxFehler berechnen - newMaxFehler = newMaxFehler + parseInt($('#maxFehler').attr(name)); - }); - $('.hasFehler').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); - $('.maxFehlerMapping').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); - },100); - } - }); - - //Auswahl eines Eintrages aus den Binarys für die Darstellung des Assembler-Code - $('#binary').change(function() { - if($(this).val() != 'none') { - $('#variant').html(''); - $.getJSON("core.php", {kommando: 'getVariants', datei: $(this).val()}, function(data) { - $.each(data, function(key, val) { - $('#variant').append(''); - }); - }); - } - }); - - //Analyse Button wird gedrueckt - $('#analyse').button().click( function () { - - $.getJSON("core.php", {kommando: 'getAsmCode', variant_id: $('#variant').val(), version: $('#faerbung').val()}, function(data) { - $('#asm').html(data); - }); - - $.getJSON("core.php", {kommando: 'getSourceFiles', variant: $('#variant').val()}, function(data) { - $.each(data, function(key, val) { - $('#sourceFiles').append(''); - }); - }); - - $.getJSON("core.php", {kommando: 'getResultTypes'}, function(data) { - - $('#fehlertypenset').html(''); - $.each(data, function(key, val) { - $('#fehlertypenset').append(''); - //$('#'+ val +'.btn').button('toggle'); - }); - - $('.hasFehler').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) { - var newFehler = 0; - var actualRow = $(this); - - $.each(activeFehlertypes, function(key, val) { - newFehler = newFehler + parseInt(actualRow.attr(val)); - }); - - $(this).css("background-color", calcColor(newFehler, newMaxFehler)) - .css('cursor', 'pointer'); - }); - - //Auf Änderungen bzgl. des Fehler-Buttonset horchen - $('#fehlertypenset input[type=checkbox]').change(function() {setTimeout(function(){ - //console.log("aenderung!"); - var activeFehlertypes = new Array(); - var newMaxFehler = 0; - - $('#fehlertypenset > .active').each(function(){ - activeFehlertypes.push($(this).attr("id")); - }); - - - $.each(activeFehlertypes,function(key, name){ - //Neuen MaxFehler berechnen - newMaxFehler = newMaxFehler + parseInt($('#maxFehler').attr(name)); - }); - - $('.hasFehler').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); - $('.maxFehlerMapping').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); - },100)}); - }); - }); -}); +$.ajaxSetup({ +async: false +}); + + +//Umwandlung von dezimal zu hexadezimal +function dec2hex(dec) { + var hex = ""; + + if (dec < 0) { + dec = 0xFFFFFFFF + dec + 1; + } + + hex = parseInt(dec, 10).toString(16); + + return hex; +} + +//Berechne den Farbwert (z.B.: #FFFFFF) fuer gegebene Fehlerwerte +function calcColor(fehler, maxFehler) { + //console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler); + + var part = 0; + + if (fehler != 0) { + var x = 255/Math.log(maxFehler); + part = x*Math.log(fehler); + } + + //console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler + " Part: " + part); + + var hex = dec2hex(255-part); + + //console.log("Farbe Fehler: " + fehler + " Max: " + maxFehler + " Part: " + part + " Farbcode: " + ("#FF" + hex + hex)); + + if (hex >= 0 && hex <= 9 ) { + return "#FF" + hex + hex + hex + hex; + } else { + return "#FF" + hex + hex; + } +} + +//Tooltip für Instruktionszeilen mit Fehler +$('body').popover({ + selector: ".hasFehler", + html: true, + title: function() { return $(this).attr("id"); }, + content: function() { + var ausgabe = ''; + var caller = $(this); + + $.getJSON("core.php", {kommando: 'getResultTypes'}, function(data) { + $.each(data, function(key, val) { + ausgabe = ausgabe + val +': ' + caller.attr(val) + '
'; + }); + }); + return ausgabe; + } +}); + +//Einblenden des Modal "Loading" fuer Ajax Requests +/*$(document).ajaxStart(function(){ + //console.log("ajaxstart"); + $("body").addClass("loading"); +}).ajaxStop(function(){ + //console.log("ajaxstop"); + $("body").removeClass("loading"); +});*/ + +//User-Interaktionen nachdem das DOM geladen ist +$(document).ready(function() { + + //DB check + $.getJSON("core.php", {kommando: 'dbTest'}, function(data) { + + if(data != "ok") { + $('html').html(data); + } + }); + + //Holen der Binarys, die in der DB in der Tabelle Variant vorkommen + $.getJSON("core.php", {kommando: 'getBinarys'}, function(data) { + $.each(data, function(key, val) { + $('#binary').append(''); + }); + }); + + //Auswahl eines Eintrages aus den Source-Files für die Darstellung des Hochsprachencode + $('#sourceFiles').change(function() { + if($(this).val() != 'none') { + $.getJSON("core.php", {kommando: 'getHighlevelCode', variant_id: $('#variant').val(), file_id: $(this).val(), version: $('#faerbung').val()}, function(data) { + + $('#hcode').html(data); + + $('.maxFehlerMapping').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) { + var newFehler = 0; + var actualRow = $(this); + + $.each(activeFehlertypes, function(key, val) { + newFehler = newFehler + parseInt(actualRow.attr(val)); + }); + + console.log("jepp" + newMaxFehler + " " + newFehler); + + $(this).prev().prev().prev().css("background-color", calcColor(newFehler, newMaxFehler)) + .css('cursor', 'pointer'); + }); + + $('.hasFehler').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) { + var newFehler = 0; + var actualRow = $(this); + + $.each(activeFehlertypes, function(key, val) { + newFehler = newFehler + parseInt(actualRow.attr(val)); + }); + + $(this).css("background-color", calcColor(newFehler, newMaxFehler)) + .css('cursor', 'pointer'); + }); + }); + + + setTimeout(function(){ + var activeFehlertypes = new Array(); + var newMaxFehler = 0; + + $('#fehlertypenset > .active').each(function(){ + activeFehlertypes.push($(this).attr("id")); + //console.log("Hinzugefuegt: " + $(this).attr("id")); + }); + + + $.each(activeFehlertypes,function(key, name){ + + //Neuen MaxFehler berechnen + newMaxFehler = newMaxFehler + parseInt($('#maxFehler').attr(name)); + }); + $('.hasFehler').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); + $('.maxFehlerMapping').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); + },100); + } + }); + + //Auswahl eines Eintrages aus den Binarys für die Darstellung des Assembler-Code + $('#binary').change(function() { + if($(this).val() != 'none') { + $('#variant').html(''); + $.getJSON("core.php", {kommando: 'getVariants', datei: $(this).val()}, function(data) { + $.each(data, function(key, val) { + $('#variant').append(''); + }); + }); + } + }); + + //Analyse Button wird gedrueckt + $('#analyse').button().click( function () { + + $.getJSON("core.php", {kommando: 'getAsmCode', variant_id: $('#variant').val(), version: $('#faerbung').val()}, function(data) { + $('#asm').html(data); + }); + + $.getJSON("core.php", {kommando: 'getSourceFiles', variant: $('#variant').val()}, function(data) { + $.each(data, function(key, val) { + $('#sourceFiles').append(''); + }); + }); + + $.getJSON("core.php", {kommando: 'getResultTypes'}, function(data) { + + $('#fehlertypenset').html(''); + $.each(data, function(key, val) { + $('#fehlertypenset').append(''); + //$('#'+ val +'.btn').button('toggle'); + }); + + $('.hasFehler').on( "calcColor", function( event, newMaxFehler, activeFehlertypes) { + var newFehler = 0; + var actualRow = $(this); + + $.each(activeFehlertypes, function(key, val) { + newFehler = newFehler + parseInt(actualRow.attr(val)); + }); + + $(this).css("background-color", calcColor(newFehler, newMaxFehler)) + .css('cursor', 'pointer'); + }); + + //Auf Änderungen bzgl. des Fehler-Buttonset horchen + $('#fehlertypenset input[type=checkbox]').change(function() {setTimeout(function(){ + //console.log("aenderung!"); + var activeFehlertypes = new Array(); + var newMaxFehler = 0; + + $('#fehlertypenset > .active').each(function(){ + activeFehlertypes.push($(this).attr("id")); + }); + + + $.each(activeFehlertypes,function(key, name){ + //Neuen MaxFehler berechnen + newMaxFehler = newMaxFehler + parseInt($('#maxFehler').attr(name)); + }); + + $('.hasFehler').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); + $('.maxFehlerMapping').trigger('calcColor', [ newMaxFehler, activeFehlertypes ]); + },100)}); + }); + }); +});