This is an archive of the discontinued LLVM Phabricator instance.

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

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

Details

Summary

I've temporarily named this script graph_header_deps2.py because graph_header_deps.py already exists — @EricWF wrote it in February 2020. My attempts to play around with graph_header_deps.py 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 graph_header_deps.py usage (after my local changes to simplify the usage) (producing https://i.imgur.com/zATrsaP.jpg )

mkdir foo
time ./graph_header_deps.py --libcxx-only -o foo --clang-command ~/llvm-project/build/bin/clang++
dot -Tpng < foo/all_headers.dot > 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 graph_header_deps2.py usage (producing https://i.imgur.com/ZU0G52U.png )

time ./graph_header_deps2.py | 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).

./graph_header_deps.py --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.
libcxx/utils/graph_header_deps2.py