From: Tomas Hruby Date: Thu, 13 Aug 2009 15:47:49 +0000 (+0000) Subject: u64_t for human beings - the high and low parts are named hi and lo, lib/sysutil... X-Git-Tag: v3.1.5~202 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=88f7b6301905638bdce028b313667e6bc680fb80;p=minix.git u64_t for human beings - the high and low parts are named hi and lo, lib/sysutil/profile.c updated accordingly --- diff --git a/include/sys/types.h b/include/sys/types.h index 06b553e59..d959e13e7 100755 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -69,7 +69,10 @@ typedef char i8_t; /* 8 bit signed type */ typedef short i16_t; /* 16 bit signed type */ typedef long i32_t; /* 32 bit signed type */ -typedef struct { u32_t _[2]; } u64_t; +typedef struct { + u32_t lo; + u32_t hi; +} u64_t; /* The following types are needed because MINIX uses K&R style function * definitions (for maximum portability). When a short, such as dev_t, is diff --git a/lib/sysutil/profile.c b/lib/sysutil/profile.c index 9c6edb2cc..b64c03833 100644 --- a/lib/sysutil/profile.c +++ b/lib/sysutil/profile.c @@ -19,9 +19,6 @@ #include #include -#define U64_LO 0 -#define U64_HI 1 - PRIVATE char cpath[CPROF_CPATH_MAX_LEN]; /* current call path string */ PRIVATE int cpath_len; /* current call path len */ PRIVATE struct cprof_tbl_s *cprof_slot; /* slot of current function */ @@ -64,7 +61,7 @@ char *name; if (cprof_locked) return; else cprof_locked = 1; /* Read CPU cycle count into local variable. */ - read_tsc(&start._[U64_HI], &start._[U64_LO]); + read_tsc(&start.hi, &start.lo); /* Run init code once after system boot. */ if (init == 0) { @@ -108,8 +105,8 @@ char *name; } /* Save initial cycle count on stack. */ - cprof_stk[cprof_stk_top].start_1._[U64_HI] = start._[U64_HI]; - cprof_stk[cprof_stk_top].start_1._[U64_LO] = start._[U64_LO]; + cprof_stk[cprof_stk_top].start_1.hi = start.hi; + cprof_stk[cprof_stk_top].start_1.lo = start.lo; /* Check available call path len. */ if (cpath_len + strlen(name) + 1 > CPROF_CPATH_MAX_LEN) { @@ -170,8 +167,8 @@ char *name; cprof_stk[cprof_stk_top].slot = cprof_slot; /* Again save CPU cycle count on stack. */ - read_tsc(&cprof_stk[cprof_stk_top].start_2._[U64_HI], - &cprof_stk[cprof_stk_top].start_2._[U64_LO]); + read_tsc(&cprof_stk[cprof_stk_top].start_2.hi, + &cprof_stk[cprof_stk_top].start_2.lo); cprof_locked = 0; } @@ -185,7 +182,7 @@ char *name; if (cprof_locked) return; else cprof_locked = 1; /* First thing: read CPU cycle count into local variable. */ - read_tsc(&stop._[U64_HI], &stop._[U64_LO]); + read_tsc(&stop.hi, &stop.lo); /* Only continue if sane. */ if (control.err) return; @@ -204,8 +201,8 @@ char *name; sub64(spent, cprof_stk[cprof_stk_top].spent_deeper)); /* Clear spent_deeper for call level we're leaving. */ - cprof_stk[cprof_stk_top].spent_deeper._[U64_LO] = 0; - cprof_stk[cprof_stk_top].spent_deeper._[U64_HI] = 0; + cprof_stk[cprof_stk_top].spent_deeper.lo = 0; + cprof_stk[cprof_stk_top].spent_deeper.hi = 0; /* Adjust call path string and stack. */ cpath_len = cprof_stk[cprof_stk_top].cpath_len; @@ -221,7 +218,7 @@ char *name; */ /* Read CPU cycle count. */ - read_tsc(&stop._[U64_HI], &stop._[U64_LO]); + read_tsc(&stop.hi, &stop.lo); /* Calculate "big" difference. */ spent = sub64(stop, cprof_stk[cprof_stk_top].start_1); @@ -249,12 +246,12 @@ PRIVATE void cprof_init() { for (i=0; i