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

Function thread_read

lib_acl_cpp/samples/benchmark/client/main.cpp:50–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50static void* thread_read(void* ctx)
51{
52 acl::socket_stream* conn = (acl::socket_stream*) ctx;
53 acl::string buf;
54
55 struct timeval begin;
56 gettimeofday(&begin, NULL);
57
58 int i;
59 for (i = 0; i < __max; i++)
60 {
61 if (conn->gets(buf, false) == false)
62 {
63 printf("readline from client over!\r\n");
64 break;
65 }
66 if (i % 10000 == 0)
67 printf("read count: %d, readline: %s", i, buf.c_str());
68 }
69
70 struct timeval end;
71 gettimeofday(&end, NULL);
72
73 double n = util::stamp_sub(&end, &begin);
74 printf("total read: %d, spent: %0.2f ms, speed: %0.2f\r\n",
75 i, n, (i * 1000) /(n > 0 ? n : 1));
76
77 return NULL;
78}
79
80static void* thread_write(void* ctx)
81{

Callers

nothing calls this directly

Calls 4

getsMethod · 0.80
gettimeofdayFunction · 0.50
stamp_subFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…