Changeset 517 for trunk/admin/xcache.php
- Timestamp:
- 2008-02-17T11:52:38+01:00 (5 years ago)
- File:
-
- 1 edited
-
trunk/admin/xcache.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/xcache.php
r421 r517 73 73 74 74 return '0 s'; 75 } 76 77 function freeblock_to_graph($freeblocks, $size) 78 { 79 global $free_graph_width; 80 81 // cached in static variable 82 static $graph_initial; 83 if (!isset($graph_initial)) { 84 for ($i = 0; $i < $free_graph_width; $i ++) { 85 $graph_initial[$i] = 0; 86 } 87 } 88 $graph = $graph_initial; 89 foreach ($freeblocks as $b) { 90 $begin = $b['offset'] / $size * $free_graph_width; 91 $end = ($b['offset'] + $b['size']) / $size * $free_graph_width; 92 93 $graph[(int) $begin] += 1 - ($begin - (int) $begin); 94 $graph[(int) $end] += ($end - (int) $end); 95 for ($i = (int) $begin + 1, $e = (int) $end; $i < $e; $i ++) { 96 $graph[$i] = 1; 97 } 98 } 99 $html = array(); 100 $c = 255; 101 foreach ($graph as $k => $v) { 102 $v = (int) ($v * $c); 103 $r = $g = $c - $v; 104 $b = $c; 105 $html[] = '<div style="background: rgb(' . "$r,$g,$b" . ')"></div>'; 106 } 107 return implode('', $html); 75 108 } 76 109
Note: See TracChangeset
for help on using the changeset viewer.

