clang-tools 19.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/StringMap.h"
13#include "llvm/Support/Chrono.h"
14#include "llvm/Support/Timer.h"
15#include <optional>
16#include <string>
17
18namespace llvm {
19class raw_ostream;
20} // namespace llvm
21
22namespace clang::tidy {
23
25public:
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
36private:
37 std::optional<llvm::TimerGroup> TG;
38
39 std::optional<StorageParams> Storage;
40
41 void printUserFriendlyTable(llvm::raw_ostream &OS);
42 void printAsJSON(llvm::raw_ostream &OS);
43
44 void storeProfileData();
45
46public:
47 llvm::StringMap<llvm::TimeRecord> Records;
48
49 ClangTidyProfiling() = default;
50
51 ClangTidyProfiling(std::optional<StorageParams> Storage);
52
54};
55
56} // namespace clang::tidy
57
58#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYPROFILING_H
llvm::raw_string_ostream OS
Definition: TraceTests.cpp:160
llvm::StringMap< llvm::TimeRecord > Records
Some operations such as code completion produce a set of candidates.