| 297 | |
| 298 | template <bool Reader> |
| 299 | void* add_with_mutex(void* void_arg) { |
| 300 | auto args = (PerfArgs*)void_arg; |
| 301 | args->ready = true; |
| 302 | butil::Timer t; |
| 303 | while (!g_stopped) { |
| 304 | if (g_started) { |
| 305 | break; |
| 306 | } |
| 307 | bthread_usleep(10); |
| 308 | } |
| 309 | t.start(); |
| 310 | while (!g_stopped) { |
| 311 | if (Reader) { |
| 312 | bthread_rwlock_rdlock(args->rw); |
| 313 | } else { |
| 314 | bthread_rwlock_wrlock(args->rw); |
| 315 | } |
| 316 | ++args->counter; |
| 317 | bthread_rwlock_unlock(args->rw); |
| 318 | } |
| 319 | t.stop(); |
| 320 | args->elapse_ns = t.n_elapsed(); |
| 321 | return NULL; |
| 322 | } |
| 323 | |
| 324 | int g_prof_name_counter = 0; |
| 325 |
nothing calls this directly
no test coverage detected