diff --git a/controllers/prototype/views/sponza.jade b/controllers/prototype/views/sponza.jade index 2ddd04e..1602e59 100644 --- a/controllers/prototype/views/sponza.jade +++ b/controllers/prototype/views/sponza.jade @@ -4,9 +4,10 @@ block title title #{title} - Prototype - Arrows block mainjs - script L3D.BD.disable(); - script initMainScene = L3D.initSponza + script locked = false; script(src="/static/js/prototypeinteractive.min.js") + script initMainScene = L3D.initSponza + script L3D.BD.disable(); block configjs script Recommendation = L3D.ArrowRecommendation; diff --git a/js/l3d/apps/prototype/interactive/main.js b/js/l3d/apps/prototype/interactive/main.js index bbf0f02..9c546ff 100644 --- a/js/l3d/apps/prototype/interactive/main.js +++ b/js/l3d/apps/prototype/interactive/main.js @@ -54,7 +54,7 @@ function main() { // Set the good size of cameras onWindowResize(); - if (locked) + if (locked !== undefined && locked) startCanvas.render(); // Some config diff --git a/lib/NodeLog.js b/lib/NodeLog.js index 040805f..a117abb 100644 --- a/lib/NodeLog.js +++ b/lib/NodeLog.js @@ -29,12 +29,13 @@ Log.ready = function(msg) { log('[RDY] ' + new Date() + ' ' + msg, Colors.GREEN); }; -Log.request = function(req, res) { +Log.request = function(req, res, time) { if (req.headers['x-forwarded-for'] !== undefined || isDev) { log( '[REQ] ' + new Date() + ' ' + (req.headers['x-forwarded-for'] || req.connection.remoteAddress) + - ' : ' + req.url, + (time !== undefined ? (' in ' + (" " + time).slice(-6) + ' ms') : '') + + ' : ' + req.url , Colors.CYAN ); } diff --git a/load.js b/load.js new file mode 100644 index 0000000..2593ca6 --- /dev/null +++ b/load.js @@ -0,0 +1,58 @@ +function makeId() +{ + var text = ""; + var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + + for( var i=0; i < 5; i++ ) + text += possible.charAt(Math.floor(Math.random() * possible.length)); + + return text; +} + +var fs = require('fs'); + +var casper = require('casper').create({ + stepTimeout: 100000, + waitTimeout: 100000 +}); + +var limit = 100; + +casper.start('http://localhost:4000/'); + +for (var i = 0; i < limit; i++) { + + (function(i) { + + casper.thenOpen('http://localhost:4000/user-study', function() { + + console.log(i); + + this.getHTML(); + + // this.waitForSelector('form#form', function() { + + this.fillSelectors( + 'form#form', { + '#inputId': makeId(), + '#sel1': '-15', + '#sel2': '3' + }, true + ); + + // }, true); + + this.thenOpen('http://localhost:4000/prototype/game'); + this.thenOpen('http://localhost:4000/prototype/game'); + this.thenOpen('http://localhost:4000/prototype/game'); + this.thenOpen('http://localhost:4000/prototype/game'); + + this.thenOpen('http://localhost:4000/logout'); + + }); + + })(i); + +} + +casper.run(); diff --git a/server.js b/server.js index 878508a..6b0311c 100644 --- a/server.js +++ b/server.js @@ -37,8 +37,13 @@ app.use(bodyParser.json()); app.use(function(req, res, next) { - // Log connection - Log.request(req, res); + var start = Date.now(); + + res.on('finish', function() { + // Log connection + Log.request(req, res, Date.now() - start); + + }); res.locals.title = "3DUI"; res.locals.urls = urls;