示例#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);
}
示例#2
0
void tick(int print) {
    time_t t;

    pthread_mutex_lock(&tick_mutex);
   
    t = time(NULL);
    if(t - last_timestamp >= RESOLUTION) {
        //printf("TICKING\n");
        analyse_data();
        ui_print();
        history_rotate();
        last_timestamp = t;
    }
    else {
      ui_tick(print);
    }

    pthread_mutex_unlock(&tick_mutex);
}