On Thu, 2008-02-28 at 16:45 +0100, Sebastien Dugue wrote:
> Hi,
>
> This patch fixes the testcases mismerge due to the patch
> "There are numerous cleanups, fixes and features went into our ..." from
> Sudhanshu Singh.
>
> Turned out there was less damage than I thought.
>
> Hopefully, it should restore the fixes and cleanups which were reverted
> before the February Release.
Well, i am going to merge this before todayĆ release as you require that
to be. Hope there will be no problem in applying the other patches, that
you sent across yesterday, with subject as:
1) Get Rid of Autotools,
2) Add Scripts for Feature Detection,
3) Add Makefiles,
4) Remove Autotools Specific Stuff,
later over this patch.
Regards--
Subrata
>
> Signed-off-by: Sebastien Dugue <[EMAIL PROTECTED]>
> Cc: Sudhanshu Singh < [EMAIL PROTECTED]>
> Cc: Chirag <[EMAIL PROTECTED]>
> Cc: Subrata Modak <[EMAIL PROTECTED]>
> ---
> .../func/periodic_cpu_load/periodic_cpu_load.c | 76
> +++++++++++++-------
> testcases/realtime/func/pi_perf/pi_perf.c | 11 ++--
> .../realtime/func/sched_football/sched_football.c | 40 +++++-----
> .../realtime/func/sched_latency/sched_latency.c | 5 +-
> 4 files changed, 77 insertions(+), 55 deletions(-)
>
> diff --git a/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
> b/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
> index eb49443..36d3595 100644
> --- a/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
> +++ b/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
> @@ -56,6 +56,7 @@
> #define CALC_LOOPS_B (50*100)
> #define CALC_LOOPS_C (72*100)
>
> +#define NUM_GROUPS 3
> #define THREADS_PER_GROUP 4
>
> //#define ITERATIONS 100 /* short functional test run */
> @@ -64,6 +65,11 @@
> // FIXME: need some kind of passing criteria calculation
> //#define PASS_US 100
>
> +int fail[THREADS_PER_GROUP * NUM_GROUPS];
> +stats_container_t dat[THREADS_PER_GROUP * NUM_GROUPS];
> +stats_quantiles_t quantiles[THREADS_PER_GROUP * NUM_GROUPS];
> +static const char groupname[NUM_GROUPS] = "ABC";
> +
> static int run_jvmsim = 0;
> static int ret = 0;
>
> @@ -120,54 +126,38 @@ void *periodic_thread(void *thread)
> nsec_t period = parg->period;
> void*(*func)(void*) = parg->func;
>
> - stats_container_t dat;
> - stats_quantiles_t quantiles;
> -
> int i = 0;
> - int fail = 0;
> nsec_t next, now;
> nsec_t exe_start, exe_end, exe_time;
>
> - stats_container_init(&dat, ITERATIONS);
> - stats_quantiles_init(&quantiles, 3);
> -
> next = rt_gettime();
> while (i < parg->iterations) {
> next += period;
> if (rt_gettime() > next) {
> printf("TID %d missed period, aborting\n", t->id);
> - fail = 1;
> + fail[t->id] = 1;
> break;
> }
> exe_start = rt_gettime();
> func(parg->arg);
> exe_end = rt_gettime();
> exe_time = exe_end - exe_start;
> - dat.records[i].x = i;
> - dat.records[i].y = exe_time/NS_PER_US;
> + dat[t->id].records[i].x = i;
> + dat[t->id].records[i].y = exe_time/NS_PER_US;
>
> i++;
>
> now = rt_gettime();
> if (now > next) {
> printf("Missed period, aborting (calc took too
> long)\n");
> - fail = 1;
> + fail[t->id] = 1;
> break;
> }
> rt_nanosleep(next - now);
> }
>
> - printf("\nTID %d (prio %d) complete\n", t->id, t->priority);
> - printf(" Execution Time Statistics:\n");
> - printf(" Min: %ld us\n", stats_min(&dat));
> - printf(" Max: %ld us\n", stats_max(&dat));
> - printf(" Avg: %f us\n", stats_avg(&dat));
> - printf(" StdDev: %f us\n\n", stats_stddev(&dat));
> - printf(" Quantiles:\n");
> - stats_quantiles_calc(&dat, &quantiles);
> - stats_quantiles_print(&quantiles);
> - printf("Criteria:TID %d missed a period\n",t->id);
> - printf("Result: %s\n", fail ? "FAIL":"PASS");
> + printf("TID %d (%c - prio %d) complete\n", t->id, groupname[t->id>>2],
> + t->priority);
>
> return NULL;
> }
> @@ -195,6 +185,7 @@ int main(int argc, char *argv[])
> printf(" threads: %d\n", THREADS_PER_GROUP);
> printf(" priority: %d\n", PRIO_C);
> printf(" period: %d ms\n", PERIOD_C/NS_PER_MS);
> + printf("\n");
>
> if (run_jvmsim) {
> printf("jvmsim enabled\n");
> @@ -203,20 +194,51 @@ int main(int argc, char *argv[])
> printf("jvmsim disabled\n");
> }
>
> - struct periodic_arg parg_a = { PERIOD_A, ITERATIONS, calc, (void
> *)CALC_LOOPS_A };
> - struct periodic_arg parg_b = { PERIOD_B, ITERATIONS, calc, (void
> *)CALC_LOOPS_B };
> - struct periodic_arg parg_c = { PERIOD_C, ITERATIONS, calc, (void
> *)CALC_LOOPS_C };
> - for (i=0; i < THREADS_PER_GROUP; i++) {
> + for (i=0; i<(THREADS_PER_GROUP * NUM_GROUPS); i++) {
> + stats_container_init(&dat[i], ITERATIONS);
> + stats_quantiles_init(&quantiles[i], (int)log10(ITERATIONS));
> + }
> +
> + struct periodic_arg parg_a = {PERIOD_A, ITERATIONS, calc, (void
> *)CALC_LOOPS_A };
> + struct periodic_arg parg_b = {PERIOD_B, ITERATIONS, calc, (void
> *)CALC_LOOPS_B };
> + struct periodic_arg parg_c = {PERIOD_C, ITERATIONS, calc, (void
> *)CALC_LOOPS_C };
> +
> + for (i=0; i < THREADS_PER_GROUP; i++)
> create_fifo_thread(periodic_thread, (void*)&parg_a, PRIO_A);
> + for (i=0; i < THREADS_PER_GROUP; i++)
> create_fifo_thread(periodic_thread, (void*)&parg_b, PRIO_B);
> + for (i=0; i < THREADS_PER_GROUP; i++)
> create_fifo_thread(periodic_thread, (void*)&parg_c, PRIO_C);
> - }
>
> join_threads();
>
> + printf("\nExecution Time Statistics:\n\n");
> +
> + for (i=0; i<(THREADS_PER_GROUP * NUM_GROUPS); i++) {
> + printf("TID %d (%c)\n", i, groupname[i>>2]);
> + printf(" Min: %ld us\n", stats_min(&dat[i]));
> + printf(" Max: %ld us\n", stats_max(&dat[i]));
> + printf(" Avg: %f us\n", stats_avg(&dat[i]));
> + printf(" StdDev: %f us\n\n", stats_stddev(&dat[i]));
> + printf(" Quantiles:\n");
> + stats_quantiles_calc(&dat[i], &quantiles[i]);
> + stats_quantiles_print(&quantiles[i]);
> + printf("Criteria: TID %d did not miss a period\n", i);
> + printf("Result: %s\n", fail[i] ? "FAIL":"PASS");
> + printf("\n");
> +
> + if (fail[i])
> + ret = 1;
> + }
> +
> // FIXME: define pass criteria
> // printf("\nCriteria: latencies < %d us\n", PASS_US);
> // printf("Result: %s\n", ret ? "FAIL" : "PASS");
>
> + for (i=0; i<(THREADS_PER_GROUP * NUM_GROUPS); i++) {
> + stats_container_free(&dat[i]);
> + stats_quantiles_free(&quantiles[i]);
> + }
> +
> return ret;
> }
> diff --git a/testcases/realtime/func/pi_perf/pi_perf.c
> b/testcases/realtime/func/pi_perf/pi_perf.c
> index 32b9afe..c06a2b3 100644
> --- a/testcases/realtime/func/pi_perf/pi_perf.c
> +++ b/testcases/realtime/func/pi_perf/pi_perf.c
> @@ -196,19 +196,20 @@ void * high_prio_thread(void *arg)
> /* Wait for all threads to finish this iteration */
> pthread_barrier_wait(&bar2);
> }
> - stats_quantiles_calc(&wait_dat, &wait_quantiles);
> +
> 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);
> - 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");
>
> return NULL;
> }
> diff --git a/testcases/realtime/func/sched_football/sched_football.c
> b/testcases/realtime/func/sched_football/sched_football.c
> index 08a1452..aab430a 100644
> --- a/testcases/realtime/func/sched_football/sched_football.c
> +++ b/testcases/realtime/func/sched_football/sched_football.c
> @@ -81,12 +81,17 @@ volatile int defense_count;
> pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
>
> static int run_jvmsim=0;
> +static int players_per_team = 0;
> +static int game_length = DEF_GAME_LENGTH;
>
> void usage(void)
> {
> - rt_help();
> - printf("testpi-1 specific options:\n");
> - printf(" -j enable jvmsim\n");
> + rt_help();
> + printf("sched_football specific options:\n");
> + printf(" -j enable jvmsim\n");
> + printf(" -nPLAYERS players per team (defaults to num_cpus)\n");
> + printf(" -lGAME_LENGTH game length in seconds (defaults to %d s)\n",
> + DEF_GAME_LENGTH);
> }
>
> int parse_args(int c, char *v)
> @@ -100,6 +105,12 @@ int parse_args(int c, char *v)
> case 'h':
> usage();
> exit(0);
> + case 'n':
> + players_per_team = atoi(v);
> + break;
> + case 'l':
> + game_length= atoi(v);
> + break;
> default:
> handled = 0;
> break;
> @@ -162,12 +173,14 @@ int referee(int game_length)
> int main(int argc, char* argv[])
> {
> struct sched_param param;
> - int players_per_team, game_length;
> int priority;
> int i;
> setup();
>
> - rt_init("jh",parse_args,argc,argv);
> + rt_init("n:l:jh",parse_args,argc,argv);
> +
> + if (players_per_team == 0)
> + players_per_team = sysconf(_SC_NPROCESSORS_ONLN);
>
> if (run_jvmsim) {
> printf("jvmsim enabled\n");
> @@ -176,21 +189,8 @@ int main(int argc, char* argv[])
> printf("jvmsim disabled\n");
> }
>
> - if (argc < 2 || argc > 3) {
> - printf("Usage: %s players_per_team [game_length (seconds)]\n",
> argv[0]);
> - players_per_team = sysconf(_SC_NPROCESSORS_ONLN);
> - game_length = DEF_GAME_LENGTH;
> - printf("Using default values: players_per_team=%d
> game_length=%d\n",
> - players_per_team, game_length);
> - }
> -
> - else {
> - players_per_team = atoi(argv[1]);
> - if (argc == 3)
> - game_length = atoi(argv[2]);
> - else
> - game_length = DEF_GAME_LENGTH;
> - }
> + printf("Running with: players_per_team=%d game_length=%d\n",
> + players_per_team, game_length);
>
> /* We're the ref, so set our priority right */
> param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 80;
> diff --git a/testcases/realtime/func/sched_latency/sched_latency.c
> b/testcases/realtime/func/sched_latency/sched_latency.c
> index 4d3b5a4..75504b6 100644
> --- a/testcases/realtime/func/sched_latency/sched_latency.c
> +++ b/testcases/realtime/func/sched_latency/sched_latency.c
> @@ -169,8 +169,7 @@ void *periodic_thread(void *arg)
> } while (now < next);
>
> /* start of period */
> - now = rt_gettime();
> - delay = (now - start - (nsec_t)(i + 1)*period)/NS_PER_US;
> + delay = (now - iter_start - (nsec_t)(i+1)*period)/NS_PER_US;
> dat.records[i].x = i;
> dat.records[i].y = delay;
> if (delay < min_delay)
> @@ -197,7 +196,7 @@ void *periodic_thread(void *arg)
> printf("Latency threshold (%lluus) exceeded at
> iteration %d\n",
> latency_threshold, i);
> latency_trace_print();
> - stats_container_resize(&dat, i + 1);
> + stats_container_resize(&dat, i+1);
> }
> }
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list