X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fprofile.c;h=83ff77c2dc7c4c9bc6a003e7c21aaa7134dcd0bb;hb=cabef723285b3d2e61db2fd84440dca848d12888;hp=bd76af3e2934b99dde7a000d0210db0a3055d5ae;hpb=49ed04e2e93a6a5b01058638224621d5c07db01c;p=libucw.git diff --git a/lib/profile.c b/lib/profile.c index bd76af3e..83ff77c2 100644 --- a/lib/profile.c +++ b/lib/profile.c @@ -1,5 +1,5 @@ /* - * Sherlock Library -- Poor Man's Profiler + * UCW Library -- Poor Man's Profiler * * (c) 2001 Martin Mares * @@ -39,12 +39,12 @@ prof_tod_switch(struct prof_tod *o, struct prof_tod *n) if (o->usec < 0) { o->usec += 1000000; - o->sec++; + o->sec--; } else while (o->usec >= 1000000) { o->usec -= 1000000; - o->sec--; + o->sec++; } } } @@ -68,7 +68,7 @@ prof_tsc_init(struct prof_tsc *c) int prof_tsc_format(char *buf, struct prof_tsc *c) { - return sprintf(buf, "%Ld", c->ticks); + return sprintf(buf, "%lld", c->ticks); } #endif @@ -97,13 +97,13 @@ prof_ktsc_init(struct prof_ktsc *c) void prof_ktsc_switch(struct prof_ktsc *o, struct prof_ktsc *n) { - u64 u, s; + unsigned long long u, s; byte buf[256]; int l = pread(self_prof_fd, buf, sizeof(buf)-1, 0); ASSERT(l > 0 && l < (int)sizeof(buf)-1); buf[l] = 0; - l = sscanf(buf, "%Ld%Ld", &u, &s); + l = sscanf(buf, "%lld%lld", &u, &s); ASSERT(l == 2); if (n) @@ -123,7 +123,7 @@ prof_ktsc_switch(struct prof_ktsc *o, struct prof_ktsc *n) int prof_ktsc_format(char *buf, struct prof_ktsc *c) { - return sprintf(buf, "%Ld+%Ld", c->ticks_user, c->ticks_sys); + return sprintf(buf, "%lld+%lld", (long long) c->ticks_user, (long long) c->ticks_sys); } #endif