1#include <xrpl/beast/unit_test.h>
2#include <xrpl/core/PerfLog.h>
3#include <xrpl/core/detail/Workers.h>
4#include <xrpl/json/json_value.h>
47 int instance)
override
116 auto testForThreadCount = [
this, &cb, &w](
int const threadCount) {
118 cb.
count = threadCount;
124 for (
int i = 0; i < threadCount; ++i)
129 using namespace std::chrono_literals;
131 bool const signaled =
133 BEAST_EXPECT(signaled);
134 BEAST_EXPECT(cb.
count == 0);
136 testForThreadCount(tc1);
137 testForThreadCount(tc2);
138 testForThreadCount(tc3);
142 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.
void setNumberOfThreads(int numberOfThreads)
Set the desired number of threads.
void stop()
Pause all threads and wait until they are paused.
void addTask()
Add a task to be performed.
int getNumberOfThreads() const noexcept
Retrieve the desired number of threads.
void rotate() override
Rotate perf log file.
Json::Value countersJson() const override
Render performance counters in Json.
void rpcStart(std::string const &method, std::uint64_t requestId) override
Log start of RPC call.
void resizeJobs(int const resize) override
Ensure enough room to store each currently executing job.
void jobStart(JobType const type, std::chrono::microseconds dur, std::chrono::time_point< std::chrono::steady_clock > startTime, int instance) override
void rpcError(std::string const &method, std::uint64_t dur) override
Log errored RPC call.
void jobFinish(JobType const type, std::chrono::microseconds dur, int instance) override
Log job finishing.
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 jobQueue(JobType const type) override
Log queued job.
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.
std::condition_variable cv
void processTask(int instance) override
Perform a task.