From: Subrata <sub...@us...> - 2008-02-20 10:13:05
|
Update of /cvsroot/ltp/ltp/testcases/realtime/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6679/ltp/testcases/realtime/lib Modified Files: librttest.c libstats.c Log Message: Here is a second round of cleanup and fixes for the realtime testcases. 1) Make sched_jitter use the create_fifo_thread() library function instead of an open coded solution, 2) Prio-wake calls rt_init() twice, remove the second call, 3) Make sbrk_mutex less verbose by default. One can still use the -v option to get the whole output, 4) It's better to calculate the histogram before saving it. This was introduced in an earlier commit of mine fixing the quantile calculation, 5) Fix runtime displaying of the min and max latencies (when used with -v3). While at it, remove an uneeded avg variable, 6) Various tests still have a hardcoded value for the quantile nines. Use a value automatically calculated from the number of iterations, 7) The log10() call used for automatic quantile nines calculation returns a double result. Cast it to an int. The exp10() call used in stats_quantiles_calc() for checking purposes returns a double result which is compared against a long. Cast it to a long. This allows the following comparison: data->size < (long)exp10(quantiles->nines) to really be false when quantiles->nines has been calculated as log10(data->size). More generally, it seems that (at least with gcc 4.1.1): long i = 10000; double f = exp10(log10(i)) yields (i < f) being true due to rounding, 8) Add latency tracing capability to pthread_kill_latency as is already done on a few other latency tests (gtod_latency, sched_latency, ...), 9) The '::' optional argument specifier for getopt used by the '-v' option is a GNU extension, is not portable and does not work. For example it's not even described in the Debian getopt(3) manpage. Make the '-v' option require a non optional argument, 10)The print buffer is only ever flushed when it is full. Add flushing when the test terminates vi atexit(), 11)The 'period missed' check of the thread first loop should not depend on the thread starting time. This is especially visible on 'slow' platforms where one cannot run the test if thread creation takes a long time. Fix it by removing this dependency. All delays are now calculated relative to when the thread starts, Signed-off-by: Sebastien Dugue <seb...@bu...> Cc: Darren Hart <dv...@us...> Cc: Tim Chavez <ti...@us...> Cc: Matthieu CASTET <mat...@pa...> Acked-by: Chirag <ch...@li...> Index: libstats.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/realtime/lib/libstats.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libstats.c 26 Dec 2007 11:11:52 -0000 1.1 --- libstats.c 20 Feb 2008 10:13:00 -0000 1.2 *************** *** 206,210 **** // check for sufficient data size of accurate calculation ! if (data->size <= 0 || data->size < exp10(quantiles->nines)) { //printf("ERROR: insufficient data size for %d nines\n", data->size); return -1; --- 206,210 ---- // check for sufficient data size of accurate calculation ! if (data->size <= 0 || data->size < (long)exp10(quantiles->nines)) { //printf("ERROR: insufficient data size for %d nines\n", data->size); return -1; Index: librttest.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/realtime/lib/librttest.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** librttest.c 26 Dec 2007 11:11:52 -0000 1.1 --- librttest.c 20 Feb 2008 10:13:00 -0000 1.2 *************** *** 85,89 **** opterr = 0; char *all_options, *opt_ptr; ! static const char my_options[] = "b:p:v::"; if (options) { --- 85,89 ---- opterr = 0; char *all_options, *opt_ptr; ! static const char my_options[] = "b:p:v:"; if (options) { *************** *** 115,122 **** break; case 'v': ! if (optarg) ! _dbg_lvl = atoi(optarg); ! else ! _dbg_lvl++; break; default: --- 115,119 ---- break; case 'v': ! _dbg_lvl = atoi(optarg); break; default: *************** *** 132,136 **** --- 129,139 ---- if (use_buffer) buffer_init(); + + /* + * atexit() order matters here - buffer_print() will be called before + * buffer_fini(). + */ atexit(buffer_fini); + atexit(buffer_print); return 0; } |