@Override public long getSchedulingPeriod(final TimeUnit timeUnit) { if (schedulingStrategy == SchedulingStrategy.TIMER_DRIVEN) { return FormatUtils.getTimeDuration(schedulingPeriod, timeUnit); } return -1L; }
public String calculateDataRate(final long bytes) { final double seconds = (double) duration / 1000000000.0D; final long dataSize = (long) (bytes / seconds); return FormatUtils.formatDataSize(dataSize) + "/sec"; }
private String toDiff(final long oldValue, final long newValue, final boolean formatDataSize, final boolean formatTime) { if (formatDataSize && formatTime) { throw new IllegalArgumentException("Cannot format units as both data size and time"); } final long diff = Math.abs(newValue - oldValue); final String formattedDiff = formatDataSize ? FormatUtils.formatDataSize(diff) : (formatTime ? FormatUtils.formatHoursMinutesSeconds(diff, TimeUnit.NANOSECONDS) : String.valueOf(diff)); if (oldValue > newValue) { return " (-" + formattedDiff + ")"; } else { return " (+" + formattedDiff + ")"; } }
clientDto.setCurrent(FormatUtils.formatCount(currentCount) + " / " + FormatUtils.formatDataSize(currentSize)); clientDto.setDropped(FormatUtils.formatCount(droppedCount) + " / " + FormatUtils.formatDataSize(droppedSize)); clientDto.setOriginalCount(originalCount); clientDto.setOriginalSize(originalSize); clientDto.setOriginal(FormatUtils.formatCount(originalCount) + " / " + FormatUtils.formatDataSize(originalSize));
snapshot.setMaxHeap(FormatUtils.formatDataSize(sysDiagnostics.getMaxHeap())); snapshot.setMaxHeapBytes(sysDiagnostics.getMaxHeap()); snapshot.setTotalHeap(FormatUtils.formatDataSize(sysDiagnostics.getTotalHeap())); snapshot.setTotalHeapBytes(sysDiagnostics.getTotalHeap()); snapshot.setUsedHeap(FormatUtils.formatDataSize(sysDiagnostics.getUsedHeap())); snapshot.setUsedHeapBytes(sysDiagnostics.getUsedHeap()); snapshot.setFreeHeap(FormatUtils.formatDataSize(sysDiagnostics.getFreeHeap())); snapshot.setFreeHeapBytes(sysDiagnostics.getFreeHeap()); if (sysDiagnostics.getHeapUtilization() != -1) { snapshot.setHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getHeapUtilization())); snapshot.setMaxNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getMaxNonHeap())); snapshot.setMaxNonHeapBytes(sysDiagnostics.getMaxNonHeap()); snapshot.setTotalNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getTotalNonHeap())); snapshot.setTotalNonHeapBytes(sysDiagnostics.getTotalNonHeap()); snapshot.setUsedNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getUsedNonHeap())); snapshot.setUsedNonHeapBytes(sysDiagnostics.getUsedNonHeap()); snapshot.setFreeNonHeap(FormatUtils.formatDataSize(sysDiagnostics.getFreeNonHeap())); snapshot.setFreeNonHeapBytes(sysDiagnostics.getFreeNonHeap()); if (sysDiagnostics.getNonHeapUtilization() != -1) { snapshot.setNonHeapUtilization(FormatUtils.formatUtilization(sysDiagnostics.getNonHeapUtilization())); snapshot.setUptime(FormatUtils.formatHoursMinutesSeconds(sysDiagnostics.getUptime(), TimeUnit.MILLISECONDS));
public static void updatePrettyPrintedFields(final StorageUsageDTO target) { target.setFreeSpace(FormatUtils.formatDataSize(target.getFreeSpaceBytes())); target.setTotalSpace(FormatUtils.formatDataSize(target.getTotalSpaceBytes())); target.setUsedSpace(FormatUtils.formatDataSize(target.getUsedSpaceBytes())); if (target.getTotalSpaceBytes() != -1) { target.setUtilization(FormatUtils.formatUtilization(getUtilization(target.getUsedSpaceBytes(), target.getTotalSpaceBytes()))); } }
public static void updatePrettyPrintedFields(final GarbageCollectionDTO target) { target.setCollectionTime(FormatUtils.formatHoursMinutesSeconds(target.getCollectionMillis(), TimeUnit.MILLISECONDS)); }
public static String formatCount(final Integer intStatus) { if (intStatus == null) { return EMPTY_COUNT; } if (intStatus == 0) { return ZERO_COUNT; } return FormatUtils.formatCount(intStatus); }
dto.setDroppedCount(dropped.getObjectCount()); dto.setDroppedSize(dropped.getByteCount()); dto.setDropped(FormatUtils.formatCount(dropped.getObjectCount()) + " / " + FormatUtils.formatDataSize(dropped.getByteCount())); dto.setCurrent(FormatUtils.formatCount(current.getObjectCount()) + " / " + FormatUtils.formatDataSize(current.getByteCount())); dto.setOriginal(FormatUtils.formatCount(original.getObjectCount()) + " / " + FormatUtils.formatDataSize(original.getByteCount()));
public static void updatePrettyPrintedFields(final SystemDiagnosticsSnapshotDTO target) { // heap target.setMaxHeap(FormatUtils.formatDataSize(target.getMaxHeapBytes())); target.setTotalHeap(FormatUtils.formatDataSize(target.getTotalHeapBytes())); target.setUsedHeap(FormatUtils.formatDataSize(target.getUsedHeapBytes())); target.setFreeHeap(FormatUtils.formatDataSize(target.getFreeHeapBytes())); if (target.getMaxHeapBytes() != -1) { target.setHeapUtilization(FormatUtils.formatUtilization(getUtilization(target.getUsedHeapBytes(), target.getMaxHeapBytes()))); } // non heap target.setMaxNonHeap(FormatUtils.formatDataSize(target.getMaxNonHeapBytes())); target.setTotalNonHeap(FormatUtils.formatDataSize(target.getTotalNonHeapBytes())); target.setUsedNonHeap(FormatUtils.formatDataSize(target.getUsedNonHeapBytes())); target.setFreeNonHeap(FormatUtils.formatDataSize(target.getFreeNonHeapBytes())); if (target.getMaxNonHeapBytes() != -1) { target.setNonHeapUtilization(FormatUtils.formatUtilization(getUtilization(target.getUsedNonHeapBytes(), target.getMaxNonHeapBytes()))); } }
/** * Creates a GarbageCollectionDTO from the specified GarbageCollection. * * @param name name * @param garbageCollection gc * @return dto */ public SystemDiagnosticsSnapshotDTO.GarbageCollectionDTO createGarbageCollectionDTO(final String name, final GarbageCollection garbageCollection) { final SystemDiagnosticsSnapshotDTO.GarbageCollectionDTO dto = new SystemDiagnosticsSnapshotDTO.GarbageCollectionDTO(); dto.setName(name); dto.setCollectionCount(garbageCollection.getCollectionCount()); dto.setCollectionTime(FormatUtils.formatHoursMinutesSeconds(garbageCollection.getCollectionTime(), TimeUnit.MILLISECONDS)); dto.setCollectionMillis(garbageCollection.getCollectionTime()); return dto; }
public static void merge(final CounterDTO target, final CounterDTO toMerge) { target.setValueCount(target.getValueCount() + toMerge.getValueCount()); target.setValue(FormatUtils.formatCount(target.getValueCount())); }
@Override public int getCommunicationsTimeout(final TimeUnit timeUnit) { return (int) FormatUtils.getTimeDuration(communicationsTimeout, timeUnit); }
public static String formatDataSize(final Long longStatus) { if (longStatus == null) { return EMPTY_BYTES; } if (longStatus == 0L) { return ZERO_BYTES; } return FormatUtils.formatDataSize(longStatus); }
nodeDto.setNodeStartTime(new Date(nodeHeartbeat.getSystemStartTime())); nodeDto.setActiveThreadCount(nodeHeartbeat.getActiveThreadCount()); nodeDto.setQueued(FormatUtils.formatCount(nodeHeartbeat.getFlowFileCount()) + " / " + FormatUtils.formatDataSize(nodeHeartbeat.getFlowFileBytes()));
flowDiagnosticsDto.setBundlesLoaded(bundlesLoaded); flowDiagnosticsDto.setTimeZone(System.getProperty("user.timezone")); flowDiagnosticsDto.setUptime(FormatUtils.formatHoursMinutesSeconds(systemDiagnostics.getUptime(), TimeUnit.MILLISECONDS)); systemDiagnosticsDto.setOpenFileDescriptors(systemDiagnostics.getOpenFileHandles()); systemDiagnosticsDto.setPhysicalMemoryBytes(systemDiagnostics.getTotalPhysicalMemory()); systemDiagnosticsDto.setPhysicalMemory(FormatUtils.formatDataSize(systemDiagnostics.getTotalPhysicalMemory())); usageDto.setFreeSpace(FormatUtils.formatDataSize(usage.getFreeSpace())); usageDto.setFreeSpaceBytes(usage.getFreeSpace()); usageDto.setTotalSpace(FormatUtils.formatDataSize(usage.getTotalSpace())); usageDto.setTotalSpaceBytes(usage.getTotalSpace()); usageDto.setFreeSpace(FormatUtils.formatDataSize(usage.getFreeSpace())); usageDto.setFreeSpaceBytes(usage.getFreeSpace()); usageDto.setTotalSpace(FormatUtils.formatDataSize(usage.getTotalSpace())); usageDto.setTotalSpaceBytes(usage.getTotalSpace()); flowFileRepoUsage.setFreeSpace(FormatUtils.formatDataSize(usage.getFreeSpace())); flowFileRepoUsage.setFreeSpaceBytes(usage.getFreeSpace()); flowFileRepoUsage.setTotalSpace(FormatUtils.formatDataSize(usage.getTotalSpace())); flowFileRepoUsage.setTotalSpaceBytes(usage.getTotalSpace()); systemDiagnosticsDto.setFlowFileRepositoryStorageUsage(flowFileRepoUsage); systemDiagnosticsDto.setMaxHeapBytes(systemDiagnostics.getMaxHeap()); systemDiagnosticsDto.setMaxHeap(FormatUtils.formatDataSize(systemDiagnostics.getMaxHeap())); systemDiagnosticsDto.setProvenanceRepositoryStorageUsage(provRepoUsage);
/** * Creates a StorageUsageDTO from the specified StorageUsage. * * @param identifier id * @param storageUsage usage * @return dto */ public SystemDiagnosticsSnapshotDTO.StorageUsageDTO createStorageUsageDTO(final String identifier, final StorageUsage storageUsage) { final SystemDiagnosticsSnapshotDTO.StorageUsageDTO dto = new SystemDiagnosticsSnapshotDTO.StorageUsageDTO(); dto.setIdentifier(identifier); dto.setFreeSpace(FormatUtils.formatDataSize(storageUsage.getFreeSpace())); dto.setTotalSpace(FormatUtils.formatDataSize(storageUsage.getTotalSpace())); dto.setUsedSpace(FormatUtils.formatDataSize(storageUsage.getUsedSpace())); dto.setFreeSpaceBytes(storageUsage.getFreeSpace()); dto.setTotalSpaceBytes(storageUsage.getTotalSpace()); dto.setUsedSpaceBytes(storageUsage.getUsedSpace()); dto.setUtilization(FormatUtils.formatUtilization(storageUsage.getDiskUtilization())); return dto; }
public static void updatePrettyPrintedFields(final ProcessorStatusSnapshotDTO target) { target.setInput(prettyPrint(target.getFlowFilesIn(), target.getBytesIn())); target.setRead(formatDataSize(target.getBytesRead())); target.setWritten(formatDataSize(target.getBytesWritten())); target.setOutput(prettyPrint(target.getFlowFilesOut(), target.getBytesOut())); final Integer taskCount = target.getTaskCount(); final String tasks = (taskCount == null) ? "-" : formatCount(taskCount); target.setTasks(tasks); target.setTasksDuration(FormatUtils.formatHoursMinutesSeconds(target.getTasksDurationNanos(), TimeUnit.NANOSECONDS)); }
results.setTotal(FormatUtils.formatCount(clientDto.getRequest().getMaxResults().longValue()) + "+"); } else { results.setTotal(FormatUtils.formatCount(totalRecords)); results.setTotalCount(totalRecords);
@Override public long getAdministrativeYieldDuration(final TimeUnit timeUnit) { return FormatUtils.getTimeDuration(adminYieldDuration, timeUnit); }