Lines Matching defs:state

84  *	Your state variables should live in the tsd_t struct below
184 * initialize your state variables here first
186 tsd_t *state = (tsd_t *)tsd;
187 state->xfer = optm;
188 state->bytes = opts;
189 state->parallel = lm_optP;
190 state->warmup = optw;
191 state->repetitions = lm_optB;
192 debug("benchmark_initworker: repetitions = %i\n",state->repetitions);
200 tsd_t *state = (tsd_t *)tsd;
202 state->buf = valloc(XFERSIZE);
203 touch(state->buf, XFERSIZE);
204 state->initerr = 0;
205 if (socketpair(AF_UNIX, SOCK_STREAM, 0, state->pipes) == -1) {
207 state->initerr = 1;
210 if (pipe(state->control) == -1) {
212 state->initerr = 2;
216 switch (state->pid = fork()) {
219 close(state->control[1]);
220 close(state->pipes[0]);
221 writer(state->control[0], state->pipes[1], state->buf, state);
227 state->initerr = 3;
234 close(state->control[0]);
235 close(state->pipes[1]);
247 tsd_t *state = (tsd_t *)tsd;
249 size_t todo = state->bytes;
252 debug("in to benchmark - optB = %i : repetitions = %i\n", lm_optB, state->repetitions);
254 write(state->control[1], &todo, sizeof(todo));
256 if ((n = read(state->pipes[0], state->buf, state->xfer)) <= 0) {
264 debug("out of benchmark - optB = %i : repetitions = %i\n", lm_optB, state->repetitions);
272 tsd_t *state = (tsd_t *)tsd;
274 close(state->control[1]);
275 close(state->pipes[0]);
276 if (state->pid > 0) {
277 kill(state->pid, SIGKILL);
278 waitpid(state->pid, NULL, 0);
280 state->pid = 0;
325 tsd_t *state = (tsd_t *)cookie;
333 if ((n = write(writefd, buf, state->xfer)) < 0) {