Skip to content

Commit ef0e880

Browse files
committed
Fixed method
1 parent 51b9413 commit ef0e880

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

test/cpu_cprofiler.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,14 @@ describe('HEAP', function() {
185185
});
186186

187187
it('should use control function, if started with function argument', function(done) {
188+
// Fix for Windows
189+
var checked = false;
188190
profiler.takeSnapshot(function(progress, total) {
189-
if (progress === total) done();
191+
if (progress === total) {
192+
if (checked) return;
193+
checked = true;
194+
done();
195+
}
190196
});
191197
});
192198

@@ -261,6 +267,13 @@ describe('HEAP', function() {
261267
});
262268
});
263269

270+
it('should compare itself with other snapshot', function() {
271+
var snapshot1 = profiler.takeSnapshot();
272+
var snapshot2 = profiler.takeSnapshot();
273+
274+
expect(snapshot1.compare.bind(snapshot1, snapshot2)).to.not.throw();
275+
});
276+
264277
});
265278

266279
function deleteAllSnapshots() {

v8-profiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Snapshot.prototype.compare = function(other) {
2929
keys.forEach(function(key) {
3030
if (key in diff) return;
3131

32-
var selfCount = selfCounts[key] || 0,
33-
otherCount = otherCounts[key] || 0;
32+
var selfCount = selfHist[key] || 0,
33+
otherCount = otherHist[key] || 0;
3434

3535
diff[key] = otherCount - selfCount;
3636
});

0 commit comments

Comments
 (0)