Introduction
Understanding the call graph of a build or a function call within a build can be a bit difficult. Even if you have a CacheIndex and PrimaryKey to start with, finding the call graph relationships between different entries requires searching through the GraphLog. While this can be done with the output of PrintGraphLog, it's time-consuming and difficult to understand because the graph log contains no human-readable information about what a cache entry represents.
PrintCallGraph is a new utility that makes searching through the call graph stored in the cache easier. (It's not yet in official but can be found in the branch cache/64.PrintCallGraph.) There are three ways it allows you to search the graph log:
- By top-level model. If the build has been completed it will print its entire call tree. If the build was stopped before it completed (even if it failed with a problem like a compilation error), partial call trees for the portions in the cache will be printed.
- By cache index. It will print the entire call tree below a cache index.
- By derived file shortid. It will find any cache entries which protect the specified derived file and print partial call trees for those entries.
Unfortunately, PrintCallGraph can use a lot of memory. It needs to essentially read the entire graph log into memory (unlike PrintGraphLog which simply prints each entry after reading it). For that reason it provides a feature to tell you how much memory it used. Just add "--mem" to the command line.
Examples
Searching by top-level model, showing an incomplete build:
- Command line:
PrintCallGraph --model /vesta/vestasys.org/vesta/release/12.pre13/10/linux_x86_64_deb_sarge.main.ves
- Ouput:
/vesta/vestasys.org/vesta/release/12.pre13/10/linux_x86_64_deb_sarge.main.ves Evaluated at: Sun Aug 19 13:56:18 EDT 2007 Build was incomplete 12 call tree(s) follow ci = 13256 pk = ab6ec2cfbf411716 a5ef62bd5cfba296 sourceFunc = /vesta/vestasys.org/vesta/release/12.pre13/10/pkg_ovs.ves() (special) ci = 9460 pk = c1e87063c94ed68d 94cfc49b62d899a0 sourceFunc = /vesta/vestasys.org/platforms/linux/debian/amd64/std_env/4/build.ves() (special) ci = 9459 pk = ad116a598e8bd4de 8e77fc7b54a92931 sourceFunc = /vesta/vestasys.org/bridges/env_build/1/build.ves() (special) ci = 9498 pk = f7b8f8beb1b9be2d f1ec13105dd75afc sourceFunc = /vesta/vestasys.org/bridges/env_build/1/build.ves/env_build(), line 180, col 12 ci = 8 pk = b0314e147bd9fd75 f739ab9665d4007d sourceFunc = /vesta/vestasys.org/bridges/generics/8/build.ves() (special) ci = 9474 pk = 7f2ae7dd8df40812 fb88077256867a62 sourceFunc = /vesta/vestasys.org/bridges/env_build/1/build.ves/eval_addons(), line 221, col 18 ...
Searching by cache index:
- Command line:
PrintCallGraph --ci 13904
- Ouput:
ci = 13904 pk = 6b06deffca3f3980 ad3fc5b3081782c1 sourceFunc = /vesta/vestasys.org/bridges/generics/8/build.ves/compile(), line 379, col 12 ci = 13903 pk = 8dae46c66b775e7c 4c7a354f8e046cae sourceFunc = /vesta/vestasys.org/bridges/generics/8/build.ves/inner_map(), line 327, col 12 ci = 9783 pk = 228541f1998dccd8 dd2e4dcf2bd049e3 sourceFunc = /vesta/vestasys.org/bridges/generics/8/build.ves/compileOne(), line 413, col 12 ci = 9782 pk = 729a94628263b814 a235acdaef608262 sourceFunc = _run_tool, command line: /usr/bin/g++-3.4 -c -I -I/usr/include -I/usr/include/c++/3.4 -pipe -O0 -g2 -D_FILE_OFFSET_BITS=64 -D_REENTRANT Basics.C ci = 13902 pk = 9137a08f1babdbda e39345d11c86c6c3 sourceFunc = /vesta/vestasys.org/bridges/generics/8/build.ves/compileOne(), line 413, col 12 ci = 13901 pk = 867c01c35a90e465 a443d6b8d3adc25e sourceFunc = _run_tool, command line: /usr/bin/g++-3.4 -c -I -I/usr/include -I/usr/include/c++/3.4 -pipe -O0 -g2 -D_FILE_OFFSET_BITS=64 -D_REENTRANT Thread.C ci = 9785 pk = 84006aff0cafe8c9 898e169c089a115b sourceFunc = /vesta/vestasys.org/bridges/generics/8/build.ves/compileOne(), line 413, col 12 ci = 9784 pk = cdc26a48b5554b88 e7d527c62a17770a sourceFunc = _run_tool, command line: /usr/bin/g++-3.4 -c -I -I/usr/include -I/usr/include/c++/3.4 -pipe -O0 -g2 -D_FILE_OFFSET_BITS=64 -D_REENTRANT SizeAssert.C ...
Searching by derived file:
- Command line:
PrintCallGraph --derived-file 0xb9859851
- Ouput:
Found 34 call trees referring to derived file 0xb9859851 ci = 11545 pk = 49c6edcc07dd614a 6a6e749ca2be4ec7 sourceFunc = /vesta/vestasys.org/vesta/cache/checkout/64.ken_xorian.net.4/7/src/docs.ves() (special) ci = 957 [No reference to derived 0xb9859851] ci = 11357 [No reference to derived 0xb9859851] ci = 11378 [No reference to derived 0xb9859851] ci = 11544 pk = 2404f30a886aef53 1a851effbb1e2bd2 sourceFunc = /vesta/vestasys.org/vesta/cache/checkout/64.ken_xorian.net.4/7/src/server/docs.ves() (special) ci = 11543 pk = 7fe6ba32bb4bc34e dd8c9169a6cfa5fb sourceFunc = /vesta/vestasys.org/bridges/mtex/1/build.ves/mtex(), line 83, col 9 ci = 11262 [No reference to derived 0xb9859851] ci = 11542 pk = 2c8f3695172b80a3 b344d44f939fd060 sourceFunc = /vesta/vestasys.org/bridges/mtex/1/build.ves/mtex(), line 83, col 9 ci = 11262 [No reference to derived 0xb9859851] ci = 11508 [No reference to derived 0xb9859851] ci = 11541 pk = f20d4c257767c26f 1aa28b1f05fe072e sourceFunc = /vesta/vestasys.org/bridges/mtex/1/build.ves/mtex(), line 83, col 9 ci = 11262 [No reference to derived 0xb9859851] ci = 11421 pk = 37434e39a4f08e0f aa26b89dd8ca32be sourceFunc = /vesta/vestasys.org/bridges/mtex/1/build.ves/run_both(), line 25, col 13 ci = 11399 pk = bac7223dad8bf05d 6d2d9e8d4b2b7678 sourceFunc = /vesta/vestasys.org/bridges/lim/2/build.ves/lim(), line 18, col 8 ci = 11262 [No reference to derived 0xb9859851] ci = 11398 pk = 5f6d94a10c3c3100 d6aae1e475ed8f5f sourceFunc = _run_tool, command line: lim mtex2html.lim ci = 11420 [No reference to derived 0xb9859851] ci = 11462 [No reference to derived 0xb9859851] ci = 11492 [No reference to derived 0xb9859851] ci = 11516 [No reference to derived 0xb9859851] ci = 11540 [No reference to derived 0xb9859851] ci = 11529 [No reference to derived 0xb9859851] ...