Permalink
Browse files

Removed unnecessary code

  • Loading branch information...
Makoto Inoue
Makoto Inoue committed Aug 14, 2010
1 parent 954eeb0 commit 5d25571156eada9b79ca82b64bfbadaccd88d610
Showing with 1 addition and 53 deletions.
  1. +1 −53 server/activity-monitor.js
View
@@ -10,14 +10,6 @@ var server = ws.createServer({
debug: true
}, httpServer);
-server.addListener("listening", function(){
- sys.log("Listening for connections.");
-});
-
-String.prototype.trim = function() {
- return this.replace(/^\s+|\s+$/g,"");
-}
-
function format (data) {
var output_data = data.toString();
sys.log(output_data);
@@ -27,7 +19,7 @@ function format (data) {
}else{
// disk0 cpu load
// average kbt tps kbs us sy id 1m 5m 15m
- var output_array = output_data.trim().split(/\s+/);
+ var output_array = output_data.replace(/^\s+|\s+$/g,"").split(/\s+/);
for (var i=0; i < output_array.length; i++) {
output_array[i] = parseFloat( output_array[i]);
};
@@ -72,47 +64,3 @@ server.addListener("close", function(conn){
});
server.listen(8000);
-
-//
-// exports.handleData = function(connection, data) {
-//
-// connection.addListener('eof', function(data) {
-// child_process.removeListener("output", output)
-// })
-//
-// var output = function (output_data) {
-// sys.puts(output_data);
-// header = 'disk0 cpu load average'
-// if (output_data.match(header)) {
-// sys.puts("ignore header")
-// }else{
-// // disk0 cpu load
-// // average kbt tps kbs us sy id 1m 5m 15m
-// var output_array = output_data.trim().split(/\s+/);
-// for (var i=0; i < output_array.length; i++) {
-// output_array[i] = parseFloat( output_array[i]);
-// };
-// output_hash = {
-// date:new Date(),
-// disk:{
-// kbt:output_array[0],
-// tps:output_array[1],
-// mbs:output_array[2]
-// },
-// cpu:{
-// us:output_array[3],
-// sy:output_array[4],
-// id:output_array[5]
-// },
-// load_average:{
-// m1:output_array[6],
-// m5:output_array[7],
-// m15:output_array[8]
-// }
-// }
-// connection.send('\u0000' + JSON.stringify(output_hash) + '\uffff');
-// }
-// }
-//
-// child_process.addListener("output", output);
-// }

0 comments on commit 5d25571

Please sign in to comment.