summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2009-11-28 01:33:47 +0300
committerFrank Ch. Eigler <fche@elastic.org>2009-12-01 11:57:33 -0500
commit98c783852039061db8c1611742660aaded0eab77 (patch)
tree687432f0b432ea3f70ae7b6d457c8571844e5f71 /runtime
parent5f4fd35709b9b3e94873c6e38c574066c470a9e3 (diff)
downloadsystemtap-steved-98c783852039061db8c1611742660aaded0eab77.tar.gz
systemtap-steved-98c783852039061db8c1611742660aaded0eab77.tar.xz
systemtap-steved-98c783852039061db8c1611742660aaded0eab77.zip
Use proper types for do_div
do_div accepts unsigned 64-bit integer type for dividend, signed types would cause do_div's typecheck fail: stat-common.c: In function 'needed_space': stat-common.c:50: error: comparison of distinct pointer types lacks a cast ...same errors in time.c and tapset-timers.cxx's generated code... A fix for time.c is special, on ppc32 cycles_t is 32-bit, so technically we don't need do_div, but since the whole _stp_gettimeofday_ns() operates on 64-bit types we'd better be safe and use uint64_t for the math. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/stat-common.c8
-rw-r--r--runtime/time.c3
2 files changed, 6 insertions, 5 deletions
diff --git a/runtime/stat-common.c b/runtime/stat-common.c
index 7123dc8e..f9703049 100644
--- a/runtime/stat-common.c
+++ b/runtime/stat-common.c
@@ -34,7 +34,7 @@ static int _stp_stat_calc_buckets(int stop, int start, int interval)
return buckets;
}
-static int needed_space(int64_t v)
+static int needed_space(uint64_t v)
{
int space = 0;
@@ -134,7 +134,7 @@ static void _stp_stat_print_histogram_buf(char *buf, size_t size, Hist st, stat
{
int scale, i, j, val_space, cnt_space;
int low_bucket = -1, high_bucket = 0, over = 0, under = 0;
- int64_t val, v, valmax = 0;
+ uint64_t val, v, valmax = 0;
int eliding = 0;
char *cur_buf = buf, *fake = buf;
char **bufptr = (buf == NULL ? &fake : &cur_buf);
@@ -186,7 +186,7 @@ static void _stp_stat_print_histogram_buf(char *buf, size_t size, Hist st, stat
if (valmax <= HIST_WIDTH)
scale = 1;
else {
- int64_t tmp = valmax;
+ uint64_t tmp = valmax;
int rem = do_div(tmp, HIST_WIDTH);
scale = tmp;
if (rem) scale++;
@@ -282,7 +282,7 @@ static void _stp_stat_print_histogram(Hist st, stat *sd)
_stp_print_flush();
}
-static void __stp_stat_add (Hist st, stat *sd, int64_t val)
+static void __stp_stat_add (Hist st, stat *sd, uint64_t val)
{
int n;
if (sd->count == 0) {
diff --git a/runtime/time.c b/runtime/time.c
index 58c23e57..d588370f 100644
--- a/runtime/time.c
+++ b/runtime/time.c
@@ -275,7 +275,8 @@ static int64_t
_stp_gettimeofday_ns(void)
{
int64_t base;
- cycles_t last, delta;
+ cycles_t last;
+ uint64_t delta;
unsigned int freq;
unsigned int seq;
stp_time_t *time;