mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
Add require time and load count tracking
This commit is contained in:
committed by
Kevin Sawicki
parent
508a30efb1
commit
245c77869f
@@ -99,6 +99,24 @@ getCachedModulePath = (relativePath, parentModule) ->
|
||||
|
||||
undefined
|
||||
|
||||
debug = false
|
||||
if debug
|
||||
global.loadCount = 0
|
||||
global.requireTime = 0
|
||||
|
||||
originalLoad = Module::load
|
||||
Module::load = ->
|
||||
global.loadCount++
|
||||
originalLoad.apply(this, arguments)
|
||||
|
||||
|
||||
originalRequire = Module::require
|
||||
Module::require = ->
|
||||
startTime = Date.now()
|
||||
exports = originalRequire.apply(this, arguments)
|
||||
global.requireTime += Date.now() - startTime
|
||||
exports
|
||||
|
||||
registered = false
|
||||
exports.register = ->
|
||||
return if registered
|
||||
|
||||
Reference in New Issue
Block a user