profiler.

This commit is contained in:
Christopher Jeffrey 2016-05-08 12:12:55 -07:00
parent cb6b43f0b6
commit 24ff3fe6d4
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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();
}