xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
core
JobTypeData.h
1
#pragma once
2
3
#include <xrpl/basics/Log.h>
4
#include <xrpl/beast/insight/Collector.h>
5
#include <xrpl/beast/insight/Event.h>
6
#include <xrpl/core/Job.h>
7
#include <xrpl/core/JobTypeInfo.h>
8
#include <xrpl/core/LoadMonitor.h>
9
10
#include <
utility
>
11
12
namespace
xrpl
{
13
14
struct
JobTypeData
15
{
16
private
:
17
LoadMonitor
load_
;
18
19
/* Support for insight */
20
beast::insight::Collector::Ptr
collector_
;
21
22
public
:
23
/* The job category which we represent */
24
JobTypeInfo
const
&
info
;
25
26
/* The number of jobs waiting */
27
int
waiting
{0};
28
29
/* The number presently running */
30
int
running
{0};
31
32
/* And the number we deferred executing because of job limits */
33
int
deferred
{0};
34
35
/* Notification callbacks */
36
beast::insight::Event
dequeue
;
37
beast::insight::Event
execute
;
38
39
JobTypeData
(
40
JobTypeInfo
const
&
info
,
41
beast::insight::Collector::Ptr
collector,
42
Logs
& logs) noexcept
43
:
load_
(logs.journal(
"LoadMonitor"
)),
collector_
(std::move(collector)),
info
(
info
)
44
45
{
46
load_
.setTargetLatency(
info
.getAverageLatency(),
info
.getPeakLatency());
47
48
if
(!
info
.special())
49
{
50
dequeue
=
collector_
->makeEvent(
info
.name() +
"_q"
);
51
execute
=
collector_
->makeEvent(
info
.name());
52
}
53
}
54
55
/* Not copy-constructible or assignable */
56
JobTypeData
(
JobTypeData
const
& other) =
delete
;
57
JobTypeData
&
58
operator=
(
JobTypeData
const
& other) =
delete
;
59
60
[[nodiscard]]
std::string
61
name
()
const
62
{
63
return
info
.name();
64
}
65
66
[[nodiscard]]
JobType
67
type
()
const
68
{
69
return
info
.type();
70
}
71
72
LoadMonitor
&
73
load
()
74
{
75
return
load_
;
76
}
77
78
LoadMonitor::Stats
79
stats
()
80
{
81
return
load_
.getStats();
82
}
83
};
84
85
}
// namespace xrpl
std::string
beast::insight::Collector::Ptr
std::shared_ptr< Collector > Ptr
Definition
Collector.h:29
beast::insight::Event
A metric for reporting event timing.
Definition
Event.h:22
xrpl::JobTypeInfo
Holds all the 'static' information about a job, which does not change.
Definition
JobTypeInfo.h:15
xrpl::LoadMonitor
Definition
LoadMonitor.h:19
xrpl::Logs
Manages partitions for logging.
Definition
Log.h:23
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::JobType
JobType
Definition
Job.h:21
xrpl::JobTypeData::JobTypeData
JobTypeData(JobTypeData const &other)=delete
xrpl::JobTypeData::dequeue
beast::insight::Event dequeue
Definition
JobTypeData.h:36
xrpl::JobTypeData::load_
LoadMonitor load_
Definition
JobTypeData.h:17
xrpl::JobTypeData::execute
beast::insight::Event execute
Definition
JobTypeData.h:37
xrpl::JobTypeData::waiting
int waiting
Definition
JobTypeData.h:27
xrpl::JobTypeData::running
int running
Definition
JobTypeData.h:30
xrpl::JobTypeData::name
std::string name() const
Definition
JobTypeData.h:61
xrpl::JobTypeData::type
JobType type() const
Definition
JobTypeData.h:67
xrpl::JobTypeData::info
JobTypeInfo const & info
Definition
JobTypeData.h:24
xrpl::JobTypeData::stats
LoadMonitor::Stats stats()
Definition
JobTypeData.h:79
xrpl::JobTypeData::deferred
int deferred
Definition
JobTypeData.h:33
xrpl::JobTypeData::operator=
JobTypeData & operator=(JobTypeData const &other)=delete
xrpl::JobTypeData::JobTypeData
JobTypeData(JobTypeInfo const &info, beast::insight::Collector::Ptr collector, Logs &logs) noexcept
Definition
JobTypeData.h:39
xrpl::JobTypeData::collector_
beast::insight::Collector::Ptr collector_
Definition
JobTypeData.h:20
xrpl::JobTypeData::load
LoadMonitor & load()
Definition
JobTypeData.h:73
xrpl::LoadMonitor::Stats
Definition
LoadMonitor.h:37
utility
Generated by
1.17.0