From 24ff3fe6d42a2186af7d9837624e2085db9b0a65 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 8 May 2016 12:12:55 -0700 Subject: [PATCH] profiler. --- lib/bcoin/chain.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/bcoin/chain.js b/lib/bcoin/chain.js index 8d8bc470..ff0f7e42 100644 --- a/lib/bcoin/chain.js +++ b/lib/bcoin/chain.js @@ -215,6 +215,8 @@ Chain.prototype._init = function _init() { network.height = tip.height; } + bcoin.profiler.snapshot(); + self._getInitialState(function(err) { if (err) return self.emit('error', err); @@ -225,6 +227,8 @@ Chain.prototype._init = function _init() { if (self.segwitActive) bcoin.debug('Segwit is active.'); + bcoin.profiler.snapshot(); + self.loaded = true; self.emit('open'); self.emit('tip', tip); @@ -1596,7 +1600,7 @@ Chain.prototype.add = function add(block, callback, force) { self.total += total; // Take heap snapshot for debugging. - if (self.total % 20 === 0) { + if (self.total === 1 || self.total % 20 === 0) { utils.gc(); bcoin.profiler.snapshot(); }