diff --git a/CHANGELOG.md b/CHANGELOG.md index 286b7d7..7fd5cc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log -## [v2.1.0](https://github.com/bvanhoekelen/performance/tree/v2.0.1) - 2017-06-28 +## [v2.2.0](https://github.com/bvanhoekelen/performance/tree/v2.2.0) - 2017-07-17 +### Added +- In the web interface can be hidden and the preference is store. + +## [v2.1.0](https://github.com/bvanhoekelen/performance/tree/v2.1.0) - 2017-06-28 ### Added - Run user and process id information. diff --git a/composer.json b/composer.json index b3de0a3..df1d621 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "authors": [ { "name": "B. van Hoekelen", - "homepage": "https://github.com/bvanhoekelen/performace" + "homepage": "https://github.com/bvanhoekelen/performance" } ], "require": { diff --git a/src/Config.php b/src/Config.php index ff2f92d..1095ff9 100644 --- a/src/Config.php +++ b/src/Config.php @@ -137,6 +137,4 @@ public static function instanceReset() { self::$config = null; } - - } \ No newline at end of file diff --git a/src/Lib/Handlers/ConfigHandler.php b/src/Lib/Handlers/ConfigHandler.php index dc20b71..47c0da7 100644 --- a/src/Lib/Handlers/ConfigHandler.php +++ b/src/Lib/Handlers/ConfigHandler.php @@ -48,7 +48,7 @@ public function getAllItemNames() private function setDefaultTimeZone() { // Check date function - if( ! ini_get('date.timezone') ) + if( ! ini_get('date.timezone')) date_default_timezone_set('UTC'); } @@ -255,9 +255,4 @@ public function isRunInformation() { return $this->runInformation; } - - - - - } \ No newline at end of file diff --git a/src/Lib/Handlers/ExportHandler.php b/src/Lib/Handlers/ExportHandler.php index b44abf9..2823c60 100644 --- a/src/Lib/Handlers/ExportHandler.php +++ b/src/Lib/Handlers/ExportHandler.php @@ -91,7 +91,6 @@ public function toJson() $points[] = $point->export(); } - if($multiExport) $return['points'] = $points; else @@ -104,6 +103,4 @@ public function toJson() // Return return json_encode($return); } - -} - +} \ No newline at end of file diff --git a/src/Lib/Handlers/PerformanceHandler.php b/src/Lib/Handlers/PerformanceHandler.php index 151ab06..8784122 100644 --- a/src/Lib/Handlers/PerformanceHandler.php +++ b/src/Lib/Handlers/PerformanceHandler.php @@ -11,7 +11,7 @@ class PerformanceHandler /* * Version */ - const VERSION = '2.1.0'; + const VERSION = '2.2.0'; /* * Hold point stack @@ -285,7 +285,5 @@ private function checkAndSetMessageInToLabel(Point $point) // Reset $this->messageToLabel = ''; - } - } \ No newline at end of file diff --git a/src/Lib/Holders/CalculateTotalHolder.php b/src/Lib/Holders/CalculateTotalHolder.php index 854fe94..32a31b4 100644 --- a/src/Lib/Holders/CalculateTotalHolder.php +++ b/src/Lib/Holders/CalculateTotalHolder.php @@ -18,6 +18,4 @@ public function __construct($totalTime, $totalMemory, $totalMemoryPeak) $this->totalMemory = $totalMemory; $this->totalMemoryPeak = $totalMemoryPeak; } - - } \ No newline at end of file diff --git a/src/Lib/Holders/InformationHolder.php b/src/Lib/Holders/InformationHolder.php index de63892..6b30a24 100644 --- a/src/Lib/Holders/InformationHolder.php +++ b/src/Lib/Holders/InformationHolder.php @@ -1,6 +1,5 @@ currentUser = '?'; $this->currentProcessId = '?'; - // Set current user try{ $this->currentUser = get_current_user(); diff --git a/src/Lib/Point.php b/src/Lib/Point.php index 1b3e529..109f385 100644 --- a/src/Lib/Point.php +++ b/src/Lib/Point.php @@ -9,7 +9,6 @@ class Point implements ExportInterface const POINT_CALIBRATE = 'Calibrate point'; private $config; - private $active; private $label; private $startTime; @@ -266,5 +265,4 @@ public function addNewLineMessage($newLineMessage) { $this->newLineMessage[] = $newLineMessage; } - } \ No newline at end of file diff --git a/src/Lib/Presenters/Calculate.php b/src/Lib/Presenters/Calculate.php index 4cd21c8..b0a38da 100644 --- a/src/Lib/Presenters/Calculate.php +++ b/src/Lib/Presenters/Calculate.php @@ -2,7 +2,6 @@ use Performance\Lib\Holders\CalculateTotalHolder; - class Calculate { /* @@ -21,7 +20,7 @@ public function totalTimeAndMemory($pointStack) $max_memory += $point->getDifferenceMemory(); } - return new CalculateTotalHolder($max_time, $max_memory, memory_get_peak_usage(true));; + return new CalculateTotalHolder($max_time, $max_memory, memory_get_peak_usage(true)); } /* diff --git a/src/Lib/Presenters/ConsolePresenter.php b/src/Lib/Presenters/ConsolePresenter.php index 6619716..7f15449 100644 --- a/src/Lib/Presenters/ConsolePresenter.php +++ b/src/Lib/Presenters/ConsolePresenter.php @@ -161,12 +161,10 @@ private function clearScreen() private function printPointNewLineMessage(Point $point) { if(count($point->getNewLineMessage())) - { foreach ($point->getNewLineMessage() as $message) { $this->printMessage($message); } - } } public function printMessage($message = null, $time = '-- ', $memory = '-- ', $peak = '-- ') diff --git a/src/Lib/Presenters/DisplayHtml.css b/src/Lib/Presenters/DisplayHtml.css index 3eb2982..aa96a26 100644 --- a/src/Lib/Presenters/DisplayHtml.css +++ b/src/Lib/Presenters/DisplayHtml.css @@ -1,11 +1,11 @@ -.performance *{ +#performance-tool *{ box-sizing: border-box; margin: 0; padding: 0; font-family: Times; } -.performance{ +#performance-tool{ display: block; position: fixed; border: solid #ccc 1px; @@ -25,7 +25,7 @@ body{ margin-bottom: 350px; } - .performance { + #performance-tool { bottom: 0px; left: 0; right: 0; @@ -34,68 +34,83 @@ } } -.performance .overflow{ +#performance-tool .overflow{ overflow: auto; height: 77%; border-top: solid #bababa 1px; } -.performance .table-title{ +#performance-tool .table-title{ width: 100%; background-color: #fff; } -.performance .table-title td{ +#performance-tool .table-title td{ text-align: center; padding: 8px; font-size: 28px; } -.performance .table-point .t-l{ +#performance-tool .table-point .t-l{ text-align: left; } -.performance .table-point .new-line-message{ +#performance-tool .table-point .new-line-message{ color: #333; text-align: left; padding-left: 14px; } -.performance .table-title td span{ +#performance-tool .table-title td span{ font-size: 12px; } -.performance .table-point { +#performance-tool .table-point { width: 100%; } -.performance .table-point th{ +#performance-tool .table-point th{ background-color: #e2e2e2; } -.performance .table-point tr:nth-child(odd) { +#performance-tool .table-point tr:nth-child(odd) { background-color: #f2f2f2; } -.performance .table-point tr:hover{ +#performance-tool .table-point tr:hover{ background-color: #e2e2e2; } -.performance .table-point td{ +#performance-tool .table-point td{ padding: 4px; text-align: right; } -.performance .table-more-info{ +#performance-tool .table-more-info{ border-top: solid #ccc 2px; color: #555; padding: 14px 10px; text-align: center; } -.performance code { +#performance-tool code { background-color: #2b542c; margin: 20px; padding: 20px; display: block; background:#F8F8FF; border:black dashed 1px; +} + +#performance-btn-close{ + position: absolute; + right: 0; + top: 0; + margin: 0px; + padding: 10px; + color: #ccc; + text-decoration: none; + border-radius: 100%; +} + +#performance-btn-close:hover{ + color: #e09a0f; } \ No newline at end of file diff --git a/src/Lib/Presenters/DisplayScript.js b/src/Lib/Presenters/DisplayScript.js new file mode 100644 index 0000000..60c6350 --- /dev/null +++ b/src/Lib/Presenters/DisplayScript.js @@ -0,0 +1,37 @@ +// Set web store +if (typeof(Storage) !== "undefined") +{ + if( ! localStorage.performanceToolDisplay) + localStorage.performanceToolDisplay = 'show'; + + if(localStorage.performanceToolDisplay == 'hide') + performanceDisplayToggle(false); +} + + +function performanceDisplayToggle(show) +{ + x = document.getElementById('hiddenContent'); + y = document.getElementById('performance-tool'); + z = document.getElementById('performance-btn-close'); + status = null; + if( x.style.display == 'none' || show == true) + { + x.style.display = 'block'; + y.style.height = 300; + y.style.maxWidth = 500; + z.innerHTML = '▼'; + status = 'show'; + } + else + { + x.style.display = 'none'; + y.style.height = 40; + y.style.maxWidth = 36; + z.innerHTML = '▲'; + status = 'hide'; + } + + if(typeof(Storage) !== "undefined" && show == null) + localStorage.performanceToolDisplay = status; +} \ No newline at end of file diff --git a/src/Lib/Presenters/Formatter.php b/src/Lib/Presenters/Formatter.php index 68daf98..848395f 100644 --- a/src/Lib/Presenters/Formatter.php +++ b/src/Lib/Presenters/Formatter.php @@ -2,9 +2,7 @@ class Formatter { - public function __construct() - { - } + public function __construct(){} public function timeToHuman($microTime, $unit = 'auto', $decimals = 2) { diff --git a/src/Lib/Presenters/WebPresenter.php b/src/Lib/Presenters/WebPresenter.php index 085f148..f3ea13d 100644 --- a/src/Lib/Presenters/WebPresenter.php +++ b/src/Lib/Presenters/WebPresenter.php @@ -5,11 +5,9 @@ class WebPresenter extends Presenter { - public function bootstrap() - {} + public function bootstrap(){} - public function finishPointTrigger(Point $point) - {} + public function finishPointTrigger(Point $point){} public function displayResultsTrigger($pointStack) { @@ -45,73 +43,81 @@ private function displayForWebAsHtml() include_once 'DisplayHtml.css'; echo ''; - echo '
' . $this->formatter->memoryToHuman($calculateTotalHolder->totalMemory) . ' Max memory ' . ini_get("memory_limit") . ' |
- ' . $this->formatter->timeToHuman($calculateTotalHolder->totalTime) . ' Max time ' . $textExecutionTime . ' on PHP ' . phpversion() . ' |
-
Label | -% | -Memory | -% | -Time | -
---|---|---|---|---|
' . $point->getLabel() . ' | ' - . '' . $this->calculate->calculatePercentage($point->getDifferenceMemory(), $calculateTotalHolder->totalMemory) . ' | ' - . '' . $this->formatter->memoryToHuman($point->getDifferenceMemory()) . ' | ' - . '' . $this->calculate->calculatePercentage($point->getDifferenceTime(), $calculateTotalHolder->totalTime) . ' | ' - . '' . $this->formatter->timeToHuman($point->getDifferenceTime()) . ' | ' - . '
Performance::point()
Final you can view the results with the results command:Performance::results()
Performance::point()
Final you can view the results with the results command:Performance::results()