int main(int argc, const char *argv[]) { std::cout << "user " + get_user() << std::endl; std::cout << "hostname " + get_hostname() << std::endl; std::cout << "time " + get_time() << std::endl; std::cout << "procs " + get_procs() << std::endl; std::cout << "cpu " + cpu_usage() << std::endl; std::cout << "mem " + (float)mem_usage() << std::endl; return 0; }
int main(void) { char *status; /*char *avgs;*/ char *tmcentral; char *cpu; char *battery; char *ifaddr; char *temp; int i = 0; if (!(dpy = XOpenDisplay(NULL))) { fprintf(stderr, "dwmstatus: cannot open display.\n"); return 1; } /* Clear old_stats for cpu usage*/ for(i = 0; i < 10; ++i) old_stats[i] = 0; for (;;sleep(1)) { /*avgs = loadavg();*/ cpu = cpu_usage(); tmcentral = mktimes("%Y-%m-%d %H:%M:%S", tzcentral); battery = getbattery(); ifaddr = getifaddr(); temp = gettemp(); status = smprintf("%s | %s BAT %s | CPU %s | %s", temp, ifaddr, battery, cpu, tmcentral); setstatus(status); /*free(avgs);*/ free(tmcentral); free(status); free(ifaddr); } XCloseDisplay(dpy); return 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 }