Hi Sebastien,
On Wed, Mar 26, 2008 at 04:36:00PM +0530, Subrata Modak wrote:
> FYI...
>
> -------- Forwarded Message --------
> From: Sebastien Dugue <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Cc: Jean-Pierre Dion <[EMAIL PROTECTED]>, gilles.carry
> <[EMAIL PROTECTED]>
> Subject: Re: Fwd: [LTP] Fixes to realtime/func/pi_perf testcase
> Date: Wed, 26 Mar 2008 10:32:32 +0100
>
> Hi Subrata, Ankita,
>
> On Tue, 25 Mar 2008 18:57:07 +0530 Subrata Modak <[EMAIL PROTECTED]> wrote:
>
> >
> > The following patch 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.
> >
> > Also, the patch modifies the variable names to make them more intuitive.
> >
> > Testing done: Compile tested and run successfully without error.
>
> Your patch does not apply cleanly on the latest cvs, see below hunk #3.
> Furthermore it is rooted at ltp/testcases/realtime, it would be better
> if it were based on the ltp root to avoid integration problems.
>
Will re-generate the patch against latest ltp repo and send it to the list.
Thanks for
your review.
> Functionaly wise, it looks sane to me.
>
> Sebastien.
>
> >
> >
> > Signed-off-by: Ankita Garg <[EMAIL PROTECTED]>
> > Acked-by: Sripathi Kodi <[EMAIL PROTECTED]>
> >
> > Index: realtime/func/pi_perf/pi_perf.c
> > ===================================================================
> > --- realtime.orig/func/pi_perf/pi_perf.c 2008-03-04 16:23:14.000000000
> > +0530
> > +++ realtime/func/pi_perf/pi_perf.c 2008-03-04 17:13:36.000000000 +0530
> > @@ -74,9 +74,11 @@
> > static unsigned int busy_work_time;
> > static int num_busy = -1;
> >
> > -stats_container_t high_dat, low_dat, wait_dat;
> > -stats_container_t wait_hist;
> > -stats_quantiles_t wait_quantiles;
> > +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)
> > {
> > @@ -145,7 +147,8 @@
> >
> > low_start = rt_gettime();
> > busy_work_ms(low_work_time);
> > - low_hold = rt_gettime() - low_start;
> > + low_unlock = rt_gettime();
> > + low_hold = low_unlock - low_start;
> >
> > pthread_mutex_unlock(&lock);
> >
> > @@ -165,13 +168,13 @@
> >
> > void * high_prio_thread(void *arg)
> > {
> > - nsec_t high_start, high_spent;
> > + nsec_t high_start, high_spent, high_end;
> > 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, log10(iterations));
>
> In latest cvs, this is (int)log10(iterations)
>
> > + 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, log10(iterations));
> >
> > printf("High prio thread started\n");
> >
> > @@ -183,33 +186,36 @@
> >
> > high_start = rt_gettime();
> > pthread_mutex_lock(&lock);
> > - high_spent = rt_gettime() - high_start;
> > + 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);
> >
> > - 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;
> > + 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 */
> > pthread_barrier_wait(&bar2);
> > }
> >
> > - stats_hist(&wait_hist, &wait_dat);
> > + stats_hist(&cpu_delay_hist, &cpu_delay_dat);
> > stats_container_save("samples", "pi_perf Latency Scatter Plot",
> > - "Iteration", "Latency (us)", &wait_dat, "points");
> > + "Iteration", "Latency (us)", &cpu_delay_dat, "points");
> > stats_container_save("hist", "pi_perf Latency Histogram",
> > - "Latency (us)", "Samples", &wait_hist, "steps");
> > + "Latency (us)", "Samples", &cpu_delay_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("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(&wait_dat, &wait_quantiles);
> > - stats_quantiles_print(&wait_quantiles);
> > + stats_quantiles_calc(&cpu_delay_dat, &cpu_delay_quantiles);
> > + stats_quantiles_print(&cpu_delay_quantiles);
> >
> > return NULL;
> > }
> > @@ -253,12 +259,12 @@
> >
> > 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("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(&high_dat) > stats_min(&low_dat) + THRESHOLD)
> > + if (stats_max(&lock_wait_dat) > stats_min(&low_dat) + THRESHOLD)
> > ret = 1;
> >
> > printf("Result: %s\n", ret ? "FAIL" : "PASS");
> >
> >
> >
> >
--
Regards,
Ankita Garg ([EMAIL PROTECTED])
Linux Technology Center
IBM India Systems & Technology Labs,
Bangalore, India
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list