mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
add v8 profiler on /profile?time=MS url
This commit is contained in:
parent
416d7a17a7
commit
9ee2706410
2 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue