Revision ead5d018
b/xseg/peers/user/bench-xseg.c | ||
---|---|---|
286 | 286 |
} |
287 | 287 |
|
288 | 288 |
/* |
289 |
* This function substitutes the default peerd_loop of peer.c. |
|
289 |
* This function substitutes the default generic_peerd_loop of peer.c.
|
|
290 | 290 |
* It's plugged to struct peerd at custom peer's initialisation |
291 | 291 |
*/ |
292 | 292 |
int custom_peerd_loop(void *arg) |
... | ... | |
315 | 315 |
while (!isTerminate() |
316 | 316 |
&& xq_count(&peer->free_reqs) == peer->nr_ops |
317 | 317 |
&& prefs->rec_tm->completed != prefs->ts / prefs->bs ) { |
318 |
#if 0 |
|
319 |
//#pragma GCC push_options |
|
320 |
//#pragma GCC optimize ("O0") |
|
321 |
timer_start(prefs->total_tm); |
|
322 |
//for(int i = 0; i<1000; i++){} |
|
323 |
/*while(prefs->sub_tm->completed < 10000) { |
|
324 |
timer_start(prefs->sub_tm); |
|
325 |
timer_stop(prefs->sub_tm); |
|
326 |
}*/ |
|
327 |
usleep(500000); |
|
328 |
timer_stop(prefs->total_tm); |
|
329 |
break; |
|
330 |
//#pragma GCC pop_options |
|
331 |
|
|
318 |
#ifdef MT |
|
319 |
if (t->func) { |
|
320 |
XSEGLOG2(&lc, D, "%s executes function\n", id); |
|
321 |
xseg_cancel_wait(xseg, peer->portno_start); |
|
322 |
t->func(t->arg); |
|
323 |
t->func = NULL; |
|
324 |
t->arg = NULL; |
|
325 |
continue; |
|
326 |
} |
|
327 |
#endif |
|
332 | 328 |
while (prefs->sub_tm->completed - prefs->rec_tm->completed < |
333 | 329 |
prefs->iodepth){ |
334 | 330 |
XSEGLOG2(&lc, I, "Start sending new request\n"); |
335 | 331 |
send_request(peer, prefs); |
336 | 332 |
} |
337 |
#endif |
|
333 |
|
|
334 |
//Heart of peerd_loop. This loop is common for everyone. |
|
338 | 335 |
for (loops = threshold; loops > 0; loops--) { |
339 | 336 |
if (loops == 1) |
340 | 337 |
xseg_prepare_wait(xseg, peer->portno_start); |
... | ... | |
350 | 347 |
XSEGLOG2(&lc, I, "%s goes to sleep\n",id); |
351 | 348 |
xseg_wait_signal(xseg, 10000000UL); |
352 | 349 |
xseg_cancel_wait(xseg, peer->portno_start); |
353 |
XSEGLOG2(&lc, I, "%s woke up\n", pid);
|
|
350 |
XSEGLOG2(&lc, I, "%s woke up\n", id); |
|
354 | 351 |
} |
355 | 352 |
return 0; |
356 | 353 |
} |
Also available in: Unified diff