summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2010-06-25 16:10:40 -0500
committerClark Williams <williams@redhat.com>2010-06-25 16:10:40 -0500
commite4c7a0753cbcefec45f3bfd939528baf1643c3fc (patch)
treea33145834c0f2b6b5c3ae8720c04461b01bee03a
parenta3194e71ef314ee6fb86577e2c13ea6a9a5dcd64 (diff)
downloadrt-tests-e4c7a0753cbcefec45f3bfd939528baf1643c3fc.tar.gz
convert convert 'unsigned long long' and 'long long' to uint64_t and int64_t
Cleanup spurred by need to make the 'diff' variable in timerthread() to be unsigned and 64-bits (rather than a signed 32-bit). Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r--src/cyclictest/cyclictest.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 6829d34..0847aed 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <getopt.h>
@@ -270,18 +271,18 @@ static inline void tsnorm(struct timespec *ts)
}
}
-static inline long long calcdiff(struct timespec t1, struct timespec t2)
+static inline int64_t calcdiff(struct timespec t1, struct timespec t2)
{
- long long diff;
+ int64_t diff;
diff = USEC_PER_SEC * (long long)((int) t1.tv_sec - (int) t2.tv_sec);
diff += ((int) t1.tv_nsec - (int) t2.tv_nsec) / 1000;
return diff;
}
-static inline long long calcdiff_ns(struct timespec t1, struct timespec t2)
+static inline int64_t calcdiff_ns(struct timespec t1, struct timespec t2)
{
- long long diff;
- diff = NSEC_PER_SEC * (long long)((int) t1.tv_sec - (int) t2.tv_sec);
+ int64_t diff;
+ diff = NSEC_PER_SEC * (int64_t)((int) t1.tv_sec - (int) t2.tv_sec);
diff += ((int) t1.tv_nsec - (int) t2.tv_nsec);
return diff;
}
@@ -630,7 +631,7 @@ void *timerthread(void *param)
while (!shutdown) {
- long diff;
+ uint64_t diff;
int sigs, ret;
/* Wait for next period */
@@ -1139,7 +1140,7 @@ static void print_tids(struct thread_param *par[], int nthreads)
static void print_hist(struct thread_param *par[], int nthreads)
{
int i, j;
- unsigned long long log_entries[nthreads];
+ uint64_t log_entries[nthreads];
bzero(log_entries, sizeof(log_entries));
@@ -1355,7 +1356,7 @@ int main(int argc, char **argv)
case AFFINITY_USEALL: par->cpu = i % max_cpus; break;
}
stat->min = 1000000;
- stat->max = -1000000;
+ stat->max = 0;
stat->avg = 0.0;
stat->threadstarted = 1;
status = pthread_create(&stat->thread, &attr, timerthread, par);