Skip to content

Commit

Permalink
Minor code cleaning in server.js and updated analysis file for pretti…
Browse files Browse the repository at this point in the history
…ness.
  • Loading branch information
drewww committed Dec 8, 2011
1 parent af6924b commit eed5bb4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 34 deletions.
18 changes: 8 additions & 10 deletions server.js
Expand Up @@ -36,11 +36,6 @@ if(program.disableheartbeats) {

io.set("log level", 0);

//
// GLOBALS
//
var connectedUsersCount = 0;
var messagesPerSecond = 0;

//
// LISTENERS
Expand All @@ -50,6 +45,13 @@ app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});


//
// GLOBALS
//
var connectedUsersCount = 0;
var messagesPerSecond = 0;

io.sockets.on('connection', function(socket) {
connectedUsersCount++;

Expand All @@ -59,11 +61,7 @@ io.sockets.on('connection', function(socket) {

messagesPerSecond++;
});

socket.on('hello', function(data) {
logger.info("hello");
});


socket.on('disconnect', function(data) {
connectedUsersCount--;
});
Expand Down
47 changes: 23 additions & 24 deletions util/analysis.m
Expand Up @@ -7,51 +7,50 @@
data = sortrows(data, [1, 2]);

% now we want to make a graph that charts
concurrencyLevels = unique(data(:, 1))
concurrencyLevels = [25, 50, 75, 100, 200, 300, 400, 500, 750, 1000];

% color setup
colors = [11, 12, 20;
23, 23, 35;
33, 34, 47;
43, 43, 59;
52, 53, 71;
60, 61, 83;
69, 70, 92;
77, 78, 103;
85, 86, 113;
92, 94, 123;
100, 101, 132;
108, 111, 139;
115, 121, 147;
122, 131, 153;
129, 139, 160];
colors = [26, 47, 125;
27, 60, 126;
27, 73, 127;
28, 92, 129;
29, 111, 130;
31, 125, 132;
32, 138, 133;
34, 151, 135;
35, 164, 136;
36, 174, 137;
38, 186, 138];
colors = colors/255;


i=1;
for concurrency = concurrencyLevels'
for concurrency = concurrencyLevels
% get all the data for that concurrency level
concurrency
results = data(find(data(:, 1)==concurrency), :);


% there are a few different graph options:

%h = semilogy(results(:, 2), results(:, 5));
h = semilogy(results(:, 2).*results(:, 1), results(:, 5));
h = semilogy(results(:, 2), results(:, 5));
% h = semilogy(results(:, 2).*results(:, 1), results(:, 5));

%h = plot(results(:, 2), results(:, 5));
%h = plot(results(:, 2).*results(:, 1), results(:, 5));
% h = plot(results(:, 2), results(:, 5));
% h = plot(results(:, 2).*results(:, 1), results(:, 5));

set(h, 'LineWidth', 1.5);
set(h, 'LineWidth', 2.0);
set(h, 'Color', colors(i, :));
i=i+1;
hold on
end

h = xlabel('messages sent per second');
set(h, 'FontSize', 14);
h = ylabel('mean roundtrip time');
h = ylabel('mean roundtrip time (ms)');
set(h, 'FontSize', 14);
set(gca, 'FontSize', 14);
set(gcf, 'Color', [1,1,1]);
set(gcf, 'OuterPosition', [500, 1000, 900, 450]);

legend(concurrencyLevels');
legend(num2str(concurrencyLevels'));

0 comments on commit eed5bb4

Please sign in to comment.