static void report_rate(struct tevent_context *ev, struct tevent_timer *te, struct timeval t, void *private_data) { struct benchopen_state *state = talloc_get_type(private_data, struct benchopen_state); int i; for (i=0;i<nprocs;i++) { printf("%5u ", (unsigned)(state[i].count - state[i].lastcount)); state[i].lastcount = state[i].count; } printf("\r"); fflush(stdout); report_te = event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); /* send an echo on each interface to ensure it stays alive - this helps with IP takeover */ for (i=0;i<nprocs;i++) { struct smb_echo p; struct smbcli_request *req; if (!state[i].tree) { continue; } p.in.repeat_count = 1; p.in.size = 0; p.in.data = NULL; req = smb_raw_echo_send(state[i].tree->session->transport, &p); req->async.private_data = &state[i]; req->async.fn = echo_completion; } }
static void report_rate(struct tevent_context *ev, struct tevent_timer *te, struct timeval t, void *private_data) { struct offline_state *state = talloc_get_type(private_data, struct offline_state); int i; uint32_t total=0, total_offline=0, total_online=0; for (i=0;i<numstates;i++) { total += state[i].count - state[i].lastcount; if (timeval_elapsed(&state[i].tv_start) > latencies[state[i].op]) { latencies[state[i].op] = timeval_elapsed(&state[i].tv_start); } state[i].lastcount = state[i].count; total_online += state[i].online_count; total_offline += state[i].offline_count; } printf("ops/s=%4u offline=%5u online=%4u set_lat=%.1f/%.1f get_lat=%.1f/%.1f save_lat=%.1f/%.1f load_lat=%.1f/%.1f\n", total, total_offline, total_online, latencies[OP_SETOFFLINE], worst_latencies[OP_SETOFFLINE], latencies[OP_GETOFFLINE], worst_latencies[OP_GETOFFLINE], latencies[OP_SAVEFILE], worst_latencies[OP_SAVEFILE], latencies[OP_LOADFILE], worst_latencies[OP_LOADFILE]); fflush(stdout); event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); for (i=0;i<OP_ENDOFLIST;i++) { if (latencies[i] > worst_latencies[i]) { worst_latencies[i] = latencies[i]; } latencies[i] = 0; } /* send an echo on each interface to ensure it stays alive - this helps with IP takeover */ for (i=0;i<numstates;i++) { struct smb_echo p; struct smbcli_request *req; if (!state[i].tree) { continue; } p.in.repeat_count = 1; p.in.size = 0; p.in.data = NULL; req = smb_raw_echo_send(state[i].tree->session->transport, &p); req->async.private_data = &state[i]; req->async.fn = echo_completion; } }
/**************************************************************************** Send a echo (sync interface) *****************************************************************************/ NTSTATUS smb_raw_echo(struct smbcli_transport *transport, struct smb_echo *p) { struct smbcli_request *req = smb_raw_echo_send(transport, p); return smbcli_request_simple_recv(req); }