Lines Matching defs:ipt
46 static int set_cpu_affinity(struct idle_prof_thread *ipt)
52 fio_cpu_set(&cpu_mask, ipt->cpu);
70 struct idle_prof_thread *ipt = data;
73 pthread_mutex_lock(&ipt->init_lock);
77 pthread_mutex_unlock(&ipt->init_lock);
81 retval = set_cpu_affinity(ipt);
83 ipt->state = TD_EXITED;
84 pthread_mutex_unlock(&ipt->init_lock);
88 ipt->cali_time = calibrate_unit(ipt->data);
99 ipt->state = TD_EXITED;
100 pthread_mutex_unlock(&ipt->init_lock);
104 ipt->state = TD_INITIALIZED;
107 pthread_cond_signal(&ipt->cond);
108 pthread_mutex_unlock(&ipt->init_lock);
111 pthread_mutex_lock(&ipt->start_lock);
115 pthread_mutex_unlock(&ipt->start_lock);
121 pthread_mutex_unlock(&ipt->start_lock);
125 fio_gettime(&ipt->tps, NULL);
126 ipt->state = TD_RUNNING;
131 ipt->data[(k + j) % page_size] = k % 256;
133 fio_gettime(&ipt->tpe, NULL);
142 ipt->loops = j + (double) k / page_size;
143 ipt->state = TD_EXITED;
144 pthread_mutex_unlock(&ipt->start_lock);
154 struct idle_prof_thread *ipt;
157 ipt = &ipc.ipts[i];
158 sum += ipt->cali_time;
164 ipt = &ipc.ipts[i];
165 var += pow(ipt->cali_time-ipc.cali_mean, 2);
177 struct idle_prof_thread *ipt;
212 ipt = &ipc.ipts[i];
214 ipt->cpu = i;
215 ipt->state = TD_NOT_CREATED;
216 ipt->data = (unsigned char *)(ipc.buf + page_size * i);
218 if ((ret = pthread_mutex_init(&ipt->init_lock, NULL))) {
224 if ((ret = pthread_mutex_init(&ipt->start_lock, NULL))) {
230 if ((ret = pthread_cond_init(&ipt->cond, NULL))) {
237 pthread_mutex_lock(&ipt->init_lock);
240 pthread_mutex_lock(&ipt->start_lock);
242 if ((ret = pthread_create(&ipt->thread, &tattr, idle_prof_thread_fn, ipt))) {
247 ipt->state = TD_CREATED;
249 if ((ret = pthread_detach(ipt->thread))) {
260 ipt = &ipc.ipts[i];
261 pthread_mutex_unlock(&ipt->init_lock);
269 ipt = &ipc.ipts[i];
270 pthread_mutex_lock(&ipt->init_lock);
271 while ((ipt->state != TD_EXITED) &&
272 (ipt->state!=TD_INITIALIZED)) {
276 pthread_cond_timedwait(&ipt->cond, &ipt->init_lock, &ts);
278 pthread_mutex_unlock(&ipt->init_lock);
284 if (ipt->state == TD_EXITED)
300 struct idle_prof_thread *ipt;
307 ipt = &ipc.ipts[i];
308 pthread_mutex_unlock(&ipt->start_lock);
318 struct idle_prof_thread *ipt;
330 ipt = &ipc.ipts[i];
331 pthread_mutex_lock(&ipt->start_lock);
332 while ((ipt->state != TD_EXITED) &&
333 (ipt->state!=TD_NOT_CREATED)) {
338 pthread_cond_timedwait(&ipt->cond, &ipt->start_lock, &ts);
340 pthread_mutex_unlock(&ipt->start_lock);
344 runt = utime_since(&ipt->tps, &ipt->tpe);
346 ipt->idleness = ipt->loops * ipc.cali_mean / runt;
348 ipt->idleness = 0.0;
350 ipt->idleness = 0.0;
366 struct idle_prof_thread *ipt;
379 ipt = &ipc.ipts[i];
380 p += ipt->idleness;
384 ipt = &ipc.ipts[cpu];
385 p = ipt->idleness;