Added supporting CC_PRINT_PROC_STAT and CC_PRINT_PROC_STAT_FILE environment variables to trigger clang driver reporting the process statistics into specified file (alternate for -fproc-stat-report option).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
clang/include/clang/Driver/Driver.h | ||
---|---|---|
210 | Strictly speaking it is driver that dumps performance report, not frontend. |
clang/include/clang/Driver/Driver.h | ||
---|---|---|
210 | Thanks, I have updated the comment accordingly. |
clang/lib/Driver/Driver.cpp | ||
---|---|---|
1107 | Please remove, getLastArg already claims all arguments for this option. | |
4031 | I think the code below is safe-explanatory, I don't think you need this comment, it doesn't add much value. | |
4050 | The previous behavior was printing both the output and the CSV file when specifying -fproc-stat-report -fproc-stat-report=file.csv, now it would only emit the CSV, is that intended? @sepavloff what do you think? | |
clang/test/Driver/cc-print-proc-stat.c | ||
2 | Could you please expand a bit the test to entirely cover all the codepaths above? |
Thank you @aganea
Updated diff:
- removed ClaimAllArgs for OPT_fproc_stat_report_EQ (used in getLastArg);
- used const char* instead of std::string for CCPrintStatReportFilename;
- removed unnecessary comment
clang/lib/Driver/Driver.cpp | ||
---|---|---|
4050 |
yes, I thought in that way. I dоn't think that usage of both options at the same time was specially designed. I don't see a reasonable usage case for that for now actually, but I could be wrong. @sepavloff ? |
clang/lib/Driver/Driver.cpp | ||
---|---|---|
4050 |
The previous behavior (printing both the output and the CSV file) was not intentional, it was the implementation peculiarity. I don't see real use case for both outputs. |
Thanks for the update @vvereschaka ! Just a few minor things and it should be good to go.
Also please use git diff -U99999 next time to add context to the patch.
clang/docs/UsersManual.rst | ||
---|---|---|
783 | I think this should read "In this case statistics are printed.." Would you mind changing this as well? | |
799 | Do you think it would be possible to rephrase a bit to avoid the repetition of CC_PRINT_PROC_STAT_FILE? Perhaps also explicitate that CC_PRINT_PROC_STAT is for "enabling the feature and logging to stdout"; while CC_PRINT_PROC_STAT_FILE only "redirects the log to a file". | |
clang/lib/Driver/Driver.cpp | ||
1108 | Remove this too, hasArg claims all arguments. | |
4039 | Suggestion: I find if (!CCPrintStatReportFilename) more intutive, more compact and easier to read, but that's my personal preference. There are arguments both ways probably, up to you. |
Updated diff:
- rewording the doc part
- removed ClaimAllArgs for OPT_fproc_stat_report
- updated if statement for CCPrintStatReportFilename
LGTM, just a few minor things:
clang/docs/UsersManual.rst | ||
---|---|---|
798 | "enables the feature, the report goes to | |
800 | " | |
804 | Would you be able to merge this paragraph with the following one please? It could be something like: "These environment variables are handy when you need to request the statistics report without changing your build scripts or alter the existing set of compiler options. Note that -fproc-stat-report take precedence over CC_PRINT_PROC_STAT and CC_PRINT_PROC_STAT_FILE." |
Updated diff:
- updated doc parts
@aganea thanks a lot for your suggestions for doc improvements. I have updated it accordingly.
I think this should read "In this case statistics are printed.." Would you mind changing this as well?