Project

General

Profile

« Previous | Next » 

Revision d477dbb1

Added by Phil Davis over 9 years ago

Use IEC MiB units on dashboard

1) physmem calculation is already in MiB
2) swapinfo -m actually reports in MiB - good
3) The code that gathers the disk space data already uses "df -h" which reports in IEC units, but the output just has the single char "M", "G" etc. We can always add "iB" here.
As it happens all these numbers are already in powers of 1024 - it just needs the "iB" to be explicitly shown.

View differences:

src/usr/local/www/widgets/widgets/system_information.widget.php
269 269
					<div id="memUsagePB" class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?=$memUsage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$memUsage?>%">
270 270
					</div>
271 271
				</div>
272
				<span id="memusagemeter"><?=$memUsage?></span><span>% of <?= sprintf("%.0f", get_single_sysctl('hw.physmem') / (1024*1024)) ?> MB</span>
272
				<span id="memusagemeter"><?=$memUsage?></span><span>% of <?= sprintf("%.0f", get_single_sysctl('hw.physmem') / (1024*1024)) ?> MiB</span>
273 273
			</td>
274 274
		</tr>
275 275
		<?php if ($showswap == true): ?>
......
281 281
					<div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?=$swapusage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$swapusage?>%">
282 282
					</div>
283 283
				</div>
284
				<span><?=$swapusage?>% of <?= sprintf("%.0f", `/usr/sbin/swapinfo -m | /usr/bin/grep -v Device | /usr/bin/awk '{ print $2;}'`) ?> MB</span>
284
				<span><?=$swapusage?>% of <?= sprintf("%.0f", `/usr/sbin/swapinfo -m | /usr/bin/grep -v Device | /usr/bin/awk '{ print $2;}'`) ?> MiB</span>
285 285
			</td>
286 286
		</tr>
287 287
		<?php endif; ?>
......
293 293
					<tr>
294 294
						<th><?=$fs['mountpoint']?></th>
295 295
						<td><?=$fs['type'] . ("md" == substr(basename($fs['device']), 0, 2) ? " " . gettext("in RAM") : "")?></td>
296
						<td><?=$fs['total_size']?></td>
296
						<td><?=$fs['total_size']?>iB</td>
297 297
						<td>
298 298
							<span><?=$fs['percent_used']?>%</span>
299 299
						</td>

Also available in: Unified diff