• Sigurd Schneider's avatar
    [tools] Add script to count lines of code · 53dcadfe
    Sigurd Schneider authored
    This script counts lines of code before and after preprocessor expansion.
    When running:
      tools/locs.py --build-dir out.gn/repro --smallest --largest --worst
    in the v8 directory, it reports:
    
    Processed 1,520 files in 24.62 sec.
    src         (  625 files):   365,679 to   53,468,383 ( 146.22x)
    third_party (  432 files):   239,081 to    9,502,094 (  39.74x)
    gen         (   19 files):    64,040 to    1,415,287 (  22.10x)
    total       ( 1520 files): 1,173,349 to  102,831,949 (  87.64x)
    test        (  392 files):   489,865 to   37,476,036 (  76.50x)
    Largest 3 files after expansion:
       33,495 to      140,401 (   4.19x) gen/torque-generated/builtins-array-from-dsl-gen.cc
      100,014 to      140,111 (   1.40x) ../../test/cctest/gay-precision.cc
      100,014 to      140,110 (   1.40x) ../../test/cctest/gay-shortest.cc
    Worst expansion (3 files):
            6 to      100,826 (14403.71x) ../../test/fuzzer/wasm-data-section.cc
            6 to      100,826 (14403.71x) ../../test/fuzzer/wasm-function-sigs-section.cc
            6 to      100,826 (14403.71x) ../../test/fuzzer/wasm-globals-section.cc
    Smallest 3 input files:
            0 to            0 (   0.00x) ../../testing/gtest/empty.cc
            1 to            0 (   0.00x) ../../src/x64/simulator-x64.cc
            4 to        4,423 ( 884.60x) ../../buildtools/third_party/libc++/trunk/src/utility.cpp
    
    Notry: true
    Change-Id: Ie1da942463d9e6a84338a9bd57d9ddc46d2856dc
    Reviewed-on: https://chromium-review.googlesource.com/c/1349571
    Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
    Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#57822}
    53dcadfe
locs.py 10.7 KB