File indexing completed on 2026-05-10 08:36:23
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
0011
0012 #include "llvm/ADT/StringMap.h"
0013 #include "llvm/Support/Chrono.h"
0014 #include "llvm/Support/Timer.h"
0015 #include <optional>
0016 #include <string>
0017
0018 namespace llvm {
0019 class raw_ostream;
0020 }
0021
0022 namespace clang::tidy {
0023
0024 class ClangTidyProfiling {
0025 public:
0026 struct StorageParams {
0027 llvm::sys::TimePoint<> Timestamp;
0028 std::string SourceFilename;
0029 std::string StoreFilename;
0030
0031 StorageParams() = default;
0032
0033 StorageParams(llvm::StringRef ProfilePrefix, llvm::StringRef SourceFile);
0034 };
0035
0036 private:
0037 std::optional<StorageParams> Storage;
0038
0039 void printUserFriendlyTable(llvm::raw_ostream &OS, llvm::TimerGroup &TG);
0040 void printAsJSON(llvm::raw_ostream &OS, llvm::TimerGroup &TG);
0041 void storeProfileData(llvm::TimerGroup &TG);
0042
0043 public:
0044 llvm::StringMap<llvm::TimeRecord> Records;
0045
0046 ClangTidyProfiling() = default;
0047
0048 ClangTidyProfiling(std::optional<StorageParams> Storage);
0049
0050 ~ClangTidyProfiling();
0051 };
0052
0053 }
0054
0055 #endif