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.
This commit is contained in:
+13
-4
@@ -10497,24 +10497,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;
|
||||
|
||||
@@ -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;}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user