From: Subrata <sub...@us...> - 2008-03-27 06:16:04
|
Update of /cvsroot/ltp/ltp/testcases/realtime/func/pi_perf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16940/ltp/testcases/realtime/func/pi_perf Modified Files: pi_perf.c Log Message: Fixes a minor issue with pi_perf testcase (testcases/realtime/func/). The wait_dat is intended to measure the amount of time it took for the high priority thread to actually obtain the lock from the time it was released by the low priority thread. The patch fixes this computation to measure it more accurately. The PASS/FAIL computation is unaffected. Signed-off-by: Ankita Garg <an...@in...>, Acked-by: Sripathi Kodi <sri...@in...> Index: pi_perf.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/realtime/func/pi_perf/pi_perf.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pi_perf.c 29 Feb 2008 03:55:35 -0000 1.5 --- pi_perf.c 27 Mar 2008 06:15:57 -0000 1.6 *************** *** 75,81 **** static int num_busy = -1; ! stats_container_t high_dat, low_dat, wait_dat; ! stats_container_t wait_hist; ! stats_quantiles_t wait_quantiles; void usage(void) --- 75,83 ---- static int num_busy = -1; ! nsec_t low_unlock, high_get_lock; ! ! stats_container_t lock_wait_dat, low_dat, cpu_delay_dat; ! stats_container_t cpu_delay_hist; ! stats_quantiles_t cpu_delay_quantiles; void usage(void) *************** *** 146,150 **** low_start = rt_gettime(); busy_work_ms(low_work_time); ! low_hold = rt_gettime() - low_start; pthread_mutex_unlock(&lock); --- 148,153 ---- low_start = rt_gettime(); busy_work_ms(low_work_time); ! low_unlock = rt_gettime(); ! low_hold = low_unlock - low_start; pthread_mutex_unlock(&lock); *************** *** 166,176 **** void * high_prio_thread(void *arg) { ! nsec_t high_start, high_spent; unsigned int i; ! stats_container_init(&high_dat, iterations); ! stats_container_init(&wait_dat, iterations); ! stats_container_init(&wait_hist, HIST_BUCKETS); ! stats_quantiles_init(&wait_quantiles, (int)log10(iterations)); printf("High prio thread started\n"); --- 169,179 ---- void * high_prio_thread(void *arg) { ! nsec_t high_start, high_spent, high_end; unsigned int i; ! stats_container_init(&lock_wait_dat, iterations); ! stats_container_init(&cpu_delay_dat, iterations); ! stats_container_init(&cpu_delay_hist, HIST_BUCKETS); ! stats_quantiles_init(&cpu_delay_quantiles, (int)log10(iterations)); printf("High prio thread started\n"); *************** *** 184,196 **** high_start = rt_gettime(); pthread_mutex_lock(&lock); ! high_spent = rt_gettime() - high_start; busy_work_ms(high_work_time); pthread_mutex_unlock(&lock); ! high_dat.records[i].x = i; ! high_dat.records[i].y = high_spent / NS_PER_US; ! wait_dat.records[i].x = i; ! wait_dat.records[i].y = high_dat.records[i].y - low_dat.records[i].y; /* Wait for all threads to finish this iteration */ --- 187,201 ---- high_start = rt_gettime(); pthread_mutex_lock(&lock); ! high_end = rt_gettime(); ! high_spent = high_end - high_start; ! high_get_lock = high_end - low_unlock; busy_work_ms(high_work_time); pthread_mutex_unlock(&lock); ! lock_wait_dat.records[i].x = i; ! lock_wait_dat.records[i].y = high_spent / NS_PER_US; ! cpu_delay_dat.records[i].x = i; ! cpu_delay_dat.records[i].y = high_get_lock / NS_PER_US; /* Wait for all threads to finish this iteration */ *************** *** 198,214 **** } ! stats_hist(&wait_hist, &wait_dat); stats_container_save("samples", "pi_perf Latency Scatter Plot", ! "Iteration", "Latency (us)", &wait_dat, "points"); stats_container_save("hist", "pi_perf Latency Histogram", ! "Latency (us)", "Samples", &wait_hist, "steps"); ! printf("Min wait time = %ld us\n", stats_min(&wait_dat)); ! printf("Max wait time = %ld us\n", stats_max(&wait_dat)); ! printf("Average wait time = %4.2f us\n", stats_avg(&wait_dat)); ! printf("Standard Deviation = %4.2f us\n", stats_stddev(&wait_dat)); printf("Quantiles:\n"); ! stats_quantiles_calc(&wait_dat, &wait_quantiles); ! stats_quantiles_print(&wait_quantiles); return NULL; --- 203,220 ---- } ! stats_hist(&cpu_delay_hist, &cpu_delay_dat); stats_container_save("samples", "pi_perf Latency Scatter Plot", ! "Iteration", "Latency (us)", &cpu_delay_dat, "points"); stats_container_save("hist", "pi_perf Latency Histogram", ! "Latency (us)", "Samples", &cpu_delay_hist, "steps"); ! printf("Time taken for high prio thread to get the lock once released by low prio thread\n"); ! printf("Min wait time = %ld us\n", stats_min(&cpu_delay_dat)); ! printf("Max wait time = %ld us\n", stats_max(&cpu_delay_dat)); ! printf("Average wait time = %4.2f us\n", stats_avg(&cpu_delay_dat)); ! printf("Standard Deviation = %4.2f us\n", stats_stddev(&cpu_delay_dat)); printf("Quantiles:\n"); ! stats_quantiles_calc(&cpu_delay_dat, &cpu_delay_quantiles); ! stats_quantiles_print(&cpu_delay_quantiles); return NULL; *************** *** 254,263 **** join_threads(); printf("Low prio lock held time (min) = %ld us\n", stats_min(&low_dat)); ! printf("High prio lock wait time (max) = %ld us\n", stats_max(&high_dat)); printf("Criteria: High prio lock wait time < " "(Low prio lock held time + %d us)\n", THRESHOLD); ret = 0; ! if (stats_max(&high_dat) > stats_min(&low_dat) + THRESHOLD) ret = 1; --- 260,269 ---- join_threads(); printf("Low prio lock held time (min) = %ld us\n", stats_min(&low_dat)); ! printf("High prio lock wait time (max) = %ld us\n", stats_max(&lock_wait_dat)); printf("Criteria: High prio lock wait time < " "(Low prio lock held time + %d us)\n", THRESHOLD); ret = 0; ! if (stats_max(&lock_wait_dat) > stats_min(&low_dat) + THRESHOLD) ret = 1; |