Fix runtime displaying of the min and max latencies (when used with -v3).
While at it, remove an uneeded avg variable.

Signed-off-by: Sebastien Dugue <[EMAIL PROTECTED]>
Cc: Sripathi Kodi <[EMAIL PROTECTED]>
Cc: Darren Hart <[EMAIL PROTECTED]>
Cc: Tim Chavez <[EMAIL PROTECTED]>
---
 .../pthread_kill_latency/pthread_kill_latency.c    |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

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 e9b95fa..53667a7 100644
--- a/testcases/realtime/func/pthread_kill_latency/pthread_kill_latency.c
+++ b/testcases/realtime/func/pthread_kill_latency/pthread_kill_latency.c
@@ -65,9 +65,8 @@
 /* Get the pthread structure corresponding to this thread id */
 #define PTHREADOF(tid) get_thread(tid)->pthread
 
-nsec_t begin, end, max, min;
+nsec_t begin, end;
 int fail;
-float avg;
 
 atomic_t flag;
 
@@ -118,6 +117,7 @@ void *signal_receiving_thread(void *arg)
 {
        int i, ret, sig;
        long delta;
+       long max, min;
        sigset_t set, oset;
 
        stats_container_t dat;
@@ -150,9 +150,7 @@ void *signal_receiving_thread(void *arg)
                atomic_set(1, &flag);
        }
 
-       max = 0;
-       min = -1;
-       avg = 0;
+       max = min = 0;
        fail = 0;
        debug(DBG_INFO, "\n\n");
        for (i = 0; i < ITERATIONS; i++) {
@@ -162,9 +160,16 @@ void *signal_receiving_thread(void *arg)
                dat.records[i].x = i;
                dat.records[i].y = delta;
 
+               if (i == 0 || delta < min)
+                       min = delta;
+
+               if (delta > max)
+                       max = delta;
+
                if (delta > THRESHOLD) fail++;
 
-               debug(DBG_INFO, "Iteration %d: Took %ld us. Max = %0.2lf us, 
Min = %0.2lf us\n", i, delta, (double)max/NS_PER_US, (double)min/NS_PER_US);
+               debug(DBG_INFO, "Iteration %d: Took %ld us. Max = %ld us, "
+                     "Min = %ld us\n", i, delta, max, min);
 
                fflush(stdout);
                buffer_print();
-- 
1.5.4.rc2.84.gf85fd-dirty


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

Reply via email to