Browse Source

bench: Remove throughput (covered by benchmark/net)

v0.9.11-release
isaacs 12 years ago
parent
commit
051c1317f9
  1. 24
      benchmark/throughput-child.js
  2. 21
      benchmark/throughput.js

24
benchmark/throughput-child.js

@ -1,24 +0,0 @@
var net = require('net');
var received = 0;
var start = process.hrtime();
var socket = net.connect(8000);
socket.on('data', function(d) {
received += d.length;
});
var interval = setInterval(function() {
// After 1 gigabyte shutdown.
if (received > 10 * 1024 * 1024 * 1024) {
socket.destroy();
clearInterval(interval);
process.exit(0);
} else {
// Otherwise print some stats.
var elapsed = process.hrtime(start);
var sec = elapsed[0] + elapsed[1]/1E9;
var gigabytes = received / (1024 * 1024 * 1024);
var gigabits = gigabytes * 8.0;
console.log((gigabits / sec) + " gbit/sec")
}
}, 1000);

21
benchmark/throughput.js

@ -1,21 +0,0 @@
var fork = require('child_process').fork;
var net = require('net');
var buffer = new Buffer(1024 * 1024);
function write(socket) {
if (!socket.writable) return;
socket.write(buffer, function() {
write(socket);
});
}
var server = net.createServer(function(socket) {
server.close();
write(socket);
});
server.listen(8000, function() {
fork(__dirname + '/throughput-child.js');
});
Loading…
Cancel
Save