clang-tools  14.0.0git
ClangTidyProfiling.h
Go to the documentation of this file.
1 //===--- ClangTidyProfiling.h - clang-tidy ----------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
11 
12 #include "llvm/ADT/Optional.h"
13 #include "llvm/ADT/StringMap.h"
14 #include "llvm/Support/Chrono.h"
15 #include "llvm/Support/Timer.h"
16 #include <string>
17 
18 namespace llvm {
19 class raw_ostream;
20 } // namespace llvm
21 
22 namespace clang {
23 namespace tidy {
24 
26 public:
27  struct StorageParams {
28  llvm::sys::TimePoint<> Timestamp;
29  std::string SourceFilename;
30  std::string StoreFilename;
31 
32  StorageParams() = default;
33 
34  StorageParams(llvm::StringRef ProfilePrefix, llvm::StringRef SourceFile);
35  };
36 
37 private:
38  llvm::Optional<llvm::TimerGroup> TG;
39 
40  llvm::Optional<StorageParams> Storage;
41 
42  void printUserFriendlyTable(llvm::raw_ostream &OS);
43  void printAsJSON(llvm::raw_ostream &OS);
44 
45  void storeProfileData();
46 
47 public:
48  llvm::StringMap<llvm::TimeRecord> Records;
49 
50  ClangTidyProfiling() = default;
51 
52  ClangTidyProfiling(llvm::Optional<StorageParams> Storage);
53 
55 };
56 
57 } // end namespace tidy
58 } // end namespace clang
59 
60 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
clang::tidy::ClangTidyProfiling::StorageParams
Definition: ClangTidyProfiling.h:27
clang::tidy::ClangTidyProfiling::Records
llvm::StringMap< llvm::TimeRecord > Records
Definition: ClangTidyProfiling.h:48
clang::tidy::ClangTidyProfiling
Definition: ClangTidyProfiling.h:25
llvm
Some operations such as code completion produce a set of candidates.
Definition: YAMLGenerator.cpp:28
clang::tidy::ClangTidyProfiling::StorageParams::StorageParams
StorageParams()=default
clang::tidy::ClangTidyProfiling::StorageParams::StoreFilename
std::string StoreFilename
Definition: ClangTidyProfiling.h:30
clang::tidy::ClangTidyProfiling::StorageParams::SourceFilename
std::string SourceFilename
Definition: ClangTidyProfiling.h:29
clang::tidy::ClangTidyProfiling::StorageParams::Timestamp
llvm::sys::TimePoint Timestamp
Definition: ClangTidyProfiling.h:28
clang::tidy::ClangTidyProfiling::ClangTidyProfiling
ClangTidyProfiling()=default
clang::tidy::ClangTidyProfiling::~ClangTidyProfiling
~ClangTidyProfiling()
Definition: ClangTidyProfiling.cpp:80
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
OS
llvm::raw_string_ostream OS
Definition: TraceTests.cpp:163