Merge pull request #17 from sharelatex/add-v8-performance

add v8 profiler
This commit is contained in:
Brian Gough 2015-03-16 15:18:48 +00:00
commit 896a7c36ce
2 changed files with 11 additions and 1 deletions

View file

@ -86,6 +86,15 @@ app.get "/health_check", (req, res)->
res.contentType(resCacher?.setContentType)
res.send resCacher?.code, resCacher?.body
profiler = require "v8-profiler"
app.get "/profile", (req, res) ->
time = parseInt(req.query.time || "1000")
profiler.startProfiling("test")
setTimeout () ->
profile = profiler.stopProfiling("test")
res.json(profile)
, time
app.use (error, req, res, next) ->
logger.error err: error, "server error"
res.send error?.statusCode || 500

View file

@ -23,7 +23,8 @@
"express": "^4.2.0",
"body-parser": "^1.2.0",
"fs-extra": "^0.16.3",
"underscore": "^1.8.2"
"underscore": "^1.8.2",
"v8-profiler": "^5.2.4"
},
"devDependencies": {
"mocha": "1.10.0",