<commit_before>var socket = require('socket.io-client')('http://qssub.cloudapp.net:8080');

var pkct = 0;
var processStart;  // epoch in ms
var processEnd;    // epoch in ms
var fullData = {}; // 1-indexed
var cnns = 0;
var dscn = 0;
var rcns = 0;

console.time("quake");

socket.on("connect", function() {
	++cnns;
	console.log(process.pid + " socket connected");
}), socket.on("message", function(t) {
	var e = JSON.parse(t);

	if ( !e.data ){
		return;
	}

	pkct++;

	if (!processStart) {
		processStart = e.starttime;
	}

	processEnd = e.endtime;

	var msgl = t.toString().length;     // in bytes
	var msgd = e.endtime - e.starttime; // in ms
	var bptd = msgl / msgd;             // in bytes/ms
	fullData[pkct] = { msgl: msgl, msgd: msgd, bptd: bptd };
}), socket.on("disconnect", function() {
	++dscn;
	console.log(process.pid + " socket disconnected");
}), socket.on("reconnect", function() {
	++rcns;
	console.log(process.pid + " socket reconnected");
});

process.on('SIGINT', function() {
	console.log("Caught interrupt signal");
	wrapup();
	process.exit();
});

function wrapup() {
	if (!pkct || !processEnd || !processStart) {
		return;
	}

	var rate = pkct/(processEnd-processStart)*1e5;

	console.log("Packets      " + pkct);
	console.log("Rate (pk/s)  " + rate);
	console.log("Duration (s) " + (processEnd-processStart)/1e5);
	console.log("Connects     " + cnns);
	console.log("Reconnects   " + rcns);
	console.log("Disconnects  " + dscn);

	console.timeEnd("quake");
}<commit_msg>Differentiating process time deltas from packet time deltas<commit_after>var socket = require('socket.io-client')('http://qssub.cloudapp.net:8080');

var pkct = 0;
var packetStart;  // epoch in ms
var packetEnd = 0;    // epoch in ms
var fullData = {}; // 1-indexed
var cnns = 0;
var dscn = 0;
var rcns = 0;

console.time("quake");

socket.on("connect", function() {
	++cnns;
	console.log(process.pid + " socket connected");

}), socket.on("message", function(t) {
	var e = JSON.parse(t);

	if (!e.data){
		return;
	}

	pkct++;

	if (!packetStart) {
		packetStart = e.starttime;
	}

	if ( e.endtime > packetEnd ) {
		packetEnd = e.endtime;
	}
/*
	var msgl = t.toString().length;     // in bytes
	var msgd = e.endtime - e.starttime; // in ms
	var bptd = msgl / msgd;             // in bytes/ms

	fullData[pkct] = { msgl: msgl, msgd: msgd, bptd: bptd };
*/

}), socket.on("disconnect", function() {
	++dscn;
	console.log(process.pid + " socket disconnected");

}), socket.on("reconnect", function() {
	++rcns;
	console.log(process.pid + " socket reconnected");
});

process.on('SIGINT', function() {
	console.log("Caught interrupt signal");
	wrapup();
	process.exit();
});

function wrapup() {
	if (!pkct || !packetEnd || !packetStart) {
		return;
	}

	var rate = pkct/((packetEnd-packetStart)/1e5);

	console.log("Packets      " + pkct);
	console.log("Rate         " + rate);
	console.log("Duration     " + (packetEnd-packetStart)/1e5);
	console.log("Connects     " + cnns);
	console.log("Reconnects   " + rcns);
	console.log("Disconnects  " + dscn);

	console.log("Start packet " + packetStart);
	console.log("Final packet " + packetEnd);

	console.timeEnd("quake");
}
{'fraction_non_alphanumeric': 0.1884287069238065, 'fraction_numerical': 0.00853619981030667, 'mean_word_length': 3.5921625544267055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7666959', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1178, 'n_words': 251}