On Thursday 10 January 2008 03:12:22 Sebastien Dugue wrote:
> Move the stat_container initialization out of the thread function.
> This helps saving in the measured start latency.
>
> Also, while at it, free the stat containers at the end of the run.
>
> Signed-off-by: Sebastien Dugue <[EMAIL PROTECTED]>
Acked-by: Darren Hart <[EMAIL PROTECTED]>
> Cc: Darren Hart <[EMAIL PROTECTED]>
> Cc: Tim Chavez <[EMAIL PROTECTED]>
> ---
> .../realtime/func/sched_latency/sched_latency.c | 32
> ++++++++++++++----- 1 files changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/testcases/realtime/func/sched_latency/sched_latency.c
> b/testcases/realtime/func/sched_latency/sched_latency.c index
> 3370b13..9c6514f 100644
> --- a/testcases/realtime/func/sched_latency/sched_latency.c
> +++ b/testcases/realtime/func/sched_latency/sched_latency.c
> @@ -71,6 +71,10 @@ static unsigned long long latency_threshold = 0;
> static nsec_t period = DEF_PERIOD;
> static unsigned int load_ms = DEF_LOAD_MS;
>
> +stats_container_t dat;
> +stats_container_t hist;
> +stats_quantiles_t quantiles;
> +
> void usage(void)
> {
> rt_help();
> @@ -120,20 +124,11 @@ void *periodic_thread(void *arg)
> int failures = 0;
> nsec_t next = 0, now = 0, sched_delta = 0, delta = 0, prev = 0;
>
> - stats_container_t dat;
> - stats_container_t hist;
> - stats_quantiles_t quantiles;
> -
> prev = start;
> next = start;
> now = rt_gettime();
> start_delay = (now - start)/NS_PER_US;
>
> - stats_container_init(&dat, iterations);
> - stats_container_init(&hist, HIST_BUCKETS);
> - /* use the highest value for the quantiles */
> - stats_quantiles_init(&quantiles, log10(iterations));
> -
> debug(DBG_INFO, "ITERATION DELAY(US) MAX_DELAY(US) FAILURES\n");
> debug(DBG_INFO, "--------- --------- ------------- --------\n");
>
> @@ -265,6 +260,21 @@ int main(int argc, char *argv[])
> printf("jvmsim disabled\n");
> }
>
> + if (stats_container_init(&dat, iterations))
> + exit(1);
> +
> + if (stats_container_init(&hist, HIST_BUCKETS)) {
> + stats_container_free(&dat);
> + exit(1);
> + }
> +
> + /* use the highest value for the quantiles */
> + if (stats_quantiles_init(&quantiles, log10(iterations))) {
> + stats_container_free(&hist);
> + stats_container_free(&dat);
> + exit(1);
> + }
> +
> start = rt_gettime();
> per_id = create_fifo_thread(periodic_thread, (void*)0, PRIO);
>
> @@ -274,5 +284,9 @@ int main(int argc, char *argv[])
> printf("\nCriteria: latencies < %d us\n", PASS_US);
> printf("Result: %s\n", ret ? "FAIL" : "PASS");
>
> + stats_container_free(&dat);
> + stats_container_free(&hist);
> + stats_quantiles_free(&quantiles);
> +
> return ret;
> }
--
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
-------------------------------------------------------------------------
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