mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #17 from sharelatex/add-v8-performance
add v8 profiler
This commit is contained in:
commit
896a7c36ce
2 changed files with 11 additions and 1 deletions
|
@ -86,6 +86,15 @@ app.get "/health_check", (req, res)->
|
||||||
res.contentType(resCacher?.setContentType)
|
res.contentType(resCacher?.setContentType)
|
||||||
res.send resCacher?.code, resCacher?.body
|
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) ->
|
app.use (error, req, res, next) ->
|
||||||
logger.error err: error, "server error"
|
logger.error err: error, "server error"
|
||||||
res.send error?.statusCode || 500
|
res.send error?.statusCode || 500
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
"express": "^4.2.0",
|
"express": "^4.2.0",
|
||||||
"body-parser": "^1.2.0",
|
"body-parser": "^1.2.0",
|
||||||
"fs-extra": "^0.16.3",
|
"fs-extra": "^0.16.3",
|
||||||
"underscore": "^1.8.2"
|
"underscore": "^1.8.2",
|
||||||
|
"v8-profiler": "^5.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "1.10.0",
|
"mocha": "1.10.0",
|
||||||
|
|
Loading…
Reference in a new issue