src/timer.c
/************************************************************************/
/*									*/
/*		    u p d a t e _ m i s c s t a t s			*/
/*									*/
/*	Updates counters and timers in the MISCSTATS "page".		*/
/*									*/
/*									*/
/*									*/
/************************************************************************/
u p d a t e _ m i s c s t a t s

Updates counters and timers in the MISCSTATS "page".
u p d a t e _ m i s c s t a t s Updates counters and timers in the MISCSTATS " page " .
void update_miscstats() {
#ifdef DOS
  struct dostime_t dtm; 
  _dos_gettime(&dtm);
  MiscStats->totaltime = (time(0) * 1000) + (10 * dtm.hsecond);
  MiscStats->swapwaittime = 0;
  MiscStats->pagefaults = 0;
  MiscStats->swapwrites = 0;
  MiscStats->diskiotime = 0; 
  MiscStats->diskops = 0;
  MiscStats->secondstmp = MiscStats->secondsclock = (time(0) + UNIX_ALTO_TIME_DIFF);
#else
  struct timeval timev;
  struct rusage ru;
  getrusage(RUSAGE_SELF, &ru);
  MiscStats->totaltime = ru.ru_utime.tv_sec * 1000 + ru.ru_utime.tv_usec / 1000;
  MiscStats->swapwaittime = ru.ru_stime.tv_sec * 1000 + ru.ru_stime.tv_usec / 1000;
  MiscStats->pagefaults = ru.ru_minflt + ru.ru_majflt;
  MiscStats->swapwrites = ru.ru_majflt;
  MiscStats->diskiotime = 0; 
  MiscStats->diskops = ru.ru_inblock
      ;
  gettimeofday(&timev, NULL);
  MiscStats->secondstmp = MiscStats->secondsclock = (timev.tv_sec + UNIX_ALTO_TIME_DIFF);
#endif 
}
void update_miscstats ( ) { #ifdef DOS struct dostime_t dtm ; _dos_gettime ( & dtm ) ; MiscStats -> totaltime = ( time ( 0 ) * 1000 ) + ( 10 * dtm . hsecond ) ; MiscStats -> swapwaittime = 0 ; MiscStats -> pagefaults = 0 ; MiscStats -> swapwrites = 0 ; MiscStats -> diskiotime = 0 ; MiscStats -> diskops = 0 ; MiscStats -> secondstmp = MiscStats -> secondsclock = ( time ( 0 ) + UNIX_ALTO_TIME_DIFF ) ; #else struct timeval timev ; struct rusage ru ; getrusage ( RUSAGE_SELF , & ru ) ; MiscStats -> totaltime = ru . ru_utime . tv_sec * 1000 + ru . ru_utime . tv_usec / 1000 ; MiscStats -> swapwaittime = ru . ru_stime . tv_sec * 1000 + ru . ru_stime . tv_usec / 1000 ; MiscStats -> pagefaults = ru . ru_minflt + ru . ru_majflt ; MiscStats -> swapwrites = ru . ru_majflt ; MiscStats -> diskiotime = 0 ; MiscStats -> diskops = ru . ru_inblock ; gettimeofday ( & timev , NULL ) ; MiscStats -> secondstmp = MiscStats -> secondsclock = ( timev . tv_sec + UNIX_ALTO_TIME_DIFF ) ; #endif }
u p d a t e _ m i s c s t a t s
u p d a t e _ m i s c s t a t s
/* holds DOS time, so we can get .01 secs */ /* ?? not available ?? */ /* ?? not available ?? */ /* ?? this doesn't work ???
     + ru.ru_outblock   */ /* DOS */