Issue 113699
Summary ftime-trace: ParseDeclarationOrFunctionDefinition ends after its Source event
Labels new issue
Assignees
Reporter zammisget45
    Given a 1.cpp
```
#include <string.h>
```
executing `clang -c -ftime-trace 1.cpp` sometimes produce a json file with contents like the following:
(first few traceEvents, pid and tid were identical and cut for readability)

```
{"ts":1352,"cat":"Source","ph":"b","id":0,"name":"Source","args":{"detail":"/usr/include/features.h"}},
{"ts":1950,"cat":"Source","ph":"e","id":0,"name":"Source"},
{"ts":1307,"cat":"Source","ph":"b","id":0,"name":"Source","args":{"detail":"/usr/include/bits/libc-header-start.h"}},
{"ts":1967,"cat":"Source","ph":"e","id":0,"name":"Source"},
{"ts":1269,"cat":"Source","ph":"b","id":0,"name":"Source","args":{"detail":"/usr/include/string.h"}},
{"ts":4405,"cat":"Source","ph":"e","id":0,"name":"Source"},
{"ts":1982,"ph":"X","dur":2424,"name":"ParseDeclarationOrFunctionDefinition","args":{"detail":"/usr/include/string.h:28:1 <Spelling=/usr/include/sys/cdefs.h:140:24>"}},
{"ts":927,"ph":"X","dur":3503,"name":"Frontend"},
{"ts":4471,"ph":"X","dur":554,"name":"Backend"},
{"ts":10,"ph":"X","dur":5050,"name":"ExecuteCompiler"},
```

Note that *ParseDeclarationOrFunctionDefinition* ends at 4406, i.e. after the end of the Source event for *string.h* at 4405. Running this a few times will also produce reports where *ParseDeclarationOrFunctionDefinition* ends in the same millisecond as its Source event (which is ok).
Replacing 'string.h' with something bigger like 'list' will reliably produce *ParseDeclarationOrFunctionDefinition* events ending (10+ ms) after their Source events.

AFAICT the problem was introduced with the fixes for #56554.

I was able to reproduce it with
d6e714b10e102eb32e64e04bf177226dbe16d0e7 (Oct 2024)
83eb8aee4bf9d518b3a2b485640207e7717805b4 (Mar 2024, fix for #56554)

I could not reproduce the problem with
71b69dd21becdfbf8922674ce6ca4129926660ab (Mar 2024, before the fixes for #56554)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to