[PATCH] D78903: [Driver] Add option -fproc-stat-report

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 13:45:11 PDT 2020


aganea added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:3782
+          = Cmd.getProcessStatistics();
+      if (ProcStat) {
+        if (PrintProcessStat) {
----------------
In the case where `!ProcStat`, I am wondering if we shouldn't emit zero values, in the report file at least. Otherwise if an invocation fails, it won't be there in the report and we might wonder why. Emitting 0 might indicate that something went wrong.


================
Comment at: clang/lib/Driver/Driver.cpp:3814
+          llvm::raw_fd_ostream OS(StatReportFile, EC, llvm::sys::fs::OF_Append);
+          if (!EC) {
+            if (auto L = OS.tryToLock())
----------------
If the goal is to report accurate information, maybe it's worth looping here a bit in case of an error, to give the chance to other clang.exe instances to release the file lock? What do you think? (same for `tryToLock`)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78903/new/

https://reviews.llvm.org/D78903





More information about the cfe-commits mailing list