This is an archive of the discontinued LLVM Phabricator instance.

[time-report] Add timers to codegen actions
Needs ReviewPublic

Authored by weiwang on Mar 30 2022, 1:09 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Time report does not show time spent in frontend, optimizer and codegen passes clearly:

  1. The total time of pass timer group usually over-estimates due to the inclusion of wrapper passes.
  2. "Code Generation Time" includes both optimizer and codegen passes.
  3. "LLVM IR Generation Time" only counts IR codegen, but missing out the parsing time.
  4. "Clang front-end timer" measures the total frontend action execution, but it has the problem of resetting itself prematurely in the case of multiple actions being dispatched because the timer is attached to the global CompilerInstance.

This change adds timers for frontend parsing, IR codegen, optimizer and codegen passes and put them into a new timer group. The timer points are aligned with time trace points for better consistency.

Sample output

===-------------------------------------------------------------------------===
                               Clang Compilation
===-------------------------------------------------------------------------===
  Total Execution Time: 1.1988 seconds (1.1988 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   0.9365 ( 83.9%)   0.0506 ( 61.3%)   0.9871 ( 82.3%)   0.9871 ( 82.3%)  Parse AST
   0.1275 ( 11.4%)   0.0180 ( 21.8%)   0.1455 ( 12.1%)   0.1455 ( 12.1%)  Optimizer
   0.0397 (  3.6%)   0.0139 ( 16.8%)   0.0536 (  4.5%)   0.0536 (  4.5%)  CodeGenPasses
   0.0127 (  1.1%)   0.0000 (  0.0%)   0.0127 (  1.1%)   0.0127 (  1.1%)  IR Generation
   1.1163 (100.0%)   0.0825 (100.0%)   1.1988 (100.0%)   1.1988 (100.0%)  Total

Diff Detail

Event Timeline

weiwang created this revision.Mar 30 2022, 1:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2022, 1:09 PM
Herald added subscribers: ormris, hoy, wenlei. · View Herald Transcript
weiwang requested review of this revision.Mar 30 2022, 1:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2022, 1:09 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
weiwang edited the summary of this revision. (Show Details)Mar 30 2022, 2:04 PM