1#include <xrpld/core/detail/Workers.h>
2#include <xrpld/perflog/PerfLog.h>
4#include <xrpl/beast/unit_test.h>
5#include <xrpl/json/json_value.h>
48 int instance)
override
117 auto testForThreadCount = [
this, &cb, &w](
int const threadCount) {
119 cb.
count = threadCount;
125 for (
int i = 0; i < threadCount; ++i)
130 using namespace std::chrono_literals;
132 bool const signaled =
134 BEAST_EXPECT(signaled);
135 BEAST_EXPECT(cb.
count == 0);
137 testForThreadCount(tc1);
138 testForThreadCount(tc2);
139 testForThreadCount(tc3);
143 BEAST_EXPECT(cb.
count == 0);
testcase_t testcase
Memberspace for declaring test cases.
void run() override
Runs the suite.
void testThreads(int const tc1, int const tc2, int const tc3)
Workers is effectively a thread pool.
int getNumberOfThreads() const noexcept
Retrieve the desired number of threads.
void addTask()
Add a task to be performed.
void stop()
Pause all threads and wait until they are paused.
void setNumberOfThreads(int numberOfThreads)
Set the desired number of threads.
void rpcError(std::string const &method, std::uint64_t dur) override
Log errored RPC call.
void rpcStart(std::string const &method, std::uint64_t requestId) override
Log start of RPC call.
void jobQueue(JobType const type) override
Log queued job.
void rotate() override
Rotate perf log file.
Json::Value currentJson() const override
Render currently executing jobs and RPC calls and durations in Json.
void rpcFinish(std::string const &method, std::uint64_t requestId) override
Log successful finish of RPC call.
void resizeJobs(int const resize) override
Ensure enough room to store each currently executing job.
Json::Value countersJson() const override
Render performance counters in Json.
void jobStart(JobType const type, std::chrono::microseconds dur, std::chrono::time_point< std::chrono::steady_clock > startTime, int instance) override
void jobFinish(JobType const type, std::chrono::microseconds dur, int instance) override
Log job finishing.
Singleton class that maintains performance counters and optionally writes Json-formatted data to a di...
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Called to perform tasks as needed.
void processTask(int instance) override
Perform a task.
std::condition_variable cv