Java Code Examples for io.airlift.units.Duration#getValue()
The following examples show how to use
io.airlift.units.Duration#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FormatUtils.java From presto with Apache License 2.0 | 6 votes |
public static String formatCountRate(double count, Duration duration, boolean longForm) { double rate = count / duration.getValue(SECONDS); if (Double.isNaN(rate) || Double.isInfinite(rate)) { rate = 0; } String rateString = formatCount((long) rate); if (longForm) { if (rateString.endsWith(" ")) { rateString = rateString.substring(0, rateString.length() - 1); } rateString += "/s"; } return rateString; }
Example 2
Source File: FormatUtils.java From presto with Apache License 2.0 | 6 votes |
public static String formatDataRate(DataSize dataSize, Duration duration, boolean longForm) { double rate = dataSize.toBytes() / duration.getValue(SECONDS); if (Double.isNaN(rate) || Double.isInfinite(rate)) { rate = 0; } String rateString = formatDataSize(DataSize.ofBytes(Math.round(rate)), false); if (longForm) { if (!rateString.endsWith("B")) { rateString += "B"; } rateString += "/s"; } return rateString; }
Example 3
Source File: FormatUtils.java From presto with Apache License 2.0 | 6 votes |
public static String formatCountRate(double count, Duration duration, boolean longForm) { double rate = count / duration.getValue(SECONDS); if (Double.isNaN(rate) || Double.isInfinite(rate)) { rate = 0; } String rateString = formatCount((long) rate); if (longForm) { if (rateString.endsWith(" ")) { rateString = rateString.substring(0, rateString.length() - 1); } rateString += "/s"; } return rateString; }
Example 4
Source File: ExpressionProfiler.java From presto with Apache License 2.0 | 5 votes |
@VisibleForTesting public ExpressionProfiler(Ticker ticker, Duration expensiveExpressionThreshold) { requireNonNull(ticker, "ticker is null"); requireNonNull(expensiveExpressionThreshold, "expensiveExpressionThreshold is null"); this.expensiveExpressionThresholdNanos = expensiveExpressionThreshold.getValue(NANOSECONDS); this.ticker = ticker; }
Example 5
Source File: ShardRecoveryManager.java From presto with Apache License 2.0 | 5 votes |
static DataSize dataRate(DataSize size, Duration duration) { double rate = size.toBytes() / duration.getValue(SECONDS); if (Double.isNaN(rate) || Double.isInfinite(rate)) { rate = 0; } return succinctBytes(Math.round(rate)); }
Example 6
Source File: StatusPrinter.java From presto with Apache License 2.0 | 4 votes |
public void printFinalInfo() { QueryStatusInfo results = client.finalStatusInfo(); StatementStats stats = results.getStats(); Duration wallTime = succinctDuration(stats.getElapsedTimeMillis(), MILLISECONDS); int nodes = stats.getNodes(); if ((nodes == 0) || (stats.getTotalSplits() == 0)) { return; } // blank line out.println(); // Query 12, FINISHED, 1 node String querySummary = format("Query %s, %s, %,d %s", results.getId(), stats.getState(), nodes, pluralize("node", nodes)); out.println(querySummary); if (debug) { out.println(results.getInfoUri().toString()); } // Splits: 1000 total, 842 done (84.20%) String splitsSummary = format("Splits: %,d total, %,d done (%.2f%%)", stats.getTotalSplits(), stats.getCompletedSplits(), stats.getProgressPercentage().orElse(0.0)); out.println(splitsSummary); if (debug) { // CPU Time: 565.2s total, 26K rows/s, 3.85MB/s Duration cpuTime = millis(stats.getCpuTimeMillis()); String cpuTimeSummary = format("CPU Time: %.1fs total, %5s rows/s, %8s, %d%% active", cpuTime.getValue(SECONDS), formatCountRate(stats.getProcessedRows(), cpuTime, false), formatDataRate(bytes(stats.getProcessedBytes()), cpuTime, true), (int) percentage(stats.getCpuTimeMillis(), stats.getWallTimeMillis())); out.println(cpuTimeSummary); double parallelism = cpuTime.getValue(MILLISECONDS) / wallTime.getValue(MILLISECONDS); // Per Node: 3.5 parallelism, 83.3K rows/s, 0.7 MB/s String perNodeSummary = format("Per Node: %.1f parallelism, %5s rows/s, %8s", parallelism / nodes, formatCountRate((double) stats.getProcessedRows() / nodes, wallTime, false), formatDataRate(bytes(stats.getProcessedBytes() / nodes), wallTime, true)); reprintLine(perNodeSummary); // Parallelism: 5.3 out.println(format("Parallelism: %.1f", parallelism)); // Peak Memory: 1.97GB reprintLine("Peak Memory: " + formatDataSize(bytes(stats.getPeakMemoryBytes()), true)); // Spilled Data: 20GB if (stats.getSpilledBytes() > 0) { reprintLine("Spilled: " + formatDataSize(bytes(stats.getSpilledBytes()), true)); } } // 0:32 [2.12GB, 15M rows] [67MB/s, 463K rows/s] String statsLine = format("%s [%s rows, %s] [%s rows/s, %s]", formatFinalTime(wallTime), formatCount(stats.getProcessedRows()), formatDataSize(bytes(stats.getProcessedBytes()), true), formatCountRate(stats.getProcessedRows(), wallTime, false), formatDataRate(bytes(stats.getProcessedBytes()), wallTime, true)); out.println(statsLine); // blank line out.println(); }