Phyronnaz / UECompileTimesVisualizer

Debug compile times in Unreal Engine & MSVC projects
MIT License
142 stars 14 forks source link

Python parser fails on msvc 2017(v141) toolchain 14.16.27023 #4

Open phwissmann opened 5 years ago

phwissmann commented 5 years ago

Hi I'm trying your tool with MSVC 2017(v141) and get the following issues

MSVC log file detected main.cpp Parsing includes... Parsing 48 items... Includes parsed! Parsing classes... Parsing 510 items... Classes parsed! Parsing functions... Parsing 204 items... Functions parsed! Traceback (most recent call last): File "main.py", line 335, in <module> parse_beginstring("time(") File "main.py", line 188, in parse_beginstring assert line.startswith(string), "{} does not start with {}".format(line, string) AssertionError: crc.cpp does not start with time(

When I patch the script by if try_parse_string("time("): parse_beginstring("time(")

adding on line 355 I get this

Traceback (most recent call last): File "main.py", line 276, in <module> assert False, "Invalid file name: " + line AssertionError: Invalid file name: Generating Code...

My log file at that stage looks like this: ` time(C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\c1xx.dll)=1.29531s < 90845892721 - 90850567985 > [A_PATH_TO_A_FILE.cpp] Generating Code... Code Generation Summary Total Function Count: 182 Elapsed Time: 0.010 sec Total Compilation Time: 0.034 sec Average time per function: 0.000 sec Anomalistic Compile Times: 3 SOME LINKER WARNINGS

RdrReadProc Caching Stats Functions Cached: 0 Retrieved Count: 0 Abandoned Retrieval Count: 0 Abandoned Caching Count: 0 Wasted Caching Attempts: 0 Functions Retrieved at Least Once: 0 Functions Cached and Never Retrieved: 0 Most Hits: Least Hits: `

Am I inadvertently adding any flags that change the output?

McMartin commented 5 years ago

I'm getting the same issue. I think it is due to the fact that VS runs the frontend (c1xx) on all files before running the backend (c2) on them, while the script expects all the information about a single file to be together.

gjaegy commented 5 years ago

Same problem here.Any idea how we can fix that ?

Jaa-c commented 5 years ago

I'm having the same problem in 14.15.x version. This seems to happen only if you compile project to a dll. Here is a simple log that reproduces the problem. It creates foo.dll from two classes (fooa/foob) and then links it to main.exe sample.txt

Jaa-c commented 5 years ago

I made a simple script that fixes compilation output to the expected format for UECompileTimesVisualizer. It's totally specific for my case (Qt project), but might help someone else too... It's quite simple, shouldn't be too hard to tweak for other cases. I tried to update the original script, but failed miserably :(