This is an archive of the discontinued LLVM Phabricator instance.

[clang][deps] Print timing information
ClosedPublic

Authored by jansvoboda11 on Apr 7 2023, 2:56 PM.

Details

Summary

This patch adds new -print-timing option to clang-scan-deps. It measures the wall and process time taken to scan dependencies for the compilation database. This provides more representative data compared to measuring the timing for the whole tool invocation, since that includes parsing and generating JSON files, which can be significant for larger inputs.

Diff Detail

Event Timeline

jansvoboda11 created this revision.Apr 7 2023, 2:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2023, 2:56 PM
Herald added a subscriber: ributzka. · View Herald Transcript
jansvoboda11 requested review of this revision.Apr 7 2023, 2:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2023, 2:56 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
akyrtzi added a comment.EditedApr 7 2023, 3:17 PM

Could you also add a -terse option, to avoid printing the full dependency info, if you mainly want to get the timing? Something like this:

T.stopTimer();
if (PrintTiming)
  llvm::errs() << llvm::format(
      "clang-scan-deps timing: %0.2fs wall, %0.2fs process\n",
      T.getTotalTime().getWallTime(), T.getTotalTime().getProcessTime());

if (Terse) {
  if (Format == ScanningOutputFormat::Full) {
    llvm::errs() << "num modules: " << FD->getNumModules() << '\n';
  }

  return HadErrors;
}

Where getNumModules() is

size_t getNumModules() const {
  return Modules.size();
}

So you still get some very high-level info but not the whole dump of info.

Could you also add a -terse option, to avoid printing the full dependency info

Note I added something like this in https://reviews.llvm.org/D148369, so ignore it for this patch.

akyrtzi accepted this revision.Apr 14 2023, 1:24 PM
This revision is now accepted and ready to land.Apr 14 2023, 1:24 PM
This revision was automatically updated to reflect the committed changes.