Example #1
0
void tick(int print) {
    time_t t;

    pthread_mutex_lock(&tick_mutex);
   
    t = time(NULL);
    if((t - last_timestamp >= RESOLUTION)&&(t - last_timestamp >= options.interval_seconds_time)) {
        analyse_data();
        if (options.no_curses) {
          if (!options.timed_output || options.timed_output && t - first_timestamp >= options.timed_output) {
            tui_print();
            if (options.timed_output) {
              finish(SIGINT);
            }
          }
        }
        else {
          ui_print();
        }
        history_rotate();
        last_timestamp = t;
    }
    else {
      if (options.no_curses) {
        tui_tick(print);
      }
      else {
        ui_tick(print);
      }
    }

    pthread_mutex_unlock(&tick_mutex);
}
Example #2
0
/*
 * Tick function indicating screen refresh
 */
void tui_tick(int print) {
  if (print) {
    tui_print();
  }
}