MCPcopy Create free account
hub / github.com/acl-dev/acl / handle_rpc

Function handle_rpc

lib_rpc/samples/http_rpc_client/http_rpc_client.cpp:94–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94static void handle_rpc(const char* addr, int max)
95{
96 http_request rpc(addr);
97
98 struct timeval begin;
99 gettimeofday(&begin, NULL);
100
101 char buf[64];
102 ACL_METER_TIME("begin run");
103 for (int i = 0; i < max;)
104 {
105 if (handle_one(rpc, i >= 1 ? false : true) == false)
106 break;
107 if (++i % 1000 == 0)
108 {
109 snprintf(buf, sizeof(buf), "total count: %d, curr: %d", max, i);
110 ACL_METER_TIME(buf);
111 }
112 }
113
114 struct timeval end;
115 gettimeofday(&end, NULL);
116 double n = util::stamp_sub(&end, &begin);
117 printf("total check: %d, spent: %0.2f ms, speed: %0.2f\r\n"
118 "total_build: %0.2f, total_parse: %0.2f, "
119 "total_request: %0.2f, total_reponse: %0.2f\r\n",
120 max, n, (max * 1000) /(n > 0 ? n : 1),
121 __build_spent, __parse_spent,
122 __request_spent, __response_spent);
123}
124
125static void usage(const char* procname)
126{

Callers 1

mainFunction · 0.85

Calls 3

handle_oneFunction · 0.70
gettimeofdayFunction · 0.50
stamp_subFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…