MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / curl_thread_entry

Function curl_thread_entry

net/http/test/client_perf.cpp:90–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88
89#ifdef ENABLE_CURL
90void curl_thread_entry(result* res) {
91 net::cURL client;
92 StringStream buffer;
93 client.set_redirect(0);
94 std::string target = "http://" + FLAGS_ip + ":" + std::to_string(FLAGS_port);
95 for (uint64_t i = 0; i < FLAGS_count; i++) {
96 auto t_begin = GetSteadyTimeUs();
97 buffer.clean();
98 client.GET(target.c_str(), &buffer);
99 auto t_end = GetSteadyTimeUs();
100 if (buffer.ptr != (int)FLAGS_body_size) {
101 LOG_ERROR(VALUE(buffer.ptr), VALUE(errno), VALUE(i), VALUE(FLAGS_body_size));
102 res->failed = true;
103 }
104 res->sum_throuput += FLAGS_body_size;
105 res->sum_latency += t_end - t_begin;
106 res->cnt++;
107 }
108}
109void test_curl(result &res) {
110 res.t_begin = GetSteadyTimeUs();
111 std::vector<photon::join_handle*> jhs;

Callers

nothing calls this directly

Calls 5

GetSteadyTimeUsFunction · 0.85
cleanMethod · 0.80
to_stringFunction · 0.50
GETMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected