Esempio n. 1
0
void update_stuff() {
  unsigned int i;

  info.mask = 0;

  if (no_buffers) need_mask |= 1 << INFO_BUFFERS;

  /* clear speeds and up status in case device was removed and doesn't get
   * updated */

  for (i=0; i<16; i++) {
    if (netstats[i].dev) {
      netstats[i].up = 0;
      netstats[i].recv_speed = 0.0;
      netstats[i].trans_speed = 0.0;
    }
  }

  prepare_update();

#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))

  if (NEED(INFO_UPTIME)) update_uptime();

  if (NEED(INFO_PROCS)) update_total_processes();

  if (NEED(INFO_RUN_PROCS)) update_running_processes();

  if (NEED(INFO_CPU)) update_cpu_usage();

  if (NEED(INFO_NET)) update_net_stats();

  if (NEED(INFO_MAIL)) update_mail_count();

#ifdef SETI
  if (NEED(INFO_SETI)) update_seti();
#endif

  if (NEED(INFO_LOADAVG)) update_load_average();

  if ((NEED(INFO_MEM) || NEED(INFO_BUFFERS)) &&
      current_update_time - last_meminfo_update > 6.9) {
    update_meminfo();
    if (no_buffers) info.mem -= info.bufmem;
    last_meminfo_update = current_update_time;
  }

  /* update_fs_stat() won't do anything if there aren't fs -things */
  if (NEED(INFO_FS) && current_update_time - last_fs_update > 12.9) {
    update_fs_stats();
    last_fs_update = current_update_time;
  }
}
Esempio n. 2
0
void update_status()
{
    #ifdef DEBUG
    char buffer[256];
    sprintf(buffer, "Update Status: draw Memory %s", sbar_status_symbols[DrawMemory].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    sprintf(buffer, "Update Status: draw Battery %s", sbar_status_symbols[DrawBattery].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    sprintf(buffer, "Update Status: draw Uptime %s", sbar_status_symbols[DrawUptime].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    sprintf(buffer, "Update Status: draw Termal %s", sbar_status_symbols[DrawTermal].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    #ifdef NF310_A01
    sprintf(buffer, "Update Status: draw Backlight %s", sbar_status_symbols[DrawBacklight].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    #endif
    sprintf(buffer, "Update Status: draw Net %s", sbar_status_symbols[DrawNet].active ? "yes" : "no");
    log_str(buffer, LOG_DEBUG);
    #endif
    
    if(sbar_status_symbols[DrawMemory].active) {
      get_memory();
      
      #ifdef DEBUG
      log_str("Sucessfully Updated Memory", LOG_DEBUG);
      #endif
    }
    
    if(sbar_status_symbols[DrawBattery].active) {
      check_battery();

      #ifdef DEBUG
      log_str("Sucessfully Updated Battery", LOG_DEBUG);
      #endif
    }

    cpu_usage();

    #ifdef DEBUG
    log_str("Sucessfully Updated CPU", LOG_DEBUG);
    #endif

    update_date();

    #ifdef DEBUG
    log_str("Sucessfully Updated Date", LOG_DEBUG);
    #endif

    if(sbar_status_symbols[DrawUptime].active) {
      update_uptime();

      #ifdef DEBUG
      log_str("Sucessfully Updated Uptime", LOG_DEBUG);
      #endif
    }

    if(sbar_status_symbols[DrawTermal].active) {
      get_thermal();

      #ifdef DEBUG
      log_str("Sucessfully Updated Termal", LOG_DEBUG);
      #endif
    }

    #ifdef NF310_A01
    if(sbar_status_symbols[DrawBacklight].active) {
      update_backlight();

      #ifdef DEBUG
      log_str("Sucessfully Updated Backlight", LOG_DEBUG);
      #endif
    }
    #endif

    if(sbar_status_symbols[DrawNet].active) {
      update_net();

      #ifdef DEBUG
      log_str("Sucessfully Updated Net", LOG_DEBUG);
      #endif
    }

    update_disk();

    #ifdef DEBUG
    log_str("Sucessfully Updated Disk", LOG_DEBUG);
    #endif

}