1 //===--- ClangTidyProfiling.h - clang-tidy ----------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
12 #include "llvm/ADT/Optional.h"
13 #include "llvm/ADT/StringMap.h"
14 #include "llvm/Support/Chrono.h"
15 #include "llvm/Support/Timer.h"
25 class ClangTidyProfiling
{
27 struct StorageParams
{
28 llvm::sys::TimePoint
<> Timestamp
;
29 std::string SourceFilename
;
30 std::string StoreFilename
;
32 StorageParams() = default;
34 StorageParams(llvm::StringRef ProfilePrefix
, llvm::StringRef SourceFile
);
38 llvm::Optional
<llvm::TimerGroup
> TG
;
40 llvm::Optional
<StorageParams
> Storage
;
42 void printUserFriendlyTable(llvm::raw_ostream
&OS
);
43 void printAsJSON(llvm::raw_ostream
&OS
);
45 void storeProfileData();
48 llvm::StringMap
<llvm::TimeRecord
> Records
;
50 ClangTidyProfiling() = default;
52 ClangTidyProfiling(llvm::Optional
<StorageParams
> Storage
);
54 ~ClangTidyProfiling();
57 } // end namespace tidy
58 } // end namespace clang
60 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H