LLVM
22.0.0git
include
llvm
XRay
BlockIndexer.h
Go to the documentation of this file.
1
//===- BlockIndexer.h - FDR Block Indexing Visitor ------------------------===//
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
// An implementation of the RecordVisitor which generates a mapping between a
10
// thread and a range of records representing a block.
11
//
12
//===----------------------------------------------------------------------===//
13
#ifndef LLVM_XRAY_BLOCKINDEXER_H
14
#define LLVM_XRAY_BLOCKINDEXER_H
15
16
#include "
llvm/ADT/DenseMap.h
"
17
#include "
llvm/Support/Compiler.h
"
18
#include "
llvm/XRay/FDRRecords.h
"
19
#include <cstdint>
20
#include <vector>
21
22
namespace
llvm::xray
{
23
24
// The BlockIndexer will gather all related records associated with a
25
// process+thread and group them by 'Block'.
26
class
LLVM_ABI
BlockIndexer
:
public
RecordVisitor
{
27
public
:
28
struct
Block
{
29
uint64_t
ProcessID
;
30
int32_t
ThreadID
;
31
WallclockRecord
*
WallclockTime
;
32
std::vector<Record *>
Records
;
33
};
34
35
// This maps the process + thread combination to a sequence of blocks.
36
using
Index
=
DenseMap<std::pair<uint64_t, int32_t>
, std::vector<Block>>;
37
38
private
:
39
Index
&Indices;
40
41
Block
CurrentBlock{0, 0,
nullptr
, {}};
42
43
public
:
44
explicit
BlockIndexer
(
Index
&
I
) : Indices(
I
) {}
45
46
Error
visit
(
BufferExtents
&)
override
;
47
Error
visit
(
WallclockRecord
&)
override
;
48
Error
visit
(
NewCPUIDRecord
&)
override
;
49
Error
visit
(
TSCWrapRecord
&)
override
;
50
Error
visit
(
CustomEventRecord
&)
override
;
51
Error
visit
(
CallArgRecord
&)
override
;
52
Error
visit
(
PIDRecord
&)
override
;
53
Error
visit
(
NewBufferRecord
&)
override
;
54
Error
visit
(
EndBufferRecord
&)
override
;
55
Error
visit
(
FunctionRecord
&)
override
;
56
Error
visit
(
CustomEventRecordV5
&)
override
;
57
Error
visit
(
TypedEventRecord
&)
override
;
58
59
/// The flush() function will clear out the current state of the visitor, to
60
/// allow for explicitly flushing a block's records to the currently
61
/// recognized thread and process combination.
62
Error
flush();
63
};
64
65
}
// namespace llvm::xray
66
67
#endif
// LLVM_XRAY_BLOCKINDEXER_H
Compiler.h
LLVM_ABI
#define LLVM_ABI
Definition
Compiler.h:213
DenseMap.h
This file defines the DenseMap class.
FDRRecords.h
I
#define I(x, y, z)
Definition
MD5.cpp:58
visit
void visit(MachineFunction &MF, MachineBasicBlock &Start, std::function< void(MachineBasicBlock *)> op)
Definition
SPIRVPostLegalizer.cpp:125
llvm::DenseMap
Definition
DenseMap.h:701
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition
Error.h:159
llvm::xray::BlockIndexer::BlockIndexer
BlockIndexer(Index &I)
Definition
BlockIndexer.h:44
llvm::xray::BlockIndexer::Index
DenseMap< std::pair< uint64_t, int32_t >, std::vector< Block > > Index
Definition
BlockIndexer.h:36
llvm::xray::BufferExtents
Definition
FDRRecords.h:110
llvm::xray::CallArgRecord
Definition
FDRRecords.h:291
llvm::xray::CustomEventRecordV5
Definition
FDRRecords.h:235
llvm::xray::CustomEventRecord
Definition
FDRRecords.h:206
llvm::xray::EndBufferRecord
Definition
FDRRecords.h:359
llvm::xray::FunctionRecord
Definition
FDRRecords.h:372
llvm::xray::NewBufferRecord
Definition
FDRRecords.h:336
llvm::xray::NewCPUIDRecord
Definition
FDRRecords.h:158
llvm::xray::PIDRecord
Definition
FDRRecords.h:313
llvm::xray::RecordVisitor
Definition
FDRRecords.h:399
llvm::xray::TSCWrapRecord
Definition
FDRRecords.h:184
llvm::xray::TypedEventRecord
Definition
FDRRecords.h:262
llvm::xray::WallclockRecord
Definition
FDRRecords.h:133
uint64_t
llvm::xray
Definition
BlockIndexer.h:22
llvm::xray::BlockIndexer::Block
Definition
BlockIndexer.h:28
llvm::xray::BlockIndexer::Block::ThreadID
int32_t ThreadID
Definition
BlockIndexer.h:30
llvm::xray::BlockIndexer::Block::ProcessID
uint64_t ProcessID
Definition
BlockIndexer.h:29
llvm::xray::BlockIndexer::Block::Records
std::vector< Record * > Records
Definition
BlockIndexer.h:32
llvm::xray::BlockIndexer::Block::WallclockTime
WallclockRecord * WallclockTime
Definition
BlockIndexer.h:31
Generated on
for LLVM by
1.14.0