[BACK]Return to engine.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / systat

Diff for /src/usr.bin/systat/engine.c between version 1.28 and 1.29

version 1.28, 2021/06/02 08:32:22 version 1.29, 2021/07/02 15:34:16
Line 27 
Line 27 
 #include <string.h>  #include <string.h>
 #include <term.h>  #include <term.h>
 #include <unistd.h>  #include <unistd.h>
   #include <math.h>
 #include <err.h>  #include <err.h>
   
 /* XXX These are defined in term.h and conflict with our variable names */  /* XXX These are defined in term.h and conflict with our variable names */
Line 50 
Line 51 
         TAILQ_ENTRY(view_ent) entries;          TAILQ_ENTRY(view_ent) entries;
 };  };
   
 useconds_t udelay = 5000000;  static struct timespec ts_delay = { 5, 0 };
   static struct itimerval it_delay = { { 0, 0 }, { 5, 0 } };
   
 int dispstart = 0;  int dispstart = 0;
 int humanreadable = 0;  int humanreadable = 0;
 int interactive = 1;  int interactive = 1;
Line 1355 
Line 1358 
                         read_view();                          read_view();
                         need_sort = 1;                          need_sort = 1;
                         gotsig_alarm = 0;                          gotsig_alarm = 0;
                         ualarm(udelay, 0);                          setitimer(ITIMER_REAL, &it_delay, NULL);
                 }                  }
   
                 if (need_sort) {                  if (need_sort) {
Line 1366 
Line 1369 
                         /* XXX if sort took too long */                          /* XXX if sort took too long */
                         if (gotsig_alarm) {                          if (gotsig_alarm) {
                                 gotsig_alarm = 0;                                  gotsig_alarm = 0;
                                 ualarm(udelay, 0);                                  setitimer(ITIMER_REAL, &it_delay, NULL);
                         }                          }
                 }                  }
   
Line 1408 
Line 1411 
                 if (interactive && need_update == 0)                  if (interactive && need_update == 0)
                         keyboard();                          keyboard();
                 else if (interactive == 0)                  else if (interactive == 0)
                         usleep(udelay);                          nanosleep(&ts_delay, NULL);
         }          }
   
         if (rawmode == 0)          if (rawmode == 0)
Line 1456 
Line 1459 
                 return(1);                  return(1);
   
         return(0);          return(0);
   }
   
   void
   refresh_delay(double delay)
   {
           double secs, frac;
   
           frac = modf(delay, &secs);
           ts_delay.tv_sec = secs;
           ts_delay.tv_nsec = frac * 1000000000.0;
           if (!timespecisset(&ts_delay))
                   ts_delay.tv_nsec = 1000000000;
           TIMESPEC_TO_TIMEVAL(&it_delay.it_value, &ts_delay);
 }  }

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29