File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,35 @@ static RPCTimerInterface* timerInterface = nullptr;
32
32
/* Map of name to timer. */
33
33
static std::map<std::string, std::unique_ptr<RPCTimerBase> > deadlineTimers;
34
34
35
+ struct RPCCommandExecutionInfo
36
+ {
37
+ std::string method;
38
+ int64_t start;
39
+ };
40
+
41
+ struct RPCServerInfo
42
+ {
43
+ Mutex mutex;
44
+ std::list<RPCCommandExecutionInfo> active_commands GUARDED_BY (mutex);
45
+ };
46
+
47
+ static RPCServerInfo g_rpc_server_info;
48
+
49
+ struct RPCCommandExecution
50
+ {
51
+ std::list<RPCCommandExecutionInfo>::iterator it;
52
+ explicit RPCCommandExecution (const std::string& method)
53
+ {
54
+ LOCK (g_rpc_server_info.mutex );
55
+ it = g_rpc_server_info.active_commands .insert (g_rpc_server_info.active_commands .cend (), {method, GetTimeMicros ()});
56
+ }
57
+ ~RPCCommandExecution ()
58
+ {
59
+ LOCK (g_rpc_server_info.mutex );
60
+ g_rpc_server_info.active_commands .erase (it);
61
+ }
62
+ };
63
+
35
64
static struct CRPCSignals
36
65
{
37
66
boost::signals2::signal<void ()> Started;
@@ -485,6 +514,7 @@ UniValue CRPCTable::execute(const JSONRPCRequest &request) const
485
514
486
515
try
487
516
{
517
+ RPCCommandExecution execution (request.strMethod );
488
518
// Execute, convert arguments to array if necessary
489
519
if (request.params .isObject ()) {
490
520
return pcmd->actor (transformNamedArguments (request, pcmd->argNames ));
You can’t perform that action at this time.
0 commit comments