Add systrace markers to module require
Summary: public Show modules' dependencies and time to load. Reviewed By: davidaurelio Differential Revision: D2603245 fb-gh-sync-id: a1d5067a8522b908b87fdfdd51ff4c4fdbc2edfc
This commit is contained in:
parent
43f18ffd08
commit
16dd5d664b
|
@ -54,9 +54,13 @@
|
|||
// require cycles inside the factory from causing an infinite require loop.
|
||||
mod.isInitialized = true;
|
||||
|
||||
__DEV__ && BridgeProfiling().profile(id);
|
||||
|
||||
// keep args in sync with with defineModuleCode in
|
||||
// packager/react-packager/src/Resolver/index.js
|
||||
mod.factory.call(global, global, require, mod.module, mod.module.exports);
|
||||
|
||||
__DEV__ && BridgeProfiling().profileEnd();
|
||||
} catch (e) {
|
||||
mod.hasError = true;
|
||||
mod.isInitialized = false;
|
||||
|
@ -66,6 +70,16 @@
|
|||
return mod.module.exports;
|
||||
}
|
||||
|
||||
const BridgeProfiling = __DEV__ && (() => {
|
||||
var _BridgeProfiling;
|
||||
try {
|
||||
_BridgeProfiling = require('BridgeProfiling');
|
||||
} catch(e) {}
|
||||
|
||||
return _BridgeProfiling && _BridgeProfiling.profile ?
|
||||
_BridgeProfiling : { profile: () => {}, profileEnd: () => {} };
|
||||
});
|
||||
|
||||
global.__d = define;
|
||||
global.require = require;
|
||||
})(this);
|
||||
|
|
Loading…
Reference in New Issue