it.unimi.dsi.Util.formatSize()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(114)

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

Util.formatSize介绍

[英]Formats a size.

This method formats a long using suitable unit multipliers (e.g., K, M, G, and T) and printing just two fractional digits.
[中]设置大小。
这种方法使用合适的单位乘法器(例如,K、M、g和T)格式化长字符,并只打印两个小数位数。

代码示例

代码示例来源:origin: blazegraph/database

private String freeMemory() {
  return ( displayFreeMemory ? "; used/avail/free/total/max mem: " 
      + Util.formatSize( RUNTIME.totalMemory() - RUNTIME.freeMemory() ) + "/" 
      + Util.formatSize( RUNTIME.freeMemory() + ( RUNTIME.maxMemory() - RUNTIME.totalMemory() ) ) + "/" 
      + Util.formatSize( RUNTIME.freeMemory() ) + "/" 
      + Util.formatSize( RUNTIME.totalMemory() ) + "/" 
      + Util.formatSize( RUNTIME.maxMemory() ) : "" );
}

代码示例来源:origin: it.unimi.dsi/webgraph

if (external) info("Running " + this.numberOfThreads + " threads with a buffer of " + Util.formatSize(this.bufferSize) + " counters");
else info("Running " + this.numberOfThreads + " threads");

代码示例来源:origin: it.unimi.dsi/dsiutils

private String freeMemory() {
  return (displayFreeMemory ? "; used/avail/free/total/max mem: "
      + Util.formatSize(RUNTIME.totalMemory() - RUNTIME.freeMemory()) + "/"
      + Util.formatSize(RUNTIME.freeMemory() + (RUNTIME.maxMemory() - RUNTIME.totalMemory())) + "/"
      + Util.formatSize(RUNTIME.freeMemory()) + "/"
      + Util.formatSize(RUNTIME.totalMemory()) + "/"
      + Util.formatSize(RUNTIME.maxMemory()) : "");
}

代码示例来源:origin: com.blazegraph/dsi-utils

private String freeMemory() {
  return ( displayFreeMemory ? "; used/avail/free/total/max mem: " 
      + Util.formatSize( RUNTIME.totalMemory() - RUNTIME.freeMemory() ) + "/" 
      + Util.formatSize( RUNTIME.freeMemory() + ( RUNTIME.maxMemory() - RUNTIME.totalMemory() ) ) + "/" 
      + Util.formatSize( RUNTIME.freeMemory() ) + "/" 
      + Util.formatSize( RUNTIME.totalMemory() ) + "/" 
      + Util.formatSize( RUNTIME.maxMemory() ) : "" );
}

代码示例来源:origin: it.unimi.di/mg4j

private static String format( long v, long total ) {
  return v + " (" + Util.formatSize( v / 8 ) + "B, " + Util.format( 100. * v / total ) + "%)\n";
}

代码示例来源:origin: it.unimi.di/mg4j-big

private static String format( long v, long total ) {
  return v + " (" + Util.formatSize( v / 8 ) + "B, " + Util.format( 100. * v / total ) + "%)\n";
}

代码示例来源:origin: it.unimi.di/mg4j-big

@Override
public void printStats( PrintStream stats ) {
  stats.println( "Pointers" );
  stats.println( "=========" );
  stats.println( pointersStats );
  stats.println( "Bits per pointer: " + Util.format( (double)pointersStats.totalNonSkip() / numberOfPostings ) + " (" + Util.format( (double)pointersStats.total() / numberOfPostings )  + " with skips)"  );
  long size = pointersStats.total();
  if ( counts != null ) {
    stats.println();
    stats.println( "Counts" );
    stats.println( "=========" );
    stats.println( countsStats );
    stats.println( "Bits per count: " + Util.format( (double)countsStats.totalNonSkip() / numberOfPostings ) + " (" + Util.format( (double)countsStats.total() / numberOfPostings )  + " with skips)"  );
    size += countsStats.total();
    if ( positions != null ) {
      stats.println();
      stats.println( "Positions" );
      stats.println( "=========" );
      stats.println( positionsStats );
      stats.println( "Bits per position: " + Util.format( (double)positionsStats.totalNonSkip() / numberOfOccurrences ) + " (" + Util.format( (double)positionsStats.total() / numberOfOccurrences )  + " with skips)" );
      size += positionsStats.total();
    }
  }
  
  stats.println();
  stats.println( "Size: " + size + " bits (" + Util.formatSize( size / 8 ) + "B)" );
}

代码示例来源:origin: it.unimi.di/mg4j

@Override
public void printStats( PrintStream stats ) {
  stats.println( "Pointers" );
  stats.println( "=========" );
  stats.println( pointersStats );
  stats.println( "Bits per pointer: " + Util.format( (double)pointersStats.totalNonSkip() / numberOfPostings ) + " (" + Util.format( (double)pointersStats.total() / numberOfPostings )  + " with skips)"  );
  long size = pointersStats.total();
  if ( counts != null ) {
    stats.println();
    stats.println( "Counts" );
    stats.println( "=========" );
    stats.println( countsStats );
    stats.println( "Bits per count: " + Util.format( (double)countsStats.totalNonSkip() / numberOfPostings ) + " (" + Util.format( (double)countsStats.total() / numberOfPostings )  + " with skips)"  );
    size += countsStats.total();
    if ( positions != null ) {
      stats.println();
      stats.println( "Positions" );
      stats.println( "=========" );
      stats.println( positionsStats );
      stats.println( "Bits per position: " + Util.format( (double)positionsStats.totalNonSkip() / numberOfOccurrences ) + " (" + Util.format( (double)positionsStats.total() / numberOfOccurrences )  + " with skips)" );
      size += positionsStats.total();
    }
  }
  
  stats.println();
  stats.println( "Size: " + size + " bits (" + Util.formatSize( size / 8 ) + "B)" );
}

代码示例来源:origin: it.unimi.di/mg4j-big

public String toString() {
    final long total = total();
    return "Upper bits: " + format( bitsForUpperBits, total ) +
    "Lower bits: " + format( bitsForLowerBits, total ) +
    "Skip pointers bits: " + format( bitsForSkipPointers, total ) +
    "Additional bits: " + format( bitsForAdditional, total ) +
    "Overall bits: " + total + " (" + Util.formatSize( total / 8 ) + "B)\n";
  }
}

代码示例来源:origin: it.unimi.di/mg4j

public String toString() {
    final long total = total();
    return "Upper bits: " + format( bitsForUpperBits, total ) +
    "Lower bits: " + format( bitsForLowerBits, total ) +
    "Skip pointers bits: " + format( bitsForSkipPointers, total ) +
    "Additional bits: " + format( bitsForAdditional, total ) +
    "Overall bits: " + total + " (" + Util.formatSize( total / 8 ) + "B)\n";
  }
}

相关文章