This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Simpler Python script for generating a graph of libc++'s header dependencies

Authored by Quuxplusone on Mar 22 2021, 3:56 PM.



I've temporarily named this script because already exists — @EricWF wrote it in February 2020. My attempts to play around with were mostly fruitless; I needed to modify it in various ways to make it work without a lot of structure around it, and then even when I got it working, it generated pretty ugly graphs.

Existing usage (after my local changes to simplify the usage) (producing )

mkdir foo
time ./ --libcxx-only -o foo --clang-command ~/llvm-project/build/bin/clang++
dot -Tpng < foo/ > old.png
file old.png

real    0m37.453s
user    0m34.025s
sys     0m2.742s
old.png: PNG image data, 25882 x 3035, 8-bit/color RGBA, non-interlaced

New usage (producing )

time ./ | dot -Tpng > new.png
file new.png

real    0m1.063s
user    0m0.837s
sys     0m0.077s
new.png: PNG image data, 6162 x 1344, 8-bit/color RGBA, non-interlaced

Diff Detail

Event Timeline

Quuxplusone requested review of this revision.Mar 22 2021, 3:56 PM
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald TranscriptMar 22 2021, 3:56 PM

I'm fine with updating the script if it provides clearer results, which seems to be the case.

Add --show-cumulative-line-counts --show-individual-line-counts options (which can be combined).

./ --show-cumulative-line-counts --show-individual-line-counts --show-config-headers | dot -Tpdf > x.pdf
ldionne accepted this revision.Mar 23 2021, 10:23 AM
This revision is now accepted and ready to land.Mar 23 2021, 10:23 AM
This revision was landed with ongoing or failed builds.Mar 23 2021, 11:12 AM
This revision was automatically updated to reflect the committed changes.