Permalink
Browse files

clean up

  • Loading branch information...
1 parent 98129e8 commit f50afb836c453a3626cdc997f864321c66953118 Geoff Flarity committed Feb 6, 2011
Showing with 18 additions and 21 deletions.
  1. +9 −9 heat_tracer.js
  2. +9 −12 public/heat_tracer_client.js
View
@@ -47,15 +47,15 @@ websocket_server.on('connection', function(socket) {
dtp.go();
dtp_by_session_id[socket.sessionId] = dtp;
- /* All that's left to do is send the aggration data from the dscript. */
- interval_id_by_session_id[socket.sessionId] = setInterval(function () {
- var aggdata = {};
- try {
- dtp.aggwalk(function (id, key, val) {
- for( index in val ) {
- /* console.log( 'key: ' + key + ', interval: ' +
- val[index][0][0] + '-' + val[index][0][1], ', count ' + val[index][1] );
- */
+ /* All that's left to do is send the aggration data from the dscript. */
+ interval_id_by_session_id[socket.sessionId] = setInterval(function () {
+ var aggdata = {};
+ try {
+ dtp.aggwalk(function (id, key, val) {
+ for( index in val ) {
+ /* console.log( 'key: ' + key + ', interval: ' +
+ val[index][0][0] + '-' + val[index][0][1], ', count ' + val[index][1] ); */
+
aggdata[key] = val;
}
} );
@@ -11,7 +11,6 @@ function heat_tracer() {
socket.on('connect', function(){
console.log('on connection');
var dscript = "syscall:::entry\n{\nself->syscall_entry_ts[probefunc] = vtimestamp;\n}\nsyscall:::return\n/self->syscall_entry_ts[probefunc]/\n{\n\n@time[probefunc] = lquantize((vtimestamp - self->syscall_entry_ts[probefunc] ) / 1000, 0, 63, 2);\nself->syscall_entry_ts[probefunc] = 0;\n}";
- //setTimeout( function() { socket.send( { 'dscript' : dscript } ) }, 1000 );
socket.send( { 'dscript' : dscript } );
});
@@ -38,24 +37,22 @@ function heat_tracer() {
/* Take the aggregation data and update the heatmap */
function draw(message) {
- /* Latest data goes in the right most column */
+ /* Latest data goes in the right most column, initialize it */
var syscalls_by_latency = [];
for ( var index = 0; index < 32; index++ ) {
syscalls_by_latency[index] = 0;
}
-
/* Presently we have the latency for each system call quantized in our message. Merge the data
such that we have all the system call latency quantized together. This gives us the number
- of syscalls made with latencies in each particular band */
- for ( var key in message ) {
- var val = message[key];
-
- for ( var index in val ) {
- var latency_start = val[index][0][0];
- var count = val[index][1];
-
- //TODO fix
+ of syscalls made with latencies in each particular band. */
+ for ( var syscall in message ) {
+ var val = message[syscall];
+ for ( result_index in val ) {
+ var latency_start = val[result_index][0][0];
+ var count = val[result_index][1];
+ /* The d script we're using lquantizes from 0 to 63 in steps of two. So dividing by 2
+ tells us which row this result belongs in */
syscalls_by_latency[Math.floor(latency_start/2)] += count;
}
}

0 comments on commit f50afb8

Please sign in to comment.