コード例 #1
0
ファイル: db_memory.c プロジェクト: gsmadhusudan/graphene
unsigned long _DkMemoryAvailableQuota (void)
{
    unsigned long quota = 0;
    if (read_proc_meminfo("MemFree", &quota) < 0)
        return 0;
    return quota * 1024;
}
コード例 #2
0
ファイル: sawmill_logger.c プロジェクト: perezerah/sleepd
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;
}
コード例 #3
0
ファイル: db_memory.c プロジェクト: gsmadhusudan/graphene
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", &quota) < 0) {
        linux_state.memory_quota = (unsigned long) -1;
        return 0;
    }

    return (linux_state.memory_quota = quota * 1024);
}