NIFI-1298: - Addressing too many significant digits in the processor load average and [non]heap utilization.

Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
Matt Gilman 2015-12-18 16:50:03 -05:00 committed by joewitt
parent 0436383f49
commit 43c7ecd221
4 changed files with 40 additions and 10 deletions

View File

@ -150,11 +150,19 @@ public class SystemDiagnostics implements Cloneable {
}
public int getHeapUtilization() {
return DiagnosticUtils.getUtilization(usedHeap, maxHeap);
if (maxHeap == -1) {
return -1;
} else {
return DiagnosticUtils.getUtilization(usedHeap, maxHeap);
}
}
public int getNonHeapUtilization() {
return DiagnosticUtils.getUtilization(usedNonHeap, maxNonHeap);
if (maxNonHeap == -1) {
return -1;
} else {
return DiagnosticUtils.getUtilization(usedNonHeap, maxNonHeap);
}
}
public Map<String, GarbageCollection> getGarbageCollection() {

View File

@ -1735,14 +1735,18 @@ public final class DtoFactory {
dto.setTotalHeap(FormatUtils.formatDataSize(sysDiagnostics.getTotalHeap()));
dto.setUsedHeap(FormatUtils.formatDataSize(sysDiagnostics.getUsedHeap()));
dto.setFreeHeap(FormatUtils.formatDataSize(sysDiagnostics.getFreeHeap()));
dto.setHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getHeapUtilization()));
if (sysDiagnostics.getHeapUtilization() != -1) {
dto.setHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getHeapUtilization()));
}
// non heap
dto.setMaxNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getMaxNonHeap()));
dto.setTotalNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getTotalNonHeap()));
dto.setUsedNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getUsedNonHeap()));
dto.setFreeNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getFreeNonHeap()));
dto.setNonHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getNonHeapUtilization()));
if (sysDiagnostics.getNonHeapUtilization() != -1) {
dto.setNonHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getNonHeapUtilization()));
}
// flow file disk usage
final SystemDiagnosticsDTO.StorageUsageDTO flowFileRepositoryStorageUsageDto = createStorageUsageDTO(null, sysDiagnostics.getFlowFileRepositoryStorageUsage());

View File

@ -29,7 +29,7 @@
<div class="settings-left">
<div class="setting">
<input type="hidden" id=""/>
<div class="setting-name">Heap (<span id="utilization-heap"></span>)</div>
<div class="setting-name">Heap <span id="utilization-heap"></span></div>
<div class="setting-field">
<table id="heap-table">
<tbody>
@ -57,7 +57,7 @@
</div>
<div class="settings-right">
<div class="setting">
<div class="setting-name">Non heap (<span id="utilization-non-heap"></span>)</div>
<div class="setting-name">Non heap <span id="utilization-non-heap"></span></div>
<div class="setting-field">
<table id="heap-table">
<tbody>

View File

@ -1999,14 +1999,26 @@ nf.SummaryTable = (function () {
$('#total-heap').text(systemDiagnostics.totalHeap);
$('#used-heap').text(systemDiagnostics.usedHeap);
$('#free-heap').text(systemDiagnostics.freeHeap);
$('#utilization-heap').text(systemDiagnostics.heapUtilization);
// ensure the heap utilization could be calculated
if (nf.Common.isDefinedAndNotNull(systemDiagnostics.heapUtilization)) {
$('#utilization-heap').text('(' + systemDiagnostics.heapUtilization + ')');
} else {
$('#utilization-heap').text('');
}
// non heap
$('#max-non-heap').text(systemDiagnostics.maxNonHeap);
$('#total-non-heap').text(systemDiagnostics.totalNonHeap);
$('#used-non-heap').text(systemDiagnostics.usedNonHeap);
$('#free-non-heap').text(systemDiagnostics.freeNonHeap);
$('#utilization-non-heap').text(systemDiagnostics.nonHeapUtilization);
// enure the non heap utilization could be calculated
if (nf.Common.isDefinedAndNotNull(systemDiagnostics.nonHeapUtilization)) {
$('#utilization-non-heap').text('(' + systemDiagnostics.nonHeapUtilization + ')');
} else {
$('#utilization-non-heap').text('');
}
// garbage collection
var garbageCollectionContainer = $('#garbage-collection-table tbody').empty();
@ -2014,9 +2026,15 @@ nf.SummaryTable = (function () {
addGarbageCollection(garbageCollectionContainer, garbageCollection);
});
// load
// available processors
$('#available-processors').text(systemDiagnostics.availableProcessors);
$('#processor-load-average').html(nf.Common.formatValue(systemDiagnostics.processorLoadAverage));
// load
if (nf.Common.isDefinedAndNotNull(systemDiagnostics.processorLoadAverage)) {
$('#processor-load-average').text(nf.Common.formatFloat(systemDiagnostics.processorLoadAverage));
} else {
$('#processor-load-average').html(nf.Common.formatValue(systemDiagnostics.processorLoadAverage));
}
// database storage usage
var flowFileRepositoryStorageUsageContainer = $('#flow-file-repository-storage-usage-container').empty();