Skip to content

Includes analyzer

Anna Berdichevskaya edited this page Feb 3, 2022 · 1 revision

To analyze includes in SPAdes source files, you can use an Include analyzer tool. Follow next steps:

  1. Generate build.ninja file via command cmake ../src -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja -DCMAKE_C_FLAGS="-H" -DCMAKE_CXX_FLAGS="-H".
  2. Create file build_log.txt.
  3. Run ninja | tee ninja_log.txt.
  4. Run python3 analyze_includes.py --target=spades-core --revision=$(git rev-parse --short HEAD) --json-out=include-analysis.js build_log.txt. You also can add argument --roo_filter to define which files will count in statistics. For example, to look only at files from /src directory, use --root-filter="[./]/src/.".
  5. As a result of a previous step you will get include-analysis.js file that accompanies include-analysis.html. Open html page to see the results.

html file contains per-file and per-edge analysis. Information about each file:

  1. Individual size - the size of a file itself in bytes.
  2. Expanded size - the size of the file and all the files it includes, directly and indirectly.
  3. Added size - the size added by this file being part of the build. In other words, if this file were empty and had no includes, how much smaller would the build be.
  4. Accurance - number of translation units that this file is part of.
  5. Directly Included In - number of files that containe considered file as a direct include.
  6. Direct Includes - number of includes in this file (only files that match --root_filter count).

Information about each edge:

  1. File-includer.
  2. Included file.
  3. Added Size - the size added to includer file by this include.
Clone this wiki locally