Пример #1
0
void run_text_mode()
{
	while (running)
	{
		//TODO: Insert some kind of text events.
		update_vm();
		if(debugMode) usleep(250000);
	}
}
Пример #2
0
bool top_globalstats_update(void *ptr, const void *sample) {
    const libtop_tsamp_t *tsamp = sample;
    struct globalstat_controller *c = ptr;
    int i;

	if (!top_prefs_get_logging_mode()) {
		for(i = 0; i < GLOBALSTAT_TOTAL; ++i) {
			// MWW: If we've disabled framework logging one of these windows isn't valid and needs skipping
			if (!top_prefs_get_frameworks() && (i == GLOBALSTAT_SHAREDLIBS)) continue;
			werase(c->stats[i].window);
		}
	}

    update_processes(c->stats + GLOBALSTAT_PROCESSES, tsamp);
    update_load(c->stats + GLOBALSTAT_LOAD, tsamp);
    update_cpu(c->stats + GLOBALSTAT_CPU, tsamp);

    if(top_prefs_get_frameworks())
	update_sharedlibs(c->stats + GLOBALSTAT_SHAREDLIBS, tsamp);

    update_memregions(c->stats + GLOBALSTAT_MEMREGIONS, tsamp);
    update_physmem(c->stats + GLOBALSTAT_PHYSMEM, tsamp);
    update_vm(c->stats + GLOBALSTAT_VM, tsamp);
    update_time(c->stats + GLOBALSTAT_TIME, tsamp);

    if(top_prefs_get_swap()) {
	update_swap(c->stats + GLOBALSTAT_SWAP, tsamp);
	update_purgeable(c->stats + GLOBALSTAT_PURGEABLE, tsamp);
    }

    if(update_networks(c->stats + GLOBALSTAT_NETWORKS, tsamp))
	top_log("An error occurred while updating the network global stats.\n");

    if(update_disks(c->stats + GLOBALSTAT_DISKS, tsamp))
	top_log("An erorr occurred while updating the disk global stats.\n");

    return false;
}