Lines Matching refs:ipt

46 static void free_cpu_affinity(struct idle_prof_thread *ipt)  in free_cpu_affinity()  argument
49 fio_cpuset_exit(&ipt->cpu_mask); in free_cpu_affinity()
53 static int set_cpu_affinity(struct idle_prof_thread *ipt) in set_cpu_affinity() argument
56 if (fio_cpuset_init(&ipt->cpu_mask)) { in set_cpu_affinity()
61 fio_cpu_set(&ipt->cpu_mask, ipt->cpu); in set_cpu_affinity()
63 if (fio_setaffinity(gettid(), ipt->cpu_mask)) { in set_cpu_affinity()
65 fio_cpuset_exit(&ipt->cpu_mask); in set_cpu_affinity()
80 struct idle_prof_thread *ipt = data; in idle_prof_thread_fn() local
83 pthread_mutex_lock(&ipt->init_lock); in idle_prof_thread_fn()
87 pthread_mutex_unlock(&ipt->init_lock); in idle_prof_thread_fn()
91 retval = set_cpu_affinity(ipt); in idle_prof_thread_fn()
93 ipt->state = TD_EXITED; in idle_prof_thread_fn()
94 pthread_mutex_unlock(&ipt->init_lock); in idle_prof_thread_fn()
98 ipt->cali_time = calibrate_unit(ipt->data); in idle_prof_thread_fn()
109 ipt->state = TD_EXITED; in idle_prof_thread_fn()
110 pthread_mutex_unlock(&ipt->init_lock); in idle_prof_thread_fn()
114 ipt->state = TD_INITIALIZED; in idle_prof_thread_fn()
117 pthread_cond_signal(&ipt->cond); in idle_prof_thread_fn()
118 pthread_mutex_unlock(&ipt->init_lock); in idle_prof_thread_fn()
121 pthread_mutex_lock(&ipt->start_lock); in idle_prof_thread_fn()
125 pthread_mutex_unlock(&ipt->start_lock); in idle_prof_thread_fn()
131 pthread_mutex_unlock(&ipt->start_lock); in idle_prof_thread_fn()
135 fio_gettime(&ipt->tps, NULL); in idle_prof_thread_fn()
136 ipt->state = TD_RUNNING; in idle_prof_thread_fn()
141 ipt->data[(k + j) % page_size] = k % 256; in idle_prof_thread_fn()
143 fio_gettime(&ipt->tpe, NULL); in idle_prof_thread_fn()
152 ipt->loops = j + (double) k / page_size; in idle_prof_thread_fn()
153 ipt->state = TD_EXITED; in idle_prof_thread_fn()
154 pthread_mutex_unlock(&ipt->start_lock); in idle_prof_thread_fn()
157 free_cpu_affinity(ipt); in idle_prof_thread_fn()
166 struct idle_prof_thread *ipt; in calibration_stats() local
169 ipt = &ipc.ipts[i]; in calibration_stats()
170 sum += ipt->cali_time; in calibration_stats()
176 ipt = &ipc.ipts[i]; in calibration_stats()
177 var += pow(ipt->cali_time-ipc.cali_mean, 2); in calibration_stats()
189 struct idle_prof_thread *ipt; in fio_idle_prof_init() local
224 ipt = &ipc.ipts[i]; in fio_idle_prof_init()
226 ipt->cpu = i; in fio_idle_prof_init()
227 ipt->state = TD_NOT_CREATED; in fio_idle_prof_init()
228 ipt->data = (unsigned char *)(ipc.buf + page_size * i); in fio_idle_prof_init()
230 if ((ret = pthread_mutex_init(&ipt->init_lock, NULL))) { in fio_idle_prof_init()
236 if ((ret = pthread_mutex_init(&ipt->start_lock, NULL))) { in fio_idle_prof_init()
242 if ((ret = pthread_cond_init(&ipt->cond, NULL))) { in fio_idle_prof_init()
249 pthread_mutex_lock(&ipt->init_lock); in fio_idle_prof_init()
252 pthread_mutex_lock(&ipt->start_lock); in fio_idle_prof_init()
254 if ((ret = pthread_create(&ipt->thread, &tattr, idle_prof_thread_fn, ipt))) { in fio_idle_prof_init()
259 ipt->state = TD_CREATED; in fio_idle_prof_init()
261 if ((ret = pthread_detach(ipt->thread))) { in fio_idle_prof_init()
272 ipt = &ipc.ipts[i]; in fio_idle_prof_init()
273 pthread_mutex_unlock(&ipt->init_lock); in fio_idle_prof_init()
281 ipt = &ipc.ipts[i]; in fio_idle_prof_init()
282 pthread_mutex_lock(&ipt->init_lock); in fio_idle_prof_init()
283 while ((ipt->state != TD_EXITED) && in fio_idle_prof_init()
284 (ipt->state!=TD_INITIALIZED)) { in fio_idle_prof_init()
288 pthread_cond_timedwait(&ipt->cond, &ipt->init_lock, &ts); in fio_idle_prof_init()
290 pthread_mutex_unlock(&ipt->init_lock); in fio_idle_prof_init()
296 if (ipt->state == TD_EXITED) in fio_idle_prof_init()
312 struct idle_prof_thread *ipt; in fio_idle_prof_start() local
319 ipt = &ipc.ipts[i]; in fio_idle_prof_start()
320 pthread_mutex_unlock(&ipt->start_lock); in fio_idle_prof_start()
330 struct idle_prof_thread *ipt; in fio_idle_prof_stop() local
342 ipt = &ipc.ipts[i]; in fio_idle_prof_stop()
343 pthread_mutex_lock(&ipt->start_lock); in fio_idle_prof_stop()
344 while ((ipt->state != TD_EXITED) && in fio_idle_prof_stop()
345 (ipt->state!=TD_NOT_CREATED)) { in fio_idle_prof_stop()
350 pthread_cond_timedwait(&ipt->cond, &ipt->start_lock, &ts); in fio_idle_prof_stop()
352 pthread_mutex_unlock(&ipt->start_lock); in fio_idle_prof_stop()
356 runt = utime_since(&ipt->tps, &ipt->tpe); in fio_idle_prof_stop()
358 ipt->idleness = ipt->loops * ipc.cali_mean / runt; in fio_idle_prof_stop()
360 ipt->idleness = 0.0; in fio_idle_prof_stop()
362 ipt->idleness = 0.0; in fio_idle_prof_stop()
378 struct idle_prof_thread *ipt; in fio_idle_prof_cpu_stat() local
391 ipt = &ipc.ipts[i]; in fio_idle_prof_cpu_stat()
392 p += ipt->idleness; in fio_idle_prof_cpu_stat()
396 ipt = &ipc.ipts[cpu]; in fio_idle_prof_cpu_stat()
397 p = ipt->idleness; in fio_idle_prof_cpu_stat()