3#include <xrpl/basics/Log.h>
4#include <xrpl/basics/StringUtilities.h>
5#include <xrpl/core/Job.h>
6#include <xrpl/json/json_value.h>
172template <
typename Func,
class Rep,
class Period>
182 auto result = func();
186 if (duration > maxDelay)
188 JLOG(journal.
warn()) << actionDescription <<
" took " << duration.count() <<
" ms";
A generic endpoint for log messages.
Holds a collection of configuration values.
Singleton class that maintains performance counters and optionally writes Json-formatted data to a di...
virtual void jobFinish(JobType const type, Microseconds dur, int instance)=0
Log job finishing.
virtual ~PerfLog()=default
virtual void rpcError(std::string_view method, std::uint64_t requestId)=0
Log errored RPC call.
virtual void rpcFinish(std::string_view method, std::uint64_t requestId)=0
Log successful finish of RPC call.
virtual json::Value countersJson() const =0
Render performance counters in Json.
virtual json::Value currentJson() const =0
Render currently executing jobs and RPC calls and durations in Json.
std::chrono::time_point< SystemClock > SystemTimePoint
std::chrono::seconds Seconds
virtual void jobQueue(JobType const type)=0
Log queued job.
virtual void jobStart(JobType const type, Microseconds dur, SteadyTimePoint startTime, int instance)=0
Log job executing.
virtual void resizeJobs(int const resize)=0
Ensure enough room to store each currently executing job.
std::chrono::milliseconds Milliseconds
std::chrono::microseconds Microseconds
std::chrono::steady_clock SteadyClock
std::chrono::system_clock SystemClock
std::chrono::time_point< SteadyClock > SteadyTimePoint
virtual void rotate()=0
Rotate perf log file.
virtual void rpcStart(std::string_view method, std::uint64_t requestId)=0
Log start of RPC call.
T duration_cast(T... args)
Dummy class for unit tests.
auto measureDurationAndLog(Func &&func, std::string_view actionDescription, std::chrono::duration< Rep, Period > maxDelay, beast::Journal const &journal)
std::unique_ptr< PerfLog > makePerfLog(PerfLog::Setup const &setup, Application &app, std::span< NullTerminatedView const > methodNames, beast::Journal journal, std::function< void()> &&signalStop)
PerfLog::Setup setupPerfLog(Section const §ion, std::filesystem::path const &configDir)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Configuration from [perf] section of xrpld.cfg.
std::filesystem::path perfLog