diff options
author | Jiri Gaisler <jiri@gaisler.se> | 2015-02-19 23:31:24 +0100 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-02-21 23:27:24 -0500 |
commit | 96d67095792f5c8c0c91522820de861e54c37728 (patch) | |
tree | 66279354644eb7be5545b3c2272db5e8ec3c2ee7 /sim/erc32/func.c | |
parent | bb6ead917c6aa8159281cac13b603e43035dcea3 (diff) | |
download | gdb-96d67095792f5c8c0c91522820de861e54c37728.zip gdb-96d67095792f5c8c0c91522820de861e54c37728.tar.gz gdb-96d67095792f5c8c0c91522820de861e54c37728.tar.bz2 |
sim/erc32: Fix incorrect simulator performance report
Diffstat (limited to 'sim/erc32/func.c')
-rw-r--r-- | sim/erc32/func.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/sim/erc32/func.c b/sim/erc32/func.c index 6526085..5123863 100644 --- a/sim/erc32/func.c +++ b/sim/erc32/func.c @@ -613,7 +613,7 @@ void reset_stat(sregs) struct pstate *sregs; { - sregs->tottime = 0; + sregs->tottime = 0.0; sregs->pwdtime = 0; sregs->ninst = 0; sregs->fholdt = 0; @@ -632,9 +632,10 @@ show_stat(sregs) struct pstate *sregs; { uint32 iinst; - uint32 stime, tottime; + uint32 stime; - if (sregs->tottime == 0) tottime = 1; else tottime = sregs->tottime; + if (sregs->tottime == 0.0) + sregs->tottime += 1E-6; stime = ebase.simtime - sregs->simstart; /* Total simulated time */ #ifdef STAT @@ -669,12 +670,15 @@ show_stat(sregs) sregs->freq * (float) (sregs->ninst - sregs->finst) / (float) (stime - sregs->pwdtime), sregs->freq * (float) sregs->finst / (float) (stime - sregs->pwdtime)); - printf(" Simulated ERC32 time : %5.2f ms\n", (float) (ebase.simtime - sregs->simstart) / 1000.0 / sregs->freq); - printf(" Processor utilisation : %5.2f %%\n", 100.0 * (1.0 - ((float) sregs->pwdtime / (float) stime))); - printf(" Real-time / simulator-time : 1/%.2f \n", - ((float) sregs->tottime) / ((float) (stime) / (sregs->freq * 1.0E6))); - printf(" Simulator performance : %d KIPS\n",sregs->ninst/tottime/1000); - printf(" Used time (sys + user) : %3d s\n\n", sregs->tottime); + printf(" Simulated ERC32 time : %.2f s\n", + (float) (ebase.simtime - sregs->simstart) / 1000000.0 / sregs->freq); + printf(" Processor utilisation : %.2f %%\n", + 100.0 * (1.0 - ((float) sregs->pwdtime / (float) stime))); + printf(" Real-time performance : %.2f %%\n", + 100.0 / (sregs->tottime / ((double) (stime) / (sregs->freq * 1.0E6)))); + printf(" Simulator performance : %.2f MIPS\n", + (double)(sregs->ninst) / sregs->tottime / 1E6); + printf(" Used time (sys + user) : %.2f s\n\n", sregs->tottime); } @@ -1128,3 +1132,14 @@ bfd_load(fname) return(bfd_get_start_address (pbfd)); } + +double get_time (void) +{ + double usec; + + struct timeval tm; + + gettimeofday (&tm, NULL); + usec = ((double) tm.tv_sec) * 1E6 + ((double) tm.tv_usec); + return (usec / 1E6); +} |