Merge branch 'MDL-37997-muc-stats-display' of git://github.com/mudrd8mz/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 18 Feb 2013 08:17:06 +0000 (16:17 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 18 Feb 2013 08:17:06 +0000 (16:17 +0800)
lib/moodlelib.php
theme/base/style/core.css

index fa53943..6890a83 100644 (file)
@@ -10665,24 +10665,33 @@ function get_performance_info() {
 
     if ($stats = cache_helper::get_stats()) {
         $html = '<span class="cachesused">';
-        $html .= '<span class="cache-stats-heading">Caches interaction by definition then store</span>';
+        $html .= '<span class="cache-stats-heading">Caches used (hits/misses/sets)</span>';
         $text = 'Caches used (hits/misses/sets): ';
         $hits = 0;
         $misses = 0;
         $sets = 0;
         foreach ($stats as $definition => $stores) {
-            $html .= '<span class="cache-definition-stats">'.$definition.'</span>';
+            $html .= '<span class="cache-definition-stats">';
+            $html .= '<span class="cache-definition-stats-heading">'.$definition.'</span>';
             $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 .= "<span class='cache-store-stats'>$store: $data[hits] / $data[misses] / $data[sets]</span>";
+                $html .= "<span class=\"cache-store-stats $cachestoreclass\">$store: $data[hits] / $data[misses] / $data[sets]</span>";
             }
+            $html .= '</span>';
             $text .= '} ';
         }
-        $html .= "<span class='cache-total-stats'>Total Hits / Misses / Sets : $hits / $misses / $sets</span>";
+        $html .= "<span class='cache-total-stats'>Total: $hits / $misses / $sets</span>";
         $html .= '</span> ';
         $info['cachesused'] = "$hits / $misses / $sets";
         $info['html'] .= $html;
index fff7e37..4f0c539 100644 (file)
@@ -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;}