void dumpStats() { long wallTimeNanos = totalStopwatch.elapsed(TimeUnit.NANOSECONDS); long dbtime = 0; for (String name : methodCalls.keySet()) { long calls = methodCalls.get(name); long time = methodTotalTime.get(name); dbtime += time; long average = time / calls; double proportion = (time + 0.0) / (wallTimeNanos + 0.0); log.info(name + " c:" + calls + " r:" + time + " a:" + average + " p:" + String.format("%.2f", proportion)); } double dbproportion = (dbtime + 0.0) / (wallTimeNanos + 0.0); double hitrate = (hit + 0.0) / (hit + miss + 0.0); log.info("Cache size:" + utxoCache.size() + " hit:" + hit + " miss:" + miss + " rate:" + String.format("%.2f", hitrate)); bloom.printStat(); log.info("hasTxOut call:" + hasCall + " True:" + hasTrue + " False:" + hasFalse); log.info("Wall:" + totalStopwatch + " percent:" + String.format("%.2f", dbproportion)); String stats = db.getProperty("leveldb.stats"); System.out.println(stats); }
void dumpStats() { long wallTimeNanos = totalStopwatch.elapsed(TimeUnit.NANOSECONDS); long dbtime = 0; for (String name : methodCalls.keySet()) { long calls = methodCalls.get(name); long time = methodTotalTime.get(name); dbtime += time; long average = time / calls; double proportion = (time + 0.0) / (wallTimeNanos + 0.0); log.info(name + " c:" + calls + " r:" + time + " a:" + average + " p:" + String.format("%.2f", proportion)); } double dbproportion = (dbtime + 0.0) / (wallTimeNanos + 0.0); double hitrate = (hit + 0.0) / (hit + miss + 0.0); log.info("Cache size:" + utxoCache.size() + " hit:" + hit + " miss:" + miss + " rate:" + String.format("%.2f", hitrate)); bloom.printStat(); log.info("hasTxOut call:" + hasCall + " True:" + hasTrue + " False:" + hasFalse); log.info("Wall:" + totalStopwatch + " percent:" + String.format("%.2f", dbproportion)); String stats = db.getProperty("leveldb.stats"); System.out.println(stats); }
void dumpStats() { long wallTimeNanos = totalStopwatch.elapsed(TimeUnit.NANOSECONDS); long dbtime = 0; for (String name : methodCalls.keySet()) { long calls = methodCalls.get(name); long time = methodTotalTime.get(name); dbtime += time; long average = time / calls; double proportion = (time + 0.0) / (wallTimeNanos + 0.0); log.info(name + " c:" + calls + " r:" + time + " a:" + average + " p:" + String.format("%.2f", proportion)); } double dbproportion = (dbtime + 0.0) / (wallTimeNanos + 0.0); double hitrate = (hit + 0.0) / (hit + miss + 0.0); log.info("Cache size:" + utxoCache.size() + " hit:" + hit + " miss:" + miss + " rate:" + String.format("%.2f", hitrate)); bloom.printStat(); log.info("hasTxOut call:" + hasCall + " True:" + hasTrue + " False:" + hasFalse); log.info("Wall:" + totalStopwatch + " percent:" + String.format("%.2f", dbproportion)); String stats = db.getProperty("leveldb.stats"); System.out.println(stats); }
public void reloadCache(DB db) { // LevelDB is great at scanning consecutive keys. // This take seconds even with 20m keys to add. log.info("Loading Bloom Filter"); DBIterator iterator = db.iterator(); byte[] key = getKey(KeyType.OPENOUT_ALL); for (iterator.seek(key); iterator.hasNext(); iterator.next()) { ByteBuffer bbKey = ByteBuffer.wrap(iterator.peekNext().getKey()); byte firstByte = bbKey.get(); // remove the KeyType.OPENOUT_ALL // byte. if (key[0] != firstByte) { printStat(); return; } byte[] hash = new byte[32]; bbKey.get(hash); add(hash); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } printStat(); }
public void reloadCache(DB db) { // LevelDB is great at scanning consecutive keys. // This take seconds even with 20m keys to add. log.info("Loading Bloom Filter"); DBIterator iterator = db.iterator(); byte[] key = getKey(KeyType.OPENOUT_ALL); for (iterator.seek(key); iterator.hasNext(); iterator.next()) { ByteBuffer bbKey = ByteBuffer.wrap(iterator.peekNext().getKey()); byte firstByte = bbKey.get(); // remove the KeyType.OPENOUT_ALL // byte. if (key[0] != firstByte) { printStat(); return; } byte[] hash = new byte[32]; bbKey.get(hash); add(hash); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } printStat(); }
public void reloadCache(DB db) { // LevelDB is great at scanning consecutive keys. // This take seconds even with 20m keys to add. log.info("Loading Bloom Filter"); DBIterator iterator = db.iterator(); byte[] key = getKey(KeyType.OPENOUT_ALL); for (iterator.seek(key); iterator.hasNext(); iterator.next()) { ByteBuffer bbKey = ByteBuffer.wrap(iterator.peekNext().getKey()); byte firstByte = bbKey.get(); // remove the KeyType.OPENOUT_ALL // byte. if (key[0] != firstByte) { printStat(); return; } byte[] hash = new byte[32]; bbKey.get(hash); add(hash); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } printStat(); }
public void reloadCache(DB db) { // LevelDB is great at scanning consecutive keys. // This take seconds even with 20m keys to add. log.info("Loading Bloom Filter"); DBIterator iterator = db.iterator(); byte[] key = getKey(KeyType.OPENOUT_ALL); for (iterator.seek(key); iterator.hasNext(); iterator.next()) { ByteBuffer bbKey = ByteBuffer.wrap(iterator.peekNext().getKey()); byte firstByte = bbKey.get(); // remove the KeyType.OPENOUT_ALL // byte. if (key[0] != firstByte) { printStat(); return; } byte[] hash = new byte[32]; bbKey.get(hash); add(hash); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } printStat(); }
void dumpStats() { long wallTimeNanos = totalStopwatch.elapsed(TimeUnit.NANOSECONDS); long dbtime = 0; for (String name : methodCalls.keySet()) { long calls = methodCalls.get(name); long time = methodTotalTime.get(name); dbtime += time; long average = time / calls; double proportion = (time + 0.0) / (wallTimeNanos + 0.0); log.info(name + " c:" + calls + " r:" + time + " a:" + average + " p:" + String.format("%.2f", proportion)); } double dbproportion = (dbtime + 0.0) / (wallTimeNanos + 0.0); double hitrate = (hit + 0.0) / (hit + miss + 0.0); log.info("Cache size:" + utxoCache.size() + " hit:" + hit + " miss:" + miss + " rate:" + String.format("%.2f", hitrate)); bloom.printStat(); log.info("hasTxOut call:" + hasCall + " True:" + hasTrue + " False:" + hasFalse); log.info("Wall:" + totalStopwatch + " percent:" + String.format("%.2f", dbproportion)); String stats = db.getProperty("leveldb.stats"); System.out.println(stats); }