On Thursday 10 January 2008 03:12:21 Sebastien Dugue wrote:
>   The quantile calculation sorts the data samples, so move the
> calculation after saving the samples to a file.
>
> 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/gtod_latency/gtod_latency.c      |   12
> ++++++------ .../realtime/func/hrtimer-prio/hrtimer-prio.c      |   
> 2 +- .../func/periodic_cpu_load/periodic_cpu_load.c     |    2 +-
> .../periodic_cpu_load/periodic_cpu_load_single.c   |    8 +++++---
> testcases/realtime/func/pi_perf/pi_perf.c          |   11 ++++++-----
> .../pthread_kill_latency/pthread_kill_latency.c    |   10 +++++-----
> .../realtime/func/sched_latency/sched_latency.c    |   14
> ++++++++------ 7 files changed, 32 insertions(+), 27 deletions(-)
>
> diff --git a/testcases/realtime/func/gtod_latency/gtod_latency.c
> b/testcases/realtime/func/gtod_latency/gtod_latency.c index
> 638f1bc..777f66d 100644
> --- a/testcases/realtime/func/gtod_latency/gtod_latency.c
> +++ b/testcases/realtime/func/gtod_latency/gtod_latency.c
> @@ -283,8 +283,12 @@ int main(int argc, char *argv[])
>               }
>       }
>
> +     stats_hist(&hist, &dat);
> +     stats_container_save(filenames[SCATTER_FILENAME],
> titles[SCATTER_TITLE], +                           labels[SCATTER_LABELX],
> labels[SCATTER_LABELY], &dat, "points");
> +     stats_container_save(filenames[HIST_FILENAME], titles[HIST_TITLE],
> +                          labels[HIST_LABELX], labels[HIST_LABELY], &hist, 
> "steps");
> avg /= i + 1;
> -     stats_quantiles_calc(&dat, &quantiles);
>
>       /* report on deltas */
>       printf("Min: %llu us\n", min);
> @@ -292,13 +296,9 @@ int main(int argc, char *argv[])
>       printf("Avg: %.4f us\n", stats_avg(&dat));
>       printf("StdDev: %.4f us\n", stats_stddev(&dat));
>       printf("Quantiles:\n");
> +     stats_quantiles_calc(&dat, &quantiles);
>       stats_quantiles_print(&quantiles);
>
> -     stats_hist(&hist, &dat);
> -     stats_container_save(filenames[SCATTER_FILENAME],
> titles[SCATTER_TITLE], -                           labels[SCATTER_LABELX],
> labels[SCATTER_LABELY], &dat, "points");
> -     stats_container_save(filenames[HIST_FILENAME], titles[HIST_TITLE],
> -                          labels[HIST_LABELX], labels[HIST_LABELY], &hist, 
> "steps");
>
>       return 0;
>  }
> diff --git a/testcases/realtime/func/hrtimer-prio/hrtimer-prio.c
> b/testcases/realtime/func/hrtimer-prio/hrtimer-prio.c index
> df9709e..e58139a 100644
> --- a/testcases/realtime/func/hrtimer-prio/hrtimer-prio.c
> +++ b/testcases/realtime/func/hrtimer-prio/hrtimer-prio.c
> @@ -205,7 +205,6 @@ int main(int argc, char *argv[])
>       join_thread(t_id);
>
>       avg_delta = stats_avg(&dat);
> -     stats_quantiles_calc(&dat, &quantiles);
>       stats_hist(&hist, &dat);
>       stats_container_save("samples", "High Resolution Timer Latency
> Scatter Plot",\ "Iteration", "Latency (us)", &dat, "points");
> @@ -220,6 +219,7 @@ int main(int argc, char *argv[])
>       printf("Average: %f us\n", avg_delta);
>       printf("Standard Deviation: %f\n", stats_stddev(&dat));
>       printf("Quantiles:\n");
> +     stats_quantiles_calc(&dat, &quantiles);
>       stats_quantiles_print(&quantiles);
>       printf("\nCriteria: Maximum wakeup latency < %lu us\n", criteria);
>       printf("Result: %s\n", ret ? "FAIL" : "PASS");
> 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
> fc466f2..843dc3f 100644
> --- a/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
> +++ b/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load.c
> @@ -153,7 +153,6 @@ void *periodic_thread(void *thread)
>               i++;
>               rt_nanosleep(next - rt_gettime());
>       }
> -     stats_quantiles_calc(&dat, &quantiles);
>
>       printf("\nTID %d (prio %d) complete\n", t->id, t->priority);
>       printf("  Execution Time Statistics:\n");
> @@ -162,6 +161,7 @@ void *periodic_thread(void *thread)
>       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");
> diff --git
> a/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load_single.
>c
> b/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load_single.
>c index 3ba53b1..9015c91 100644
> ---
> a/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load_single.
>c +++
> b/testcases/realtime/func/periodic_cpu_load/periodic_cpu_load_single.
>c @@ -132,13 +132,11 @@ int periodic_thread(nsec_t period, int
> iterations, int loops) }
>               rt_nanosleep(next - now);
>       }
> -     stats_quantiles_calc(&dat, &quantiles);
> +
>       stats_container_save(samples_filename, "Periodic CPU Load Scatter
> Plot",\ "Iteration", "Runtime (us)", &dat, "points");
>       stats_container_save(hist_filename, "Periodic CPU Load Histogram",\
>                            "Iteration", "Runtime (us)", &hist, "steps");
> -     free(samples_filename);
> -     free(hist_filename);
>
>       printf("  Execution Time Statistics:\n");
>       printf("Min: %ld us\n", stats_min(&dat));
> @@ -146,10 +144,14 @@ int periodic_thread(nsec_t period, int
> iterations, int loops) printf("Avg: %.4f us\n", stats_avg(&dat));
>       printf("StdDev: %.4f us\n", stats_stddev(&dat));
>       printf("Quantiles:\n");
> +     stats_quantiles_calc(&dat, &quantiles);
>       stats_quantiles_print(&quantiles);
>       printf("Criteria: no missed periods\n");
>       printf("Result: %s\n", fail ? "FAIL":"PASS");
>
> +     free(samples_filename);
> +     free(hist_filename);
> +
>       return fail;
>  }
>
> diff --git a/testcases/realtime/func/pi_perf/pi_perf.c
> b/testcases/realtime/func/pi_perf/pi_perf.c index 82a6a64..4eb1d98
> 100644
> --- a/testcases/realtime/func/pi_perf/pi_perf.c
> +++ b/testcases/realtime/func/pi_perf/pi_perf.c
> @@ -199,19 +199,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",
> +             "Iteration", "Latency (us)", &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",
> -             "Iteration", "Latency (us)", &wait_hist, "steps");
>
>       return NULL;
>  }
> diff --git
> a/testcases/realtime/func/pthread_kill_latency/pthread_kill_latency.c
> b/testcases/realtime/func/pthread_kill_latency/pthread_kill_latency.c
> index 279caf5..6a66ae1 100644
> ---
> a/testcases/realtime/func/pthread_kill_latency/pthread_kill_latency.c
> +++
> b/testcases/realtime/func/pthread_kill_latency/pthread_kill_latency.c
> @@ -171,7 +171,10 @@ void *signal_receiving_thread(void *arg)
> atomic_set(1, &flag);
>       }
>
> -     stats_quantiles_calc(&dat, &quantiles);
> +     stats_container_save("samples", "pthread_kill Latency Scatter
> Plot", +                           "Iteration", "Latency (us)", &dat, 
> "points");
> +     stats_container_save("hist", "pthread_kill Latency Histogram",
> +                          "Iteration", "Latency (us)", &hist, "steps");
>       stats_hist(&hist, &dat);
>
>       printf("\n");
> @@ -180,16 +183,13 @@ void *signal_receiving_thread(void *arg)
>       printf("Avg: %.4f us\n", stats_avg(&dat));
>       printf("StdDev: %.4f us\n", stats_stddev(&dat));
>       printf("Quantiles:\n");
> +     stats_quantiles_calc(&dat, &quantiles);
>       stats_quantiles_print(&quantiles);
>      printf("Failures: %d\n", fail);
>       printf("Criteria: Time < %d us\n", THRESHOLD);
>       printf("Result: %s", fail ? "FAIL" : "PASS");
>       printf("\n\n");
>
> -     stats_container_save("samples", "pthread_kill Latency Scatter
> Plot", -                           "Iteration", "Latency (us)", &dat, 
> "points");
> -     stats_container_save("hist", "pthread_kill Latency Histogram",
> -                          "Iteration", "Latency (us)", &hist, "steps");
>
>       return NULL;
>  }
> diff --git a/testcases/realtime/func/sched_latency/sched_latency.c
> b/testcases/realtime/func/sched_latency/sched_latency.c index
> dda44bf..3370b13 100644
> --- a/testcases/realtime/func/sched_latency/sched_latency.c
> +++ b/testcases/realtime/func/sched_latency/sched_latency.c
> @@ -202,8 +202,14 @@ void *periodic_thread(void *arg)
>               }
>       }
>
> +     /* save samples before the quantile calculation messes things up!
> */ +  stats_hist(&hist, &dat);
> +     stats_container_save("samples", "Periodic Scheduling Latency
> Scatter Plot",\ +                          "Iteration", "Latency (us)", &dat,
> "points");
> +     stats_container_save("hist", "Periodic Scheduling Latency
> Histogram",\ +                             "Iteration", "Latency (us)", 
> &hist, "steps");
> +
>       avg_delay /= (i - 1);
> -     stats_quantiles_calc(&dat, &quantiles);
>       printf("\n\n");
>       printf("Start: %4llu us: %s\n", start_delay,
>               start_delay < PASS_US ? "PASS" : "FAIL");
> @@ -215,13 +221,9 @@ void *periodic_thread(void *arg)
>               avg_delay < PASS_US ? "PASS" : "FAIL");
>       printf("StdDev: %.4f us\n", stats_stddev(&dat));
>       printf("Quantiles:\n");
> +     stats_quantiles_calc(&dat, &quantiles);
>       stats_quantiles_print(&quantiles);
>       printf("Failed Iterations: %d\n", failures);
> -     stats_hist(&hist, &dat);
> -     stats_container_save("samples", "Periodic Scheduling Latency
> Scatter Plot",\ -                          "Iteration", "Latency (us)", &dat,
> "points");
> -     stats_container_save("hist", "Periodic Scheduling Latency
> Histogram",\ -                             "Iteration", "Latency (us)", 
> &hist, "steps");
>
>       return NULL;
>  }



-- 
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

Reply via email to