|
|
|
@ -16,14 +16,15 @@ typedef long (*syscall_t)(long, long, long, long, long, long, long); |
|
|
|
void sys_exit(int code) |
|
|
|
{ |
|
|
|
if (current.cycle0) { |
|
|
|
size_t dt = rdtime() - current.time0; |
|
|
|
size_t dc = rdcycle() - current.cycle0; |
|
|
|
size_t di = rdinstret() - current.instret0; |
|
|
|
|
|
|
|
printk("%ld ticks\n", dt); |
|
|
|
printk("%ld cycles\n", dc); |
|
|
|
printk("%ld instructions\n", di); |
|
|
|
printk("%d.%d%d CPI\n", dc/di, 10ULL*dc/di % 10, (100ULL*dc + di/2)/di % 10); |
|
|
|
uint64_t dt = rdtime64() - current.time0; |
|
|
|
uint64_t dc = rdcycle64() - current.cycle0; |
|
|
|
uint64_t di = rdinstret64() - current.instret0; |
|
|
|
|
|
|
|
printk("%lld ticks\n", dt); |
|
|
|
printk("%lld cycles\n", dc); |
|
|
|
printk("%lld instructions\n", di); |
|
|
|
printk("%d.%d%d CPI\n", (int)(dc/di), (int)(10ULL*dc/di % 10), |
|
|
|
(int)((100ULL*dc + di/2)/di % 10)); |
|
|
|
} |
|
|
|
shutdown(code); |
|
|
|
} |
|
|
|
@ -353,7 +354,7 @@ int sys_rt_sigaction(int sig, const void* act, void* oact, size_t sssz) |
|
|
|
|
|
|
|
long sys_time(long* loc) |
|
|
|
{ |
|
|
|
uintptr_t t = rdcycle() / CLOCK_FREQ; |
|
|
|
uint64_t t = rdcycle64() / CLOCK_FREQ; |
|
|
|
if (loc) |
|
|
|
*loc = t; |
|
|
|
return t; |
|
|
|
@ -361,7 +362,7 @@ long sys_time(long* loc) |
|
|
|
|
|
|
|
int sys_times(long* loc) |
|
|
|
{ |
|
|
|
uintptr_t t = rdcycle(); |
|
|
|
uint64_t t = rdcycle64(); |
|
|
|
kassert(CLOCK_FREQ % 1000000 == 0); |
|
|
|
loc[0] = t / (CLOCK_FREQ / 1000000); |
|
|
|
loc[1] = 0; |
|
|
|
@ -373,7 +374,7 @@ int sys_times(long* loc) |
|
|
|
|
|
|
|
int sys_gettimeofday(long* loc) |
|
|
|
{ |
|
|
|
uintptr_t t = rdcycle(); |
|
|
|
uint64_t t = rdcycle64(); |
|
|
|
loc[0] = t / CLOCK_FREQ; |
|
|
|
loc[1] = (t % CLOCK_FREQ) / (CLOCK_FREQ / 1000000); |
|
|
|
|
|
|
|
@ -382,7 +383,7 @@ int sys_gettimeofday(long* loc) |
|
|
|
|
|
|
|
long sys_clock_gettime(int clk_id, long *loc) |
|
|
|
{ |
|
|
|
uintptr_t t = rdcycle(); |
|
|
|
uint64_t t = rdcycle64(); |
|
|
|
loc[0] = t / CLOCK_FREQ; |
|
|
|
loc[1] = (t % CLOCK_FREQ) / (CLOCK_FREQ / 1000000000); |
|
|
|
|
|
|
|
|