Java 类org.apache.hadoop.hdfs.util.LightWeightGSet 实例源码

项目:hadoop-on-lustre    文件:BlocksMap.java   
/**
 * Let t = 2% of max memory.
 * Let e = round(log_2 t).
 * Then, we choose capacity = 2^e/(size of reference),
 * unless it is outside the close interval [1, 2^30].
 */
private static int computeCapacity() {
  //VM detection
  //See http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_detection
  final String vmBit = System.getProperty("sun.arch.data.model");

  //2% of max memory
  final double twoPC = Runtime.getRuntime().maxMemory()/50.0;

  //compute capacity
  final int e1 = (int)(Math.log(twoPC)/Math.log(2.0) + 0.5);
  final int e2 = e1 - ("32".equals(vmBit)? 2: 3);
  final int exponent = e2 < 0? 0: e2 > 30? 30: e2;
  final int c = 1 << exponent;

  LightWeightGSet.LOG.info("VM type       = " + vmBit + "-bit");
  LightWeightGSet.LOG.info("2% max memory = " + twoPC/(1 << 20) + " MB");
  LightWeightGSet.LOG.info("capacity      = 2^" + exponent
      + " = " + c + " entries");
  return c;
}
项目:cumulus    文件:BlocksMap.java   
/**
 * Let t = 2% of max memory.
 * Let e = round(log_2 t).
 * Then, we choose capacity = 2^e/(size of reference),
 * unless it is outside the close interval [1, 2^30].
 */
private static int computeCapacity() {
  //VM detection
  //See http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_detection
  final String vmBit = System.getProperty("sun.arch.data.model");

  //2% of max memory
  final double twoPC = Runtime.getRuntime().maxMemory()/50.0;

  //compute capacity
  final int e1 = (int)(Math.log(twoPC)/Math.log(2.0) + 0.5);
  final int e2 = e1 - ("32".equals(vmBit)? 2: 3);
  final int exponent = e2 < 0? 0: e2 > 30? 30: e2;
  final int c = 1 << exponent;

  LightWeightGSet.LOG.info("VM type       = " + vmBit + "-bit");
  LightWeightGSet.LOG.info("2% max memory = " + twoPC/(1 << 20) + " MB");
  LightWeightGSet.LOG.info("capacity      = 2^" + exponent
      + " = " + c + " entries");
  return c;
}
项目:RDFS    文件:BlocksMap.java   
/**
 * Let t = 2% of max memory.
 * Let e = round(log_2 t).
 * Then, we choose capacity = 2^e/(size of reference),
 * unless it is outside the close interval [1, 2^30].
 */
private static int computeCapacity() {
  //VM detection
  //See http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_detection
  final String vmBit = System.getProperty("sun.arch.data.model");

  //2% of max memory
  final double twoPC = Runtime.getRuntime().maxMemory()/50.0;

  //compute capacity
  final int e1 = (int)(Math.log(twoPC)/Math.log(2.0) + 0.5);
  final int e2 = e1 - ("32".equals(vmBit)? 2: 3);
  final int exponent = e2 < 0? 0: e2 > 30? 30: e2;
  final int c = 1 << exponent;

  LightWeightGSet.LOG.info("VM type       = " + vmBit + "-bit");
  LightWeightGSet.LOG.info("2% max memory = " + twoPC/(1 << 20) + " MB");
  LightWeightGSet.LOG.info("capacity      = 2^" + exponent
      + " = " + c + " entries");
  return c;
}
项目:hortonworks-extension    文件:BlocksMap.java   
/**
 * Let t = 2% of max memory.
 * Let e = round(log_2 t).
 * Then, we choose capacity = 2^e/(size of reference),
 * unless it is outside the close interval [1, 2^30].
 */
private static int computeCapacity() {
  //VM detection
  //See http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_detection
  final String vmBit = System.getProperty("sun.arch.data.model");

  //2% of max memory
  final double twoPC = Runtime.getRuntime().maxMemory()/50.0;

  //compute capacity
  final int e1 = (int)(Math.log(twoPC)/Math.log(2.0) + 0.5);
  final int e2 = e1 - ("32".equals(vmBit)? 2: 3);
  final int exponent = e2 < 0? 0: e2 > 30? 30: e2;
  final int c = 1 << exponent;

  LightWeightGSet.LOG.info("VM type       = " + vmBit + "-bit");
  LightWeightGSet.LOG.info("2% max memory = " + twoPC/(1 << 20) + " MB");
  LightWeightGSet.LOG.info("capacity      = 2^" + exponent
      + " = " + c + " entries");
  return c;
}
项目:hortonworks-extension    文件:BlocksMap.java   
/**
 * Let t = 2% of max memory.
 * Let e = round(log_2 t).
 * Then, we choose capacity = 2^e/(size of reference),
 * unless it is outside the close interval [1, 2^30].
 */
private static int computeCapacity() {
  //VM detection
  //See http://java.sun.com/docs/hotspot/HotSpotFAQ.html#64bit_detection
  final String vmBit = System.getProperty("sun.arch.data.model");

  //2% of max memory
  final double twoPC = Runtime.getRuntime().maxMemory()/50.0;

  //compute capacity
  final int e1 = (int)(Math.log(twoPC)/Math.log(2.0) + 0.5);
  final int e2 = e1 - ("32".equals(vmBit)? 2: 3);
  final int exponent = e2 < 0? 0: e2 > 30? 30: e2;
  final int c = 1 << exponent;

  LightWeightGSet.LOG.info("VM type       = " + vmBit + "-bit");
  LightWeightGSet.LOG.info("2% max memory = " + twoPC/(1 << 20) + " MB");
  LightWeightGSet.LOG.info("capacity      = 2^" + exponent
      + " = " + c + " entries");
  return c;
}
项目:hadoop-EAR    文件:FSDirectory.java   
private INodeMap initInodeMap(INodeDirectory rootDir) {
  // Compute the map capacity by allocating 1.1% of total memory
  int capacity = LightWeightGSet.computeCapacity(1.1, "INodeMap");
  INodeMap map = new INodeMap(capacity);
  map.put(rootDir);
  return map;
}
项目:hadoop-EAR    文件:BlocksMap.java   
@Override
public LightWeightGSet.LinkedElement getNext() {
  return nextLinkedElement;
}
项目:hadoop-EAR    文件:BlocksMap.java   
@Override
public void setNext(LightWeightGSet.LinkedElement next) {
  this.nextLinkedElement = next;
}
项目:hadoop-EAR    文件:BlocksMap.java   
BlocksMap(int initialCapacity, float loadFactor, FSNamesystem ns) {
  // Use 2% of total memory
  this.capacity = LightWeightGSet.computeCapacity(2.0, "BlocksMap");
  this.blocks = new LightWeightGSet<Block, BlockInfo>(capacity);
  this.ns = ns;
}
项目:hadoop-on-lustre    文件:BlocksMap.java   
@Override
public LightWeightGSet.LinkedElement getNext() {
  return nextLinkedElement;
}
项目:hadoop-on-lustre    文件:BlocksMap.java   
@Override
public void setNext(LightWeightGSet.LinkedElement next) {
  this.nextLinkedElement = next;
}
项目:hadoop-on-lustre    文件:BlocksMap.java   
BlocksMap(int initialCapacity, float loadFactor) {
  this.capacity = computeCapacity();
  this.blocks = new LightWeightGSet<Block, BlockInfo>(capacity);
}
项目:cumulus    文件:BlockInfo.java   
@Override
public LightWeightGSet.LinkedElement getNext() {
  return nextLinkedElement;
}
项目:cumulus    文件:BlockInfo.java   
@Override
public void setNext(LightWeightGSet.LinkedElement next) {
  this.nextLinkedElement = next;
}
项目:cumulus    文件:BlocksMap.java   
BlocksMap(int initialCapacity, float loadFactor) {
  this.capacity = computeCapacity();
  this.blocks = new LightWeightGSet<Block, BlockInfo>(capacity);
}
项目:RDFS    文件:BlocksMap.java   
@Override
public LightWeightGSet.LinkedElement getNext() {
  return nextLinkedElement;
}
项目:RDFS    文件:BlocksMap.java   
@Override
public void setNext(LightWeightGSet.LinkedElement next) {
  this.nextLinkedElement = next;
}
项目:RDFS    文件:BlocksMap.java   
BlocksMap(int initialCapacity, float loadFactor, FSNamesystem ns) {
  this.capacity = computeCapacity();
  this.blocks = new LightWeightGSet<Block, BlockInfo>(capacity);
  this.ns = ns;
}
项目:hortonworks-extension    文件:BlocksMap.java   
@Override
public LightWeightGSet.LinkedElement getNext() {
  return nextLinkedElement;
}
项目:hortonworks-extension    文件:BlocksMap.java   
@Override
public void setNext(LightWeightGSet.LinkedElement next) {
  this.nextLinkedElement = next;
}
项目:hortonworks-extension    文件:BlocksMap.java   
BlocksMap(int initialCapacity, float loadFactor) {
  this.capacity = computeCapacity();
  this.blocks = new LightWeightGSet<Block, BlockInfo>(capacity);
}
项目:hortonworks-extension    文件:BlocksMap.java   
@Override
public LightWeightGSet.LinkedElement getNext() {
  return nextLinkedElement;
}
项目:hortonworks-extension    文件:BlocksMap.java   
@Override
public void setNext(LightWeightGSet.LinkedElement next) {
  this.nextLinkedElement = next;
}
项目:hortonworks-extension    文件:BlocksMap.java   
BlocksMap(int initialCapacity, float loadFactor) {
  this.capacity = computeCapacity();
  this.blocks = new LightWeightGSet<Block, BlockInfo>(capacity);
}