unsigned long _DkMemoryAvailableQuota (void) { unsigned long quota = 0; if (read_proc_meminfo("MemFree", "a) < 0) return 0; return quota * 1024; }
gboolean sawmill_logger_update(gpointer data) { if (sIsAwake) { double rc , c; get_battery_coulomb_reading(&rc, &c); sTimeOnPrint = time_now_ms(); long unsigned int diff_awake = sTimeOnPrint - sTimeOnWake; g_message("%s: raw_coulomb: %f coulomb: %f time_awake_ms: %lu time_asleep_ms: %lu time_screen_on_ms: %lu time_screen_off_ms: %lu", __func__, rc, c, sTotalMSAwake + diff_awake, sTotalMSAsleep, sTotalMSScreenOn + ( sScreenIsOn ? (time_now_ms() - sTimeScreenOn): 0), sTotalMSScreenOff + ( sScreenIsOn ? 0 : (time_now_ms() - sTimeScreenOff)) ); read_proc_loadavg(); read_proc_stat(); read_proc_diskstats(); read_proc_meminfo(); read_proc_net_dev(); } //TODO: use g_timer_source_set_interval(GTimerSource *tsource, guint interval_ms, gboolean from_poll) g_source_remove(sTimerEventSource); sTimerEventSource = g_timeout_add_full(G_PRIORITY_DEFAULT, PRINT_INTERVAL_MS, sawmill_logger_update, GINT_TO_POINTER(TRUE), NULL); return FALSE; }
unsigned long _DkMemoryQuota (void) { if (linux_state.memory_quota == (unsigned long) -1) return 0; if (linux_state.memory_quota) return linux_state.memory_quota; unsigned long quota = 0; if (read_proc_meminfo("MemTotal", "a) < 0) { linux_state.memory_quota = (unsigned long) -1; return 0; } return (linux_state.memory_quota = quota * 1024); }