LLVM
8.0.1
include
llvm
XRay
BlockIndexer.h
Go to the documentation of this file.
1
//===- BlockIndexer.h - FDR Block Indexing Visitor ------------------------===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// An implementation of the RecordVisitor which generates a mapping between a
11
// thread and a range of records representing a block.
12
//
13
//===----------------------------------------------------------------------===//
14
#ifndef LLVM_LIB_XRAY_BLOCKINDEXER_H_
15
#define LLVM_LIB_XRAY_BLOCKINDEXER_H_
16
17
#include "
llvm/ADT/DenseMap.h
"
18
#include "
llvm/XRay/FDRRecords.h
"
19
#include <cstdint>
20
#include <vector>
21
22
namespace
llvm
{
23
namespace
xray {
24
25
// The BlockIndexer will gather all related records associated with a
26
// process+thread and group them by 'Block'.
27
class
BlockIndexer
:
public
RecordVisitor
{
28
public
:
29
struct
Block
{
30
uint64_t
ProcessID
;
31
int32_t
ThreadID
;
32
WallclockRecord
*
WallclockTime
;
33
std::vector<Record *>
Records
;
34
};
35
36
// This maps the process + thread combination to a sequence of blocks.
37
using
Index
=
DenseMap<std::pair<uint64_t, int32_t>
, std::vector<Block>>;
38
39
private
:
40
Index
&Indices;
41
42
Block
CurrentBlock{0, 0,
nullptr
, {}};
43
44
public
:
45
explicit
BlockIndexer
(
Index
&
I
) :
RecordVisitor
(), Indices(I) {}
46
47
Error
visit
(
BufferExtents
&)
override
;
48
Error
visit
(
WallclockRecord
&)
override
;
49
Error
visit
(
NewCPUIDRecord
&)
override
;
50
Error
visit
(
TSCWrapRecord
&)
override
;
51
Error
visit
(
CustomEventRecord
&)
override
;
52
Error
visit
(
CallArgRecord
&)
override
;
53
Error
visit
(
PIDRecord
&)
override
;
54
Error
visit
(
NewBufferRecord
&)
override
;
55
Error
visit
(
EndBufferRecord
&)
override
;
56
Error
visit
(
FunctionRecord
&)
override
;
57
Error
visit
(
CustomEventRecordV5
&)
override
;
58
Error
visit
(
TypedEventRecord
&)
override
;
59
60
/// The flush() function will clear out the current state of the visitor, to
61
/// allow for explicitly flushing a block's records to the currently
62
/// recognized thread and process combination.
63
Error
flush
();
64
};
65
66
}
// namespace xray
67
}
// namespace llvm
68
69
#endif // LLVM_LIB_XRAY_BLOCKINDEXER_H_
llvm::xray::NewCPUIDRecord
Definition:
FDRRecords.h:159
llvm
This class represents lattice values for constants.
Definition:
AllocatorList.h:24
llvm::xray::TypedEventRecord
Definition:
FDRRecords.h:263
llvm::DenseMap
Definition:
DenseMap.h:709
llvm::xray::FunctionRecord
Definition:
FDRRecords.h:373
llvm::xray::BlockIndexer::Block::WallclockTime
WallclockRecord * WallclockTime
Definition:
BlockIndexer.h:32
llvm::xray::CustomEventRecord
Definition:
FDRRecords.h:207
llvm::xray::WallclockRecord
Definition:
FDRRecords.h:134
FDRRecords.h
llvm::xray::BlockIndexer::Block
Definition:
BlockIndexer.h:29
llvm::xray::BlockIndexer::visit
Error visit(BufferExtents &) override
Definition:
BlockIndexer.cpp:19
llvm::xray::BlockIndexer::Block::Records
std::vector< Record * > Records
Definition:
BlockIndexer.h:33
llvm::xray::NewBufferRecord
Definition:
FDRRecords.h:337
llvm::xray::RecordVisitor
Definition:
FDRRecords.h:400
llvm::xray::BufferExtents
Definition:
FDRRecords.h:111
DenseMap.h
llvm::xray::BlockIndexer::BlockIndexer
BlockIndexer(Index &I)
Definition:
BlockIndexer.h:45
llvm::xray::CallArgRecord
Definition:
FDRRecords.h:292
llvm::xray::EndBufferRecord
Definition:
FDRRecords.h:360
llvm::xray::CustomEventRecordV5
Definition:
FDRRecords.h:236
llvm::xray::PIDRecord
Definition:
FDRRecords.h:314
llvm::xray::TSCWrapRecord
Definition:
FDRRecords.h:185
llvm::xray::BlockIndexer::flush
Error flush()
The flush() function will clear out the current state of the visitor, to allow for explicitly flushin...
Definition:
BlockIndexer.cpp:83
llvm::xray::BlockIndexer::Block::ThreadID
int32_t ThreadID
Definition:
BlockIndexer.h:31
I
#define I(x, y, z)
Definition:
MD5.cpp:58
llvm::xray::BlockIndexer::Block::ProcessID
uint64_t ProcessID
Definition:
BlockIndexer.h:30
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:
Error.h:158
llvm::xray::BlockIndexer
Definition:
BlockIndexer.h:27
Generated on Sun Dec 20 2020 13:53:40 for LLVM by
1.8.13