clang-tools 10.0.0

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 "llvm/Support/raw_ostream.h"
17 #include <string>
18 #include <utility>
19 #include <vector>
20
21 namespace clang {
22 namespace tidy {
23
24 class ClangTidyProfiling {
25 public:
26 struct StorageParams {
27 llvm::sys::TimePoint<> Timestamp;
28 std::string SourceFilename;
29 std::string StoreFilename;
30
31 StorageParams() = default;
32
33 StorageParams(llvm::StringRef ProfilePrefix, llvm::StringRef SourceFile);
34 };
35
36 private:
37 llvm::Optional<llvm::TimerGroup> TG;
38
39 llvm::Optional<StorageParams> Storage;
40
41 void printUserFriendlyTable(llvm::raw_ostream &OS);
42 void printAsJSON(llvm::raw_ostream &OS);
43
44 void storeProfileData();
45
46 public:
47 llvm::StringMap<llvm::TimeRecord> Records;
48
49 ClangTidyProfiling() = default;
50
51 ClangTidyProfiling(llvm::Optional<StorageParams> Storage);
52
53 ~ClangTidyProfiling();
54 };
55
56 } // end namespace tidy
57 } // end namespace clang
58
59 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
clang::tidy::ClangTidyProfiling::StorageParams::StorageParams
StorageParams()=default
clang::tidy::ClangTidyProfiling::~ClangTidyProfiling
~ClangTidyProfiling()
Definition: ClangTidyProfiling.cpp:82
clang::tidy::ClangTidyProfiling
Definition: ClangTidyProfiling.h:24
clang::tidy::ClangTidyProfiling::StorageParams::StoreFilename
std::string StoreFilename
Definition: ClangTidyProfiling.h:29
clang::tidy::ClangTidyProfiling::StorageParams::SourceFilename
std::string SourceFilename
Definition: ClangTidyProfiling.h:28
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::tidy::ClangTidyProfiling::StorageParams::Timestamp
llvm::sys::TimePoint Timestamp
Definition: ClangTidyProfiling.h:27
clang::tidy::ClangTidyProfiling::Records
llvm::StringMap< llvm::TimeRecord > Records
Definition: ClangTidyProfiling.h:47
clang::tidy::ClangTidyProfiling::StorageParams
Definition: ClangTidyProfiling.h:26
clang::tidy::ClangTidyProfiling::ClangTidyProfiling
ClangTidyProfiling()=default