Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Unified Diff: third_party/WebKit/Source/devtools/scripts/visualize_deps/generate_dot.js

Issue 2620363003: DevTools: generate dot file with module sizes in visualizer. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/scripts/visualize_deps/generate_dot.js
diff --git a/third_party/WebKit/Source/devtools/scripts/visualize_deps/generate_dot.js b/third_party/WebKit/Source/devtools/scripts/visualize_deps/generate_dot.js
index b079f2180d9b79e3e771e9cbae478636f24b52aa..1448ef8be3698edb1ccaedd8290df8756742a513 100644
--- a/third_party/WebKit/Source/devtools/scripts/visualize_deps/generate_dot.js
+++ b/third_party/WebKit/Source/devtools/scripts/visualize_deps/generate_dot.js
@@ -15,13 +15,31 @@ const OUT = path.resolve(__dirname, 'out', 'dependencies.dot');
function main() {
const modules = new Set();
chenwilliam 2017/01/11 19:03:33 const OUT_DIR = path.resolve(__dirname, 'out'); i
const moduleToDependencyList = ['digraph dependencies {'];
+ moduleToDependencyList.push('fixedsize = true;')
fs.readdirSync(FRONTEND_PATH).forEach(function(file) {
const moduleJSONPath = path.join(FRONTEND_PATH, file, 'module.json');
if (fs.statSync(path.join(FRONTEND_PATH, file)).isDirectory() &&
utils.isFile(moduleJSONPath)) {
const module = file;
+ if (module === 'audits2_worker')
+ return;
modules.add(module);
const moduleJSON = require(moduleJSONPath);
+ let moduleSize = 0;
+
+ let resources = (moduleJSON.scripts || []).concat((moduleJSON.resources || []));
+ for (let script of resources) {
+ if (fs.existsSync(path.join(FRONTEND_PATH, module, script))) {
+ console.log(path.join(FRONTEND_PATH, module, script));
+ moduleSize += fs.statSync(path.join(FRONTEND_PATH, module, script)).size;
+ }
+ }
+ moduleSize /= 200000;
+ moduleSize = Math.max(0.5, moduleSize);
+ let fontSize = Math.max(moduleSize*14, 14);
+
+ moduleToDependencyList.push(`${module} [width=${moduleSize}, height=${moduleSize} fontsize=${fontSize}];`);
+
if (moduleJSON.dependencies) {
for (let d of moduleJSON.dependencies) {
moduleToDependencyList.push(` ${module} -> ${d}`);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698