/** * {@inheritDoc} */ @Override protected String valueToHumanReadableImpl(double value) { return NumberFormatter.humanReadableByteCount((long) (value * MEGABYTE_BYTE_COUNT)); }
/** * {@inheritDoc} */ @Override public void addPages() { String title = getWindowTitle(); long totalSize = 0; for (IStorageDataProvider storageDataProvider : storageDataProviders) { totalSize += storageDataProvider.getStorageData().getDiskSize(); } StringBuilder message = new StringBuilder("Options for downloading "); if (storageDataProviders.size() == 1) { StorageData storageData = storageDataProviders.iterator().next().getStorageData(); message.append("the storage '"); message.append(storageData.getName()); message.append("' (size: "); message.append(NumberFormatter.formatBytesToMBytes(storageData.getDiskSize())); message.append(')'); } else { message.append(storageDataProviders.size()); message.append(" storages (total size: "); message.append(NumberFormatter.formatBytesToMBytes(totalSize)); message.append(')'); } storageCompressionWizardPage = new StorageCompressionWizardPage(title, message.toString()); addPage(storageCompressionWizardPage); }
/** * Returns string representation of count and percentage. * * @param count * Count. * @param totalCount * Total count. * @return {@link String} representation. */ private String getCountAndPercentage(int count, int totalCount) { if (0 == totalCount) { return "0(0%)"; } return count + "(" + NumberFormatter.formatDouble(((double) count / totalCount) * 100, 0) + "%)"; }
stringBuilder.append(files.size()); stringBuilder.append(" ("); stringBuilder.append(NumberFormatter.humanReadableByteCount(totalBytesTransfered)); if (!gzipCompression) { stringBuilder.append(" out of "); stringBuilder.append(NumberFormatter.humanReadableByteCount(totalSize)); stringBuilder.append(NumberFormatter.humanReadableByteCount((long) getAverageTransferRate())); stringBuilder.append("/s) Remaining time: "); if (gzipCompression) { stringBuilder.append(NumberFormatter.humanReadableMillisCount(millisLeft, true)); subMonitor.subTask(stringBuilder.toString());
int occupancy = (int) ((100 * Math.round(bufferCurrentOccupancy)) / Math.round(bufferMaxOccupancy)); String occMb = NumberFormatter.humanReadableByteCount(cmrStatusData.getCurrentBufferSize()); String maxMb = NumberFormatter.humanReadableByteCount(cmrStatusData.getMaxBufferSize()); String string = occupancy + "% (" + occMb + " / " + maxMb + ")"; bufferSize.setText(string); bufferDate.setText(NumberFormatter.formatTime(oldestDataDate.getTime())); } else { bufferDate.setText("-"); StringBuilder spaceLeftStringBuilder = new StringBuilder(String.valueOf(spaceOccupancy)); spaceLeftStringBuilder.append("% ("); spaceLeftStringBuilder.append(NumberFormatter.humanReadableByteCount(cmrStatusData.getStorageDataSpaceLeft())); spaceLeftStringBuilder.append(" / "); spaceLeftStringBuilder.append(NumberFormatter.humanReadableByteCount(cmrStatusData.getStorageMaxDataSpace())); spaceLeftStringBuilder.append(')'); spaceLeftLabel.setText(spaceLeftStringBuilder.toString()); StringBuilder uptimeText = new StringBuilder(NumberFormatter.humanReadableMillisCount(uptimeMillis, true)); uptimeText.append(" (started "); uptimeText.append(NumberFormatter.formatTime(started)); uptimeText.append(')'); uptimeLabel.setText(uptimeText.toString()); databaseSizeLabel.setText(NumberFormatter.humanReadableByteCount(databaseSize.longValue())); } else { databaseSizeLabel.setText("n/a");
return new StyledString(NumberFormatter.formatTimeWithMillis(data.getTimeStamp())); } else { return emptyStyledString; return new StyledString(Long.toString(data.getCount())); case AVERAGE: return new StyledString(NumberFormatter.formatDouble(data.getAverage())); case MIN: return new StyledString(NumberFormatter.formatDouble(data.getMin())); case MAX: return new StyledString(NumberFormatter.formatDouble(data.getMax())); case DURATION: return new StyledString(NumberFormatter.formatDouble(data.getDuration())); case PREPARED: if (rawMode) {
return TextFormatter.getSpanOriginStyled(span, cachedDataService.getPlatformIdentForId(span.getPlatformIdent())); case TIME: return new StyledString(NumberFormatter.formatTimeWithMillis(span.getTimeStamp())); case DURATION: StyledString durationString = new StyledString(NumberFormatter.formatDouble(span.getDuration(), timeDecimalPlaces)); if (InvocationTreeUtil.isConsideredAsync(ite)) { durationString.append(TextFormatter.getWarningSign()); case EXCLUSIVE: StyledString exclusive = new StyledString(); exclusive.append(NumberFormatter.formatDouble(InvocationTreeUtil.calculateSpanExclusiveDuration(ite), timeDecimalPlaces)); exclusive.append(" (", StyledString.COUNTER_STYLER); int percentage = Math.round((float) InvocationTreeUtil.calculateSpanExclusivePercentage(ite) * 100); exclusive.append(NumberFormatter.formatInteger(percentage), StyledString.COUNTER_STYLER); exclusive.append("%)", StyledString.COUNTER_STYLER); if (InvocationTreeUtil.isConsideredAsync(ite)) {
return new StyledString(NumberFormatter.formatTimeWithMillis(data.getTimeStamp())); case METHOD: return TextFormatter.getStyledMethodString(methodIdent); case DURATION: if (InvocationSequenceDataHelper.hasTimerData(data)) { return new StyledString(NumberFormatter.formatDouble(data.getTimerData().getDuration())); } else { return new StyledString(NumberFormatter.formatDouble(data.getDuration())); return new StyledString(NumberFormatter.formatLong(data.getChildCount())); case URL: if (InvocationSequenceDataHelper.hasHttpTimerData(data)) {
DetailsCellContent[] total = new DetailsCellContent[] { new DetailsCellContent(NumberFormatter.formatLong(timerData.getCount())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getAverage())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getMin())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getMax())) }; table.addContentRow("Total:", null, total); DetailsCellContent[] cpu = new DetailsCellContent[] { new DetailsCellContent(NumberFormatter.formatLong(timerData.getCount())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getCpuAverage())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getCpuMin())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getCpuMax())) }; table.addContentRow("CPU:", null, cpu); DetailsCellContent[] exclusive = new DetailsCellContent[] { new DetailsCellContent(NumberFormatter.formatLong(timerData.getCount())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getExclusiveAverage())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getExclusiveMin())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getExclusiveMax())) }; table.addContentRow("Exclusive:", null, exclusive);
/** * Formats the time to a String value. * * @param time * The time as long value. * @return The formatted string. */ public static String formatTime(long time) { return formatTime(new Date(time)); }
uptime.setText(NumberFormatter.millisecondsToString(runtimeData.getUptime())); } else { uptime.setText(""); connectionTimeStamp.setText(NumberFormatter.formatTime(agentStatusData.getConnectionTimestamp())); lastKeepAliveTimeStamp.setText(NumberFormatter.formatTime(agentStatusData.getLastKeepAliveTimestamp()));
case TIMESTAMP: if (rawMode) { return new StyledString(NumberFormatter.formatTimeWithMillis(data.getTimeStamp())); } else { return emptyStyledString; case CREATED: if (!rawMode && (data instanceof AggregatedExceptionSensorData)) { return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getCreated())); } else if (ExceptionEvent.CREATED.equals(data.getExceptionEvent())) { return new StyledString("Yes"); return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getPassed())); } else if (ExceptionEvent.PASSED.equals(data.getExceptionEvent())) { return new StyledString("Yes"); return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getHandled())); } else if (ExceptionEvent.HANDLED.equals(data.getExceptionEvent())) { return new StyledString("Yes");
addItemToSection(toolkit, SECTION_MEMORY, "Max heap size: ", minTitleColumnWidth); if (data.getMaxHeapMemorySize() > 0) { addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(data.getMaxHeapMemorySize()), minInformationColumnWidth); } else { addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE, minInformationColumnWidth); addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(data.getMaxNonHeapMemorySize()), minInformationColumnWidth); } else { addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE, minInformationColumnWidth); addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(data.getTotalPhysMemory()), minInformationColumnWidth); } else { addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE, minInformationColumnWidth); addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(data.getTotalSwapSpace()), minInformationColumnWidth); } else { addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE, minInformationColumnWidth); addItemToSection(toolkit, SECTION_OS, "Available processors: ", minTitleColumnWidth); if (data.getAvailableProcessors() > 0) { addItemToSection(toolkit, SECTION_OS, NumberFormatter.formatInteger(data.getAvailableProcessors()), minInformationColumnWidth); } else { addItemToSection(toolkit, SECTION_OS, NOT_AVAILABLE, minInformationColumnWidth);
/** * {@inheritDoc} */ @Override protected void showDefaultValue() { text.setText(NumberFormatter.formatLong(property.getDefaultValue().longValue())); } }
/** * {@inheritDoc} */ @Override protected String valueToHumanReadableImpl(double value) { return NumberFormatter.formatDoubleToPercent(value / 100D); }
/** * Formats the time to a String value with milliseconds. * * @param time * The time as long value. * @return The formatted string. */ public static String formatTimeWithMillis(long time) { return formatTimeWithMillis(new Date(time)); }
styledString.append("Connected :: Last data sent " + NumberFormatter.humanReadableMillisCount(millis, true) + " ago", StyledString.DECORATIONS_STYLER); } else if (agentStatusData.getInstrumentationStatus() == InstrumentationStatus.NO_CLASS_CACHE_AVAILABLE) { styledString.append("Connected :: Sending data :: No class cache available", StyledString.DECORATIONS_STYLER); case NO_KEEP_ALIVE: long timeSinceLastKeepAlive = System.currentTimeMillis() - agentStatusData.getLastKeepAliveTimestamp(); styledString.append("No keep-alive signal for " + NumberFormatter.humanReadableMillisCount(timeSinceLastKeepAlive, true), StyledString.DECORATIONS_STYLER); break; case DISCONNECTED:
addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(systemData.getMaxHeapMemorySize())); } else { addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE); addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(systemData.getMaxNonHeapMemorySize())); } else { addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE); addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(systemData.getTotalPhysMemory())); } else { addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE); addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(systemData.getTotalSwapSpace())); } else { addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE);
case TIMESTAMP: if (rawMode) { return new StyledString(NumberFormatter.formatTimeWithMillis(data.getTimeStamp())); } else { return emptyStyledString; return new StyledString(NumberFormatter.formatDouble(data.getAverage())); } else { return emptyStyledString; return new StyledString(NumberFormatter.formatDouble(data.getMin())); } else { return emptyStyledString; return new StyledString(NumberFormatter.formatDouble(data.getMax())); } else { return emptyStyledString; return new StyledString(NumberFormatter.formatDouble(data.getDuration())); } else { return emptyStyledString; return new StyledString(NumberFormatter.formatDouble(data.getCpuAverage())); } else { return emptyStyledString; return new StyledString(NumberFormatter.formatDouble(data.getCpuMin())); } else { return emptyStyledString;
return new StyledString(NumberFormatter.formatLong(delta)); case DURATION: styledString = new StyledString(); double duration = InvocationSequenceDataHelper.calculateDuration(data, spanService); if (-1.0d != duration) { styledString.append(NumberFormatter.formatDouble(duration)); styledString = new StyledString(); if (InvocationSequenceDataHelper.hasTimerData(data) && data.getTimerData().isCpuMetricDataAvailable()) { styledString.append(NumberFormatter.formatDouble(data.getTimerData().getCpuDuration())); styledString.append(NumberFormatter.formatDouble(exclusiveTime));