From 08caae5b22fd65f2d5e91ff5e84eb4faf992b30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Tue, 12 Feb 2013 22:27:55 +0100 Subject: [PATCH] MDL-37997 Improve the display of MUC caches used in the footer Cache stores with no hits and some misses are highlighted in red. Caches stores with some hits but more misses are highlighted in yellow. Otherwise (more hits than misses) the stores are highlighted in green. --- lib/moodlelib.php | 17 +++++++++++++---- theme/base/style/core.css | 11 ++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index cd7b102685c..7a3b4fda366 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -10497,24 +10497,33 @@ function get_performance_info() { if ($stats = cache_helper::get_stats()) { $html = ''; - $html .= 'Caches interaction by definition then store'; + $html .= 'Caches used (hits/misses/sets)'; $text = 'Caches used (hits/misses/sets): '; $hits = 0; $misses = 0; $sets = 0; foreach ($stats as $definition => $stores) { - $html .= ''.$definition.''; + $html .= ''; + $html .= ''.$definition.''; $text .= "$definition {"; foreach ($stores as $store => $data) { $hits += $data['hits']; $misses += $data['misses']; $sets += $data['sets']; + if ($data['hits'] == 0 and $data['misses'] > 0) { + $cachestoreclass = 'nohits'; + } else if ($data['hits'] < $data['misses']) { + $cachestoreclass = 'lowhits'; + } else { + $cachestoreclass = 'hihits'; + } $text .= "$store($data[hits]/$data[misses]/$data[sets]) "; - $html .= "$store: $data[hits] / $data[misses] / $data[sets]"; + $html .= "$store: $data[hits] / $data[misses] / $data[sets]"; } + $html .= ''; $text .= '} '; } - $html .= "Total Hits / Misses / Sets : $hits / $misses / $sets"; + $html .= "Total: $hits / $misses / $sets"; $html .= ' '; $info['cachesused'] = "$hits / $misses / $sets"; $info['html'] .= $html; diff --git a/theme/base/style/core.css b/theme/base/style/core.css index 819f38c0955..9a687b3e0f2 100644 --- a/theme/base/style/core.css +++ b/theme/base/style/core.css @@ -206,10 +206,15 @@ a.skip:active {position: static;display: block;} #page-footer .validators ul li {display:inline;margin-right:10px;margin-left:10px;} .performanceinfo .cachesused {margin-top:1em;} -.performanceinfo .cachesused .cache-stats-heading {font-weight: bold;text-decoration: underline;font-size:110%;} -.performanceinfo .cachesused .cache-definition-stats {font-weight:bold;margin-top:0.3em;} +.performanceinfo .cachesused .cache-stats-heading {font-weight: bold;} +.performanceinfo .cachesused .cache-definition-stats {margin:0.3em; padding:0px;border:1px solid #999;float:left;min-height:4em;} +.performanceinfo .cachesused .cache-definition-stats span {padding-left:0.5em;padding-right:0.5em} +.performanceinfo .cachesused .cache-definition-stats .cache-definition-stats-heading {background-color:#eee;} .performanceinfo .cachesused .cache-store-stats {text-indent: 1em;} -.performanceinfo .cachesused .cache-total-stats {font-weight:bold;margin-top:0.3em;} +.performanceinfo .cachesused .cache-store-stats.nohits {background-color:#ffd3d9;} +.performanceinfo .cachesused .cache-store-stats.lowhits {background-color:#f3f2aa;} +.performanceinfo .cachesused .cache-store-stats.hihits {background-color:#e7f1c3;} +.performanceinfo .cachesused .cache-total-stats {clear:both;font-weight:bold;margin-top:0.3em;} #course-footer {clear:both;}