Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: no clang -ftime-trace .json files found under <dir> #45

Closed
tomager opened this issue Apr 26, 2020 · 5 comments
Closed

ERROR: no clang -ftime-trace .json files found under <dir> #45

tomager opened this issue Apr 26, 2020 · 5 comments

Comments

@tomager
Copy link

tomager commented Apr 26, 2020

I am not able to get simple trace running successfully through this tool. From a freshly cloned and built tree, I run:

# ./ClangBuildAnalyzer  --start /tmp
Build tracing started. Do some Clang builds with '-ftime-trace', then run 'ClangBuildAnalyzer --stop /tmp <filename>' to stop tracing and save session to a file.
# clang <various options...> -o /tmp/main.cc.o -c /tmp/main.cc -ftime-trace -ftime-report
ls /tmp
# ls /tmp/main*
/tmp/main.cc.json  /tmp/main.cc.o
# ./ClangBuildAnalyzer --stop /tmp /tmp/report
Stopping build tracing and saving to '/tmp/report'...
ERROR: no clang -ftime-trace .json files found under '/tmp'.

Seems to find the json file and fail while parsing it (within ParseBuildEvents in the code). The clang version is 11/head, downloaded and built today. Chrome can read and display the file successfully within chrome://tracing.

Any ideas? My apologies if I'm missing something obvious, and thank you for producing this tool and -ftime-trace. Incredibly useful.

@aras-p
Copy link
Owner

aras-p commented Apr 26, 2020

Can you share the /tmp/main.cc.json file?

@tomager
Copy link
Author

tomager commented Apr 26, 2020 via email

@tomager
Copy link
Author

tomager commented Apr 26, 2020

test.json:

{"traceEvents":[{"pid":43147,"tid":43147,"ph":"X","ts":1905,"dur":1568,"name":"Frontend"},{"pid":43147,"tid":43147,"ph":"X","ts":5589,"dur":639,"name":"RunPass","args":{"detail":"Expand Atomic instructions"}},{"pid":43147,"tid":43147,"ph":"X","ts":5588,"dur":712,"name":"OptFunction","args":{"detail":"main"}},{"pid":43147,"tid":43147,"ph":"X","ts":6303,"dur":535,"name":"OptFunction","args":{"detail":"main"}},{"pid":43147,"tid":43147,"ph":"X","ts":5433,"dur":1565,"name":"OptModule","args":{"detail":"test.cc"}},{"pid":43147,"tid":43147,"ph":"X","ts":5410,"dur":1604,"name":"CodeGenPasses"},{"pid":43147,"tid":43147,"ph":"X","ts":3534,"dur":3537,"name":"Backend"},{"pid":43147,"tid":43147,"ph":"X","ts":11,"dur":7270,"name":"ExecuteCompiler"},{"pid":43147,"tid":43148,"ph":"X","ts":0,"dur":7270,"name":"Total ExecuteCompiler","args":{"count":1,"avg ms":7}},{"pid":43147,"tid":43149,"ph":"X","ts":0,"dur":3536,"name":"Total Backend","args":{"count":1,"avg ms":3}},{"pid":43147,"tid":43150,"ph":"X","ts":0,"dur":1622,"name":"Total Frontend","args":{"count":2,"avg ms":0}},{"pid":43147,"tid":43151,"ph":"X","ts":0,"dur":1603,"name":"Total CodeGenPasses","args":{"count":1,"avg ms":1}},{"pid":43147,"tid":43152,"ph":"X","ts":0,"dur":1585,"name":"Total OptModule","args":{"count":2,"avg ms":0}},{"pid":43147,"tid":43153,"ph":"X","ts":0,"dur":1299,"name":"Total OptFunction","args":{"count":3,"avg ms":0}},{"pid":43147,"tid":43154,"ph":"X","ts":0,"dur":1258,"name":"Total RunPass","args":{"count":61,"avg ms":0}},{"pid":43147,"tid":43155,"ph":"X","ts":0,"dur":384,"name":"Total CodeGen Function","args":{"count":1,"avg ms":0}},{"pid":43147,"tid":43156,"ph":"X","ts":0,"dur":73,"name":"Total PerFunctionPasses","args":{"count":1,"avg ms":0}},{"pid":43147,"tid":43157,"ph":"X","ts":0,"dur":26,"name":"Total PerModulePasses","args":{"count":1,"avg ms":0}},{"pid":43147,"tid":43158,"ph":"X","ts":0,"dur":4,"name":"Total PerformPendingInstantiations","args":{"count":1,"avg ms":0}},{"cat":"","pid":43147,"tid":43147,"ts":0,"ph":"M","name":"process_name","args":{"name":"clang-11"}},{"cat":"","pid":43147,"tid":43147,"ts":0,"ph":"M","name":"thread_name","args":{"name":"clang"}}],"beginningOfTime":1587922998882842}

test.cc:


int main(int argc, const char** argv) {
  return 0;
}

steps:

# /local/ClangBuildAnalyzer/ClangBuildAnalyzer  --start .
Build tracing started. Do some Clang builds with '-ftime-trace', then run 'ClangBuildAnalyzer --stop . <filename>' to stop tracing and save session to a file.
# /build/llvm/bin/clang -o test -c test.cc -ftime-trace
# /local/ClangBuildAnalyzer/ClangBuildAnalyzer  --stop . report
Stopping build tracing and saving to 'report'...
ERROR: no clang -ftime-trace .json files found under '.'.

@aras-p aras-p closed this as completed in 6df280f Apr 27, 2020
@aras-p
Copy link
Owner

aras-p commented Apr 27, 2020

Ah seems that latest Clang/LLVM head has changed the format a bit, your repro was very helpful. Should be fixed now, thanks!

@tomager
Copy link
Author

tomager commented Apr 28, 2020

This fixes it for me. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants