Module: xenomai-3
Branch: next
Commit: 3759aa162c5359fc2c9e0d07590b157186ebe90f
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3759aa162c5359fc2c9e0d07590b157186ebe90f

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Oct 22 10:53:36 2014 +0200

cobalt/testsuite: fixup for 32bit emulation

---

 demo/alchemy/altency.c              |   44 ++++++++++----------
 include/rtdm/uapi/autotune.h        |    2 +
 include/rtdm/uapi/testing.h         |   78 ++++++++++-------------------------
 kernel/drivers/testing/switchtest.c |    2 +-
 kernel/drivers/testing/timerbench.c |   28 ++++++-------
 testsuite/latency/latency.c         |   53 ++++++++++++------------
 testsuite/switchtest/switchtest.c   |    6 +--
 7 files changed, 90 insertions(+), 123 deletions(-)

diff --git a/demo/alchemy/altency.c b/demo/alchemy/altency.c
index ef1a694..2e4d093 100644
--- a/demo/alchemy/altency.c
+++ b/demo/alchemy/altency.c
@@ -25,9 +25,9 @@ RT_SEM display_sem;
 #define TEN_MILLIONS    10000000
 
 unsigned max_relaxed;
-long minjitter, maxjitter, avgjitter;
-long gminjitter = TEN_MILLIONS, gmaxjitter = -TEN_MILLIONS, goverrun = 0;
-long long gavgjitter = 0;
+int32_t minjitter, maxjitter, avgjitter;
+int32_t gminjitter = TEN_MILLIONS, gmaxjitter = -TEN_MILLIONS, goverrun = 0;
+int64_t gavgjitter = 0;
 
 long long period_ns = 0;
 int test_duration = 0;         /* sec of testing, via -T <sec>, 0 is inf */
@@ -57,7 +57,7 @@ int test_loops = 0;           /* outer loop count */
 #define WARMUP_TIME 1
 #define HISTOGRAM_CELLS 300
 int histogram_size = HISTOGRAM_CELLS;
-long *histogram_avg = NULL, *histogram_max = NULL, *histogram_min = NULL;
+int32_t *histogram_avg = NULL, *histogram_max = NULL, *histogram_min = NULL;
 
 char *do_gnuplot = NULL;
 int do_histogram = 0, do_stats = 0, finished = 0;
@@ -65,10 +65,10 @@ int bucketsize = 1000;              /* default = 1000ns, -B 
<size> to override */
 
 #define need_histo() (do_histogram || do_stats || do_gnuplot)
 
-static inline void add_histogram(long *histogram, long addval)
+static inline void add_histogram(int32_t *histogram, int32_t addval)
 {
        /* bucketsize steps */
-       long inabs = (addval >= 0 ? addval : -addval) / bucketsize;
+       int inabs = (addval >= 0 ? addval : -addval) / bucketsize;
        histogram[inabs < histogram_size ? inabs : histogram_size - 1]++;
 }
 
@@ -77,7 +77,7 @@ static void latency(void *cookie)
        RTIME expected_ns, start_ns, fault_threshold;
        unsigned int old_relaxed = 0, new_relaxed;
        int ret, count, nsamples, warmup = 1;
-       long minj, maxj, dt, overrun, sumj;
+       int32_t minj, maxj, dt, overrun, sumj;
        unsigned long ov;
 
        fault_threshold = CONFIG_XENO_DEFAULT_PERIOD;
@@ -100,7 +100,7 @@ static void latency(void *cookie)
 
                for (count = sumj = 0; count < nsamples; count++) {
                        ret = rt_task_wait_period(&ov);
-                       dt = (long)(rt_timer_read() - expected_ns);
+                       dt = (int32_t)(rt_timer_read() - expected_ns);
                        new_relaxed = sampling_relaxed;
                        if (dt > maxj) {
                                if (new_relaxed != old_relaxed
@@ -213,7 +213,7 @@ static void display(void *cookie)
                        test_duration);
 
        for (;;) {
-               long minj, gminj, maxj, gmaxj, avgj;
+               int32_t minj, gminj, maxj, gmaxj, avgj;
 
                if (test_mode == USER_TASK) {
                        ret = rt_sem_p(&display_sem, TM_INFINITE);
@@ -268,7 +268,7 @@ static void display(void *cookie)
                                       "----lat max", "-overrun", "---msw",
                                       "---lat best", "--lat worst");
                        }
-                       
printf("RTD|%11.3f|%11.3f|%11.3f|%8ld|%6u|%11.3f|%11.3f\n",
+                       
printf("RTD|%11.3f|%11.3f|%11.3f|%8d|%6u|%11.3f|%11.3f\n",
                               (double)minj / 1000,
                               (double)avgj / 1000,
                               (double)maxj / 1000,
@@ -279,7 +279,7 @@ static void display(void *cookie)
        }
 }
 
-static double dump_histogram(long *histogram, char *kind)
+static double dump_histogram(int32_t *histogram, char *kind)
 {
        int n, total_hits = 0;
        double avg = 0;         /* used to sum hits 1st */
@@ -288,13 +288,13 @@ static double dump_histogram(long *histogram, char *kind)
                printf("---|--param|----range-|--samples\n");
 
        for (n = 0; n < histogram_size; n++) {
-               long hits = histogram[n];
+               int32_t hits = histogram[n];
 
                if (hits) {
                        total_hits += hits;
                        avg += n * hits;
                        if (do_histogram)
-                               printf("HSD|    %s| %3d -%3d | %8ld\n",
+                               printf("HSD|    %s| %3d -%3d | %8d\n",
                                       kind, n, n + 1, hits);
                }
        }
@@ -304,7 +304,7 @@ static double dump_histogram(long *histogram, char *kind)
        return avg;
 }
 
-static void dump_histo_gnuplot(long *histogram)
+static void dump_histo_gnuplot(int32_t *histogram)
 {
        unsigned start, stop;
        FILE *f;
@@ -324,20 +324,20 @@ static void dump_histo_gnuplot(long *histogram)
 
        fprintf(f, "%g 1\n", start * bucketsize / 1000.0);
        for (n = start; n <= stop; n++)
-               fprintf(f, "%g %ld\n",
+               fprintf(f, "%g %d\n",
                        (n + 0.5) * bucketsize / 1000.0, histogram[n] + 1);
        fprintf(f, "%g 1\n", (stop + 1) * bucketsize / 1000.0);
 
        fclose(f);
 }
 
-static void dump_stats(long *histogram, char *kind, double avg)
+static void dump_stats(int32_t *histogram, char *kind, double avg)
 {
        int n, total_hits = 0;
        double variance = 0;
 
        for (n = 0; n < histogram_size; n++) {
-               long hits = histogram[n];
+               int32_t hits = histogram[n];
 
                if (hits) {
                        total_hits += hits;
@@ -378,7 +378,7 @@ static void dump_hist_stats(void)
 static void cleanup(void)
 {
        time_t actual_duration;
-       long gmaxj, gminj, gavgj;
+       int32_t gmaxj, gminj, gavgj;
 
        if (test_mode == USER_TASK) {
                rt_sem_delete(&display_sem);
@@ -414,7 +414,7 @@ static void cleanup(void)
 
        printf
            
("---|-----------|-----------|-----------|--------|------|-------------------------\n"
-            "RTS|%11.3f|%11.3f|%11.3f|%8ld|%6u|    
%.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
+            "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    
%.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
             (double)gminj / 1000, (double)gavgj / 1000, (double)gmaxj / 1000,
             goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 
60) % 60,
             actual_duration % 60, test_duration / 3600,
@@ -586,9 +586,9 @@ int main(int argc, char *const *argv)
 
        time(&test_start);
 
-       histogram_avg = calloc(histogram_size, sizeof(long));
-       histogram_max = calloc(histogram_size, sizeof(long));
-       histogram_min = calloc(histogram_size, sizeof(long));
+       histogram_avg = calloc(histogram_size, sizeof(int32_t));
+       histogram_max = calloc(histogram_size, sizeof(int32_t));
+       histogram_min = calloc(histogram_size, sizeof(int32_t));
 
        if (!(histogram_avg && histogram_max && histogram_min))
                cleanup();
diff --git a/include/rtdm/uapi/autotune.h b/include/rtdm/uapi/autotune.h
index 225f2f8..ab6cab1 100644
--- a/include/rtdm/uapi/autotune.h
+++ b/include/rtdm/uapi/autotune.h
@@ -20,6 +20,8 @@
 #ifndef _RTDM_UAPI_AUTOTUNE_H
 #define _RTDM_UAPI_AUTOTUNE_H
 
+#include <linux/types.h>
+
 #define RTDM_CLASS_AUTOTUNE            RTDM_CLASS_MISC
 #define RTDM_SUBCLASS_AUTOTUNE         0
 
diff --git a/include/rtdm/uapi/testing.h b/include/rtdm/uapi/testing.h
index 76d9678..710bea8 100644
--- a/include/rtdm/uapi/testing.h
+++ b/include/rtdm/uapi/testing.h
@@ -23,14 +23,16 @@
 #ifndef _RTDM_UAPI_TESTING_H
 #define _RTDM_UAPI_TESTING_H
 
+#include <linux/types.h>
+
 #define RTTST_PROFILE_VER              2
 
 typedef struct rttst_bench_res {
-       long long avg;
-       long min;
-       long max;
-       long overruns;
-       long test_loops;
+       __s32 avg;
+       __s32 min;
+       __s32 max;
+       __s32 overruns;
+       __s32 test_loops;
 } rttst_bench_res_t;
 
 typedef struct rttst_interm_bench_res {
@@ -40,10 +42,9 @@ typedef struct rttst_interm_bench_res {
 
 typedef struct rttst_overall_bench_res {
        struct rttst_bench_res result;
-       long *histogram_avg;
-       long *histogram_min;
-       long *histogram_max;
-       void *__padding;        /* align to dwords on 32-bit archs */
+       __s32 *histogram_avg;
+       __s32 *histogram_min;
+       __s32 *histogram_max;
 } rttst_overall_bench_res_t;
 
 #define RTTST_TMBENCH_INVALID          -1 /* internal use only */
@@ -53,38 +54,16 @@ typedef struct rttst_overall_bench_res {
 typedef struct rttst_tmbench_config {
        int mode;
        int priority;
-       nanosecs_rel_t period;
+       __u64 period;
        int warmup_loops;
        int histogram_size;
        int histogram_bucketsize;
        int freeze_max;
 } rttst_tmbench_config_t;
 
-#define RTTST_IRQBENCH_USER_TASK       0
-#define RTTST_IRQBENCH_KERNEL_TASK     1
-#define RTTST_IRQBENCH_HANDLER         2
-#define RTTST_IRQBENCH_HARD_IRQ                3
-
-#define RTTST_IRQBENCH_SERPORT         0
-#define RTTST_IRQBENCH_PARPORT         1
-
-typedef struct rttst_irqbench_config {
-       int mode;
-       int priority;
-       int calibration_loops;
-       unsigned int port_type;
-       unsigned long port_ioaddr;
-       unsigned int port_irq;
-} rttst_irqbench_config_t;
-
-typedef struct rttst_irqbench_stats {
-       unsigned long long irqs_received;
-       unsigned long long irqs_acknowledged;
-} rttst_irqbench_stats_t;
-
 struct rttst_swtest_task {
-       unsigned index;
-       unsigned flags;
+       unsigned int index;
+       unsigned int flags;
 };
 
 /* Possible values for struct rttst_swtest_task::flags. */
@@ -93,13 +72,13 @@ struct rttst_swtest_task {
 #define RTTST_SWTEST_FREEZE            0x4 /* Only for kernel-space tasks. */
 
 struct rttst_swtest_dir {
-       unsigned from;
-       unsigned to;
+       unsigned int from;
+       unsigned int to;
 };
 
 struct rttst_swtest_error {
        struct rttst_swtest_dir last_switch;
-       unsigned fp_val;
+       unsigned int fp_val;
 };
 
 #define RTTST_RTDM_NORMAL_CLOSE                0
@@ -133,26 +112,11 @@ struct rttst_swtest_error {
 #define RTTST_RTIOC_TMBENCH_STOP \
        _IOWR(RTIOC_TYPE_TESTING, 0x11, struct rttst_overall_bench_res)
 
-#define RTTST_RTIOC_IRQBENCH_START \
-       _IOW(RTIOC_TYPE_TESTING, 0x20, struct rttst_irqbench_config)
-
-#define RTTST_RTIOC_IRQBENCH_STOP \
-       _IO(RTIOC_TYPE_TESTING, 0x21)
-
-#define RTTST_RTIOC_IRQBENCH_GET_STATS \
-       _IOR(RTIOC_TYPE_TESTING, 0x22, struct rttst_irqbench_stats)
-
-#define RTTST_RTIOC_IRQBENCH_WAIT_IRQ \
-       _IO(RTIOC_TYPE_TESTING, 0x23)
-
-#define RTTST_RTIOC_IRQBENCH_REPLY_IRQ \
-       _IO(RTIOC_TYPE_TESTING, 0x24)
-
 #define RTTST_RTIOC_SWTEST_SET_TASKS_COUNT \
-       _IOW(RTIOC_TYPE_TESTING, 0x30, unsigned long)
+       _IOW(RTIOC_TYPE_TESTING, 0x30, __u32)
 
 #define RTTST_RTIOC_SWTEST_SET_CPU \
-       _IOW(RTIOC_TYPE_TESTING, 0x31, unsigned long)
+       _IOW(RTIOC_TYPE_TESTING, 0x31, __u32)
 
 #define RTTST_RTIOC_SWTEST_REGISTER_UTASK \
        _IOW(RTIOC_TYPE_TESTING, 0x32, struct rttst_swtest_task)
@@ -167,16 +131,16 @@ struct rttst_swtest_error {
        _IOR(RTIOC_TYPE_TESTING, 0x35, struct rttst_swtest_dir)
 
 #define RTTST_RTIOC_SWTEST_GET_SWITCHES_COUNT \
-       _IOR(RTIOC_TYPE_TESTING, 0x36, unsigned long)
+       _IOR(RTIOC_TYPE_TESTING, 0x36, __u32)
 
 #define RTTST_RTIOC_SWTEST_GET_LAST_ERROR \
        _IOR(RTIOC_TYPE_TESTING, 0x37, struct rttst_swtest_error)
 
 #define RTTST_RTIOC_SWTEST_SET_PAUSE \
-       _IOW(RTIOC_TYPE_TESTING, 0x38, unsigned long)
+       _IOW(RTIOC_TYPE_TESTING, 0x38, __u32)
 
 #define RTTST_RTIOC_RTDM_DEFER_CLOSE \
-       _IOW(RTIOC_TYPE_TESTING, 0x40, unsigned long)
+       _IOW(RTIOC_TYPE_TESTING, 0x40, __u32)
 /** @} */
 
 #endif /* !_RTDM_UAPI_TESTING_H */
diff --git a/kernel/drivers/testing/switchtest.c 
b/kernel/drivers/testing/switchtest.c
index 804c35b..f9cb78e 100644
--- a/kernel/drivers/testing/switchtest.c
+++ b/kernel/drivers/testing/switchtest.c
@@ -577,7 +577,7 @@ static int rtswitch_ioctl_nrt(struct rtdm_fd *fd,
        struct rtswitch_context *ctx = rtdm_fd_to_private(fd);
        struct rttst_swtest_task task;
        struct rttst_swtest_dir fromto;
-       unsigned long count;
+       __u32 count;
        int err;
 
        switch (request) {
diff --git a/kernel/drivers/testing/timerbench.c 
b/kernel/drivers/testing/timerbench.c
index 38b7670..9dc0e3e 100644
--- a/kernel/drivers/testing/timerbench.c
+++ b/kernel/drivers/testing/timerbench.c
@@ -31,13 +31,13 @@ MODULE_LICENSE("GPL");
 
 struct rt_tmbench_context {
        int mode;
-       unsigned long period;
+       unsigned int period;
        int freeze_max;
        int warmup_loops;
        int samples_per_sec;
-       long *histogram_min;
-       long *histogram_max;
-       long *histogram_avg;
+       int32_t *histogram_min;
+       int32_t *histogram_max;
+       int32_t *histogram_avg;
        int histogram_size;
        int bucketsize;
 
@@ -56,10 +56,10 @@ struct rt_tmbench_context {
 };
 
 static inline void add_histogram(struct rt_tmbench_context *ctx,
-                                long *histogram, long addval)
+                                __s32 *histogram, __s32 addval)
 {
        /* bucketsize steps */
-       long inabs = (addval >= 0 ? addval : -addval) / ctx->bucketsize;
+       int inabs = (addval >= 0 ? addval : -addval) / ctx->bucketsize;
        histogram[inabs < ctx->histogram_size ?
                  inabs : ctx->histogram_size - 1]++;
 }
@@ -69,7 +69,7 @@ static inline long long slldiv(long long s, unsigned d)
        return s >= 0 ? xnarch_ulldiv(s, d, NULL) : -xnarch_ulldiv(-s, d, NULL);
 }
 
-static void eval_inner_loop(struct rt_tmbench_context *ctx, long dt)
+static void eval_inner_loop(struct rt_tmbench_context *ctx, __s32 dt)
 {
        if (dt > ctx->curr.max)
                ctx->curr.max = dt;
@@ -156,8 +156,8 @@ static void timer_task_proc(void *arg)
                                return;
 
                        eval_inner_loop(ctx,
-                                       (long)(rtdm_clock_read_monotonic() -
-                                              ctx->date));
+                                       (__s32)(rtdm_clock_read_monotonic() -
+                                               ctx->date));
                }
                eval_outer_loop(ctx);
        }
@@ -170,8 +170,8 @@ static void timer_proc(rtdm_timer_t *timer)
        int err;
 
        do {
-               eval_inner_loop(ctx, (long)(rtdm_clock_read_monotonic() -
-                                           ctx->date));
+               eval_inner_loop(ctx, (__s32)(rtdm_clock_read_monotonic() -
+                                            ctx->date));
 
                ctx->start_time = rtdm_clock_read_monotonic();
                err = rtdm_timer_start_in_handler(&ctx->timer, ctx->date, 0,
@@ -252,7 +252,7 @@ static int rt_tmbench_start(struct rtdm_fd *fd,
 
        if (ctx->histogram_size > 0) {
                ctx->histogram_min =
-                   kmalloc(3 * ctx->histogram_size * sizeof(long),
+                   kmalloc(3 * ctx->histogram_size * sizeof(int32_t),
                            GFP_KERNEL);
                ctx->histogram_max =
                    ctx->histogram_min + config->histogram_size;
@@ -265,7 +265,7 @@ static int rt_tmbench_start(struct rtdm_fd *fd,
                }
 
                memset(ctx->histogram_min, 0,
-                      3 * ctx->histogram_size * sizeof(long));
+                      3 * ctx->histogram_size * sizeof(int32_t));
                ctx->bucketsize = config->histogram_bucketsize;
        }
 
@@ -357,7 +357,7 @@ static int rt_tmbench_stop(struct rt_tmbench_context *ctx,
        }
 
        if (ctx->histogram_size > 0) {
-               int size = ctx->histogram_size * sizeof(long);
+               int size = ctx->histogram_size * sizeof(int32_t);
 
                if (rtdm_fd_is_user(fd)) {
                        struct rttst_overall_bench_res res_buf;
diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c
index 862e15d..2b51b06 100644
--- a/testsuite/latency/latency.c
+++ b/testsuite/latency/latency.c
@@ -27,9 +27,9 @@ sem_t *display_sem;
 #define LOPRIO 0
 
 unsigned max_relaxed;
-long minjitter, maxjitter, avgjitter;
-long gminjitter = TEN_MILLIONS, gmaxjitter = -TEN_MILLIONS, goverrun = 0;
-long long gavgjitter = 0;
+int32_t minjitter, maxjitter, avgjitter;
+int32_t gminjitter = TEN_MILLIONS, gmaxjitter = -TEN_MILLIONS, goverrun = 0;
+int64_t gavgjitter = 0;
 
 long long period_ns = 0;
 int test_duration = 0;         /* sec of testing, via -T <sec>, 0 is inf */
@@ -60,7 +60,7 @@ int test_loops = 0;           /* outer loop count */
 #define WARMUP_TIME 1
 #define HISTOGRAM_CELLS 300
 int histogram_size = HISTOGRAM_CELLS;
-long *histogram_avg = NULL, *histogram_max = NULL, *histogram_min = NULL;
+int32_t *histogram_avg = NULL, *histogram_max = NULL, *histogram_min = NULL;
 
 char *do_gnuplot = NULL;
 int do_histogram = 0, do_stats = 0, finished = 0;
@@ -68,10 +68,10 @@ int bucketsize = 1000;              /* default = 1000ns, -B 
<size> to override */
 
 #define need_histo() (do_histogram || do_stats || do_gnuplot)
 
-static inline void add_histogram(long *histogram, long addval)
+static inline void add_histogram(int32_t *histogram, int32_t addval)
 {
        /* bucketsize steps */
-       long inabs = (addval >= 0 ? addval : -addval) / bucketsize;
+       int inabs = (addval >= 0 ? addval : -addval) / bucketsize;
        histogram[inabs < histogram_size ? inabs : histogram_size - 1]++;
 }
 
@@ -138,20 +138,21 @@ static void *latency(void *cookie)
        }
 
        for (;;) {
-               long minj = TEN_MILLIONS, maxj = -TEN_MILLIONS, dt;
-               long overrun = 0;
-               long long sumj;
+               int32_t minj = TEN_MILLIONS, maxj = -TEN_MILLIONS, dt;
+               uint32_t overrun = 0;
+               int64_t sumj;
+
                test_loops++;
 
                for (count = sumj = 0; count < nsamples; count++) {
-                       unsigned long long ticks;
-                       unsigned new_relaxed;
+                       unsigned int new_relaxed;
                        struct timespec now;
+                       uint64_t ticks;
 
                        err = read(tfd, &ticks, sizeof(ticks));
 
                        clock_gettime(CLOCK_MONOTONIC, &now);
-                       dt = (long)diff_ts(&now, &expected);
+                       dt = (int32_t)diff_ts(&now, &expected);
                        new_relaxed = sampling_relaxed;
                        if (dt > maxj) {
                                if (new_relaxed != old_relaxed
@@ -340,7 +341,7 @@ static void *display(void *cookie)
                                       "----lat max", "-overrun", "---msw",
                                       "---lat best", "--lat worst");
                        }
-                       
printf("RTD|%11.3f|%11.3f|%11.3f|%8ld|%6u|%11.3f|%11.3f\n",
+                       
printf("RTD|%11.3f|%11.3f|%11.3f|%8d|%6u|%11.3f|%11.3f\n",
                               (double)minj / 1000,
                               (double)avgj / 1000,
                               (double)maxj / 1000,
@@ -353,7 +354,7 @@ static void *display(void *cookie)
        return NULL;
 }
 
-static double dump_histogram(long *histogram, char *kind)
+static double dump_histogram(int32_t *histogram, char *kind)
 {
        int n, total_hits = 0;
        double avg = 0;         /* used to sum hits 1st */
@@ -362,13 +363,13 @@ static double dump_histogram(long *histogram, char *kind)
                printf("---|--param|----range-|--samples\n");
 
        for (n = 0; n < histogram_size; n++) {
-               long hits = histogram[n];
+               int32_t hits = histogram[n];
 
                if (hits) {
                        total_hits += hits;
                        avg += n * hits;
                        if (do_histogram)
-                               printf("HSD|    %s| %3d -%3d | %8ld\n",
+                               printf("HSD|    %s| %3d -%3d | %8d\n",
                                       kind, n, n + 1, hits);
                }
        }
@@ -378,7 +379,7 @@ static double dump_histogram(long *histogram, char *kind)
        return avg;
 }
 
-static void dump_histo_gnuplot(long *histogram)
+static void dump_histo_gnuplot(int32_t *histogram)
 {
        unsigned start, stop;
        FILE *f;
@@ -388,30 +389,30 @@ static void dump_histo_gnuplot(long *histogram)
        if (!f)
                return;
 
-       for (n = 0; n < histogram_size && histogram[n] == 0L; n++)
+       for (n = 0; n < histogram_size && histogram[n] == 0; n++)
                ;
        start = n;
 
-       for (n = histogram_size - 1; n >= 0 && histogram[n] == 0L; n--)
+       for (n = histogram_size - 1; n >= 0 && histogram[n] == 0; n--)
                ;
        stop = n;
 
        fprintf(f, "%g 1\n", start * bucketsize / 1000.0);
        for (n = start; n <= stop; n++)
-               fprintf(f, "%g %ld\n",
+               fprintf(f, "%g %d\n",
                        (n + 0.5) * bucketsize / 1000.0, histogram[n] + 1);
        fprintf(f, "%g 1\n", (stop + 1) * bucketsize / 1000.0);
 
        fclose(f);
 }
 
-static void dump_stats(long *histogram, char *kind, double avg)
+static void dump_stats(int32_t *histogram, char *kind, double avg)
 {
        int n, total_hits = 0;
        double variance = 0;
 
        for (n = 0; n < histogram_size; n++) {
-               long hits = histogram[n];
+               int32_t hits = histogram[n];
 
                if (hits) {
                        total_hits += hits;
@@ -496,7 +497,7 @@ static void cleanup(void)
 
        printf
            
("---|-----------|-----------|-----------|--------|------|-------------------------\n"
-            "RTS|%11.3f|%11.3f|%11.3f|%8ld|%6u|    
%.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
+            "RTS|%11.3f|%11.3f|%11.3f|%8d|%6u|    
%.2ld:%.2ld:%.2ld/%.2d:%.2d:%.2d\n",
             (double)gminj / 1000, (double)gavgj / 1000, (double)gmaxj / 1000,
             goverrun, max_relaxed, actual_duration / 3600, (actual_duration / 
60) % 60,
             actual_duration % 60, test_duration / 3600,
@@ -692,9 +693,9 @@ int main(int argc, char *const *argv)
 
        time(&test_start);
 
-       histogram_avg = calloc(histogram_size, sizeof(long));
-       histogram_max = calloc(histogram_size, sizeof(long));
-       histogram_min = calloc(histogram_size, sizeof(long));
+       histogram_avg = calloc(histogram_size, sizeof(int32_t));
+       histogram_max = calloc(histogram_size, sizeof(int32_t));
+       histogram_min = calloc(histogram_size, sizeof(int32_t));
 
        if (!(histogram_avg && histogram_max && histogram_min))
                cleanup();
diff --git a/testsuite/switchtest/switchtest.c 
b/testsuite/switchtest/switchtest.c
index d9e2535..5c5d6ae 100644
--- a/testsuite/switchtest/switchtest.c
+++ b/testsuite/switchtest/switchtest.c
@@ -208,8 +208,8 @@ static void display_cleanup(void *cookie)
 
 static void display_switches_count(struct cpu_tasks *cpu, struct timespec *now)
 {
-       unsigned long switches_count;
        static unsigned nlines = 0;
+       __u32 switches_count;
 
        if (ioctl(cpu->fd,
                  RTTST_RTIOC_SWTEST_GET_SWITCHES_COUNT,&switches_count)) {
@@ -249,10 +249,10 @@ static void display_switches_count(struct cpu_tasks *cpu, 
struct timespec *now)
        }
 
 #ifdef CONFIG_SMP
-       printf("RTD|%12u|%12lu|%12lu\n", cpu->index,
+       printf("RTD|%12u|%12lu|%12u\n", cpu->index,
               switches_count - cpu->last_switches_count, switches_count);
 #else /* !CONFIG_SMP */
-       printf("RTD|%12lu|%12lu\n",
+       printf("RTD|%12lu|%12u\n",
               switches_count - cpu->last_switches_count, switches_count);
 #endif /* !CONFIG_SMP */
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to