com.google.common.base.Stopwatch.abbreviate()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中com.google.common.base.Stopwatch.abbreviate()方法的一些代码示例,展示了Stopwatch.abbreviate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stopwatch.abbreviate()方法的具体详情如下:
包路径:com.google.common.base.Stopwatch
类名称:Stopwatch
方法名:abbreviate

Stopwatch.abbreviate介绍

暂无

代码示例

代码示例来源:origin: google/guava

/** Returns a string representation of the current elapsed time. */
@Override
public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return Platform.formatCompact4Digits(value) + " " + abbreviate(unit);
}

代码示例来源:origin: thinkaurelius/titan

/**
 * Returns a string representation of the current elapsed time.
 */
@GwtIncompatible("String.format()")
@Override public String toString() {
  long nanos = elapsedNanos();
  TimeUnit unit = chooseUnit(nanos);
  double value = (double) nanos / NANOSECONDS.convert(1, unit);
  // Too bad this functionality is not exposed as a regular method call
  return String.format("%.4g %s", value, abbreviate(unit));
}

代码示例来源:origin: google/j2objc

/** Returns a string representation of the current elapsed time. */
@Override
public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return Platform.formatCompact4Digits(value) + " " + abbreviate(unit);
}

代码示例来源:origin: wildfly/wildfly

/** Returns a string representation of the current elapsed time. */
@Override
public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return Platform.formatCompact4Digits(value) + " " + abbreviate(unit);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava

/**
 * Returns a string representation of the current elapsed time.
 */
@GwtIncompatible("String.format()")
@Override public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return String.format("%.4g %s", value, abbreviate(unit));
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Returns a string representation of the current elapsed time.
 */
@GwtIncompatible("String.format()")
@Override public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return String.format("%.4g %s", value, abbreviate(unit));
}

代码示例来源:origin: com.google.guava/guava-jdk5

/**
 * Returns a string representation of the current elapsed time.
 */
@GwtIncompatible("String.format()")
@Override public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return String.format("%.4g %s", value, abbreviate(unit));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Returns a string representation of the current elapsed time.
 */
@GwtIncompatible("String.format()")
@Override public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return String.format("%.4g %s", value, abbreviate(unit));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Returns a string representation of the current elapsed time.
 */
@GwtIncompatible("String.format()")
@Override public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return String.format("%.4g %s", value, abbreviate(unit));
}

代码示例来源:origin: com.diffplug.guava/guava-core

/**
 * Returns a string representation of the current elapsed time.
 */
@GwtIncompatible("String.format()")
@Override
public String toString() {
  long nanos = elapsedNanos();
  TimeUnit unit = chooseUnit(nanos);
  double value = (double) nanos / NANOSECONDS.convert(1, unit);
  // Too bad this functionality is not exposed as a regular method call
  return String.format(Locale.ROOT, "%.4g %s", value, abbreviate(unit));
}

代码示例来源:origin: Nextdoor/bender

/**
 * Returns a string representation of the current elapsed time.
 */
@GwtIncompatible("String.format()")
@Override public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return String.format("%.4g %s", value, abbreviate(unit));
}

代码示例来源:origin: org.sonatype.sisu/sisu-guava

/**
 * Returns a string representation of the current elapsed time, choosing an
 * appropriate unit and using the specified number of significant figures.
 * For example, at the instant when {@code elapsedTime(NANOSECONDS)} would
 * return {1234567}, {@code toString(4)} returns {@code "1.235 ms"}.
 */
@GwtIncompatible("String.format()")
public String toString(int significantDigits) {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return String.format("%." + significantDigits + "g %s",
   value, abbreviate(unit));
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

/**
 * Returns a string representation of the current elapsed time, choosing an
 * appropriate unit and using the specified number of significant figures.
 * For example, at the instant when {@code elapsed(NANOSECONDS)} would
 * return {1234567}, {@code toString(4)} returns {@code "1.235 ms"}.
 *
 * @deprecated Use {@link #toString()} instead. This method is scheduled
 *     to be removed in Guava release 15.0.
 */
@Deprecated
@GwtIncompatible("String.format()")
public String toString(int significantDigits) {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return String.format("%." + significantDigits + "g %s",
   value, abbreviate(unit));
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/** Returns a string representation of the current elapsed time. */
@Override
public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return Platform.formatCompact4Digits(value) + " " + abbreviate(unit);
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

/** Returns a string representation of the current elapsed time. */
@Override
public String toString() {
 long nanos = elapsedNanos();
 TimeUnit unit = chooseUnit(nanos);
 double value = (double) nanos / NANOSECONDS.convert(1, unit);
 // Too bad this functionality is not exposed as a regular method call
 return Platform.formatCompact4Digits(value) + " " + abbreviate(unit);
}

相关文章