From: Subrata <sub...@us...> - 2008-03-14 14:43:39
|
Update of /cvsroot/ltp/ltp/testcases/realtime/func/hrtimer-prio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7587/ltp/testcases/realtime/func/hrtimer-prio Modified Files: hrtimer-prio.c Log Message: 1. Minor fixes: Added -i to have the number of iterations configurable. However, this number cannot be less than 100 else a calloc fails in init_stat* function, causing sigsegv afterward. The patch also adds the return code checking for these init_stat functions. Added -m args is to have the PASS/FAIL criteria configurable. 2. Bug fix: disk write access deadlock High prio busy thread hogged cpus forbidding kjournald and pdflush daemons to release filesystem locks. This caused timer_thread to hang waiting for the lock. Signed-off-by: Gilles Carry <gil...@bu...> Index: hrtimer-prio.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/realtime/func/hrtimer-prio/hrtimer-prio.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** hrtimer-prio.c 22 Feb 2008 14:43:56 -0000 1.4 --- hrtimer-prio.c 14 Mar 2008 14:43:32 -0000 1.5 *************** *** 50,54 **** #include <libstats.h> ! #define DEF_MED_PRIO 60 // (softirqd-hrtimer,98] #define DEF_ITERATIONS 10000 #define HIST_BUCKETS 100 --- 50,54 ---- #include <libstats.h> ! #define DEF_MED_PRIO 60 // (softirqd-hrtimer,98) #define DEF_ITERATIONS 10000 #define HIST_BUCKETS 100 *************** *** 59,66 **** static int run_jvmsim = 0; static int med_prio = DEF_MED_PRIO; ! static int high_prio = DEF_MED_PRIO+1; static int busy_time = DEF_BUSY_TIME; static int iterations = DEF_ITERATIONS; ! static unsigned long criteria = DEF_CRITERIA; // FIXME: make configurable static int busy_threads; --- 59,66 ---- static int run_jvmsim = 0; static int med_prio = DEF_MED_PRIO; ! static int high_prio; static int busy_time = DEF_BUSY_TIME; static int iterations = DEF_ITERATIONS; ! static unsigned long criteria = DEF_CRITERIA; static int busy_threads; *************** *** 72,76 **** void usage(void) { ! rt_help(); printf("hrtimer-prio specific options:\n"); printf(" -j enable jvmsim\n"); --- 72,76 ---- void usage(void) { ! rt_help(); printf("hrtimer-prio specific options:\n"); printf(" -j enable jvmsim\n"); *************** *** 79,82 **** --- 79,83 ---- printf(" -n# #:number of busy threads, defaults to NR_CPUS*2\n"); printf(" -f# #:rt fifo priority of busy threads (1,98), defaults to %d\n", DEF_MED_PRIO); + printf(" -m# #:maximum timer latency in microseconds, defaults to %d\n", DEF_CRITERIA); } *************** *** 84,95 **** { ! int handled = 1; ! switch (c) { ! case 'j': ! run_jvmsim = 1; ! break; ! case 'h': ! usage(); ! exit(0); case 't': busy_time = atoi(v); --- 85,96 ---- { ! int handled = 1; ! switch (c) { ! case 'j': ! run_jvmsim = 1; ! break; ! case 'h': ! usage(); ! exit(0); case 't': busy_time = atoi(v); *************** *** 100,114 **** case 'f': med_prio = MIN(atoi(v), 98); - high_prio = med_prio+1; break; ! case 'i': ! printf("Setting iterations disabled\n"); ! // iterations = atoi(v); ! break; ! default: ! handled = 0; ! break; ! } ! return handled; } --- 101,120 ---- case 'f': med_prio = MIN(atoi(v), 98); break; ! case 'i': ! iterations = atoi(v); ! if (iterations < 100) { ! fprintf(stderr, "Number of iterations cannot be less than 100.\n"); ! exit(1); ! } ! break; ! case 'm': ! criteria = atoi(v); ! break; ! default: ! handled = 0; ! break; ! } ! return handled; } *************** *** 156,160 **** setup(); busy_threads = 2 * sysconf(_SC_NPROCESSORS_ONLN); // default busy_threads ! rt_init("f:i:jhn:t:", parse_args, argc, argv); // Set main()'s prio to one above the timer_thread so it is sure to not --- 162,167 ---- setup(); busy_threads = 2 * sysconf(_SC_NPROCESSORS_ONLN); // default busy_threads ! rt_init("f:i:jhn:t:m:", parse_args, argc, argv); ! high_prio = med_prio + 1; // Set main()'s prio to one above the timer_thread so it is sure to not *************** *** 176,190 **** if (run_jvmsim) { ! printf("jvmsim enabled\n"); ! jvmsim_init(); // Start the JVM simulation ! } else { ! printf("jvmsim disabled\n"); ! } stats_container_t hist; stats_quantiles_t quantiles; ! stats_container_init(&dat, iterations); ! stats_container_init(&hist, HIST_BUCKETS); ! stats_quantiles_init(&quantiles, (int)log10(iterations)); t_id = create_fifo_thread(timer_thread, NULL, high_prio); --- 183,206 ---- if (run_jvmsim) { ! printf("jvmsim enabled\n"); ! jvmsim_init(); // Start the JVM simulation ! } else { ! printf("jvmsim disabled\n"); ! } stats_container_t hist; stats_quantiles_t quantiles; ! if (stats_container_init(&dat, iterations)) { ! printf("Cannot init stat containers for dat\n"); ! exit(1); ! } ! if (stats_container_init(&hist, HIST_BUCKETS)) { ! printf("Cannot init stat containers for hist\n"); ! exit(1); ! } ! if (stats_quantiles_init(&quantiles, (int)log10(iterations))) { ! printf("Cannot init stat quantiles\n"); ! exit(1); ! } t_id = create_fifo_thread(timer_thread, NULL, high_prio); |