Exemple #1
0
/*
 * Return a multiplier for the exit latency that is intended
 * to take performance requirements into account.
 * The more performance critical we estimate the system
 * to be, the higher this multiplier, and thus the higher
 * the barrier to go to an expensive C state.
 */
static inline int performance_multiplier(unsigned long nr_iowaiters, unsigned long load)
{
	int mult = 1;

	/* for higher loadavg, we are more reluctant */

	mult += 2 * get_loadavg(load);

	/* for IO wait tasks (per cpu!) we add 5x each */
	mult += 10 * nr_iowaiters;

	return mult;
}
Exemple #2
0
void
get_computer_status (struct computer_status *cstatus, int64_t semid) {
  /* Get status not only gets the load average but also */
  /* checks that every task is running and in case they're not */
  /* it sets the task record to unused (used = 0) */
#ifdef __CYGWIN
  if (cstatus->ntasks > 0)
    cstatus->loadavg[0] = 1;
  else
    cstatus->loadavg[0] = 0;
#else

  get_loadavg (cstatus->loadavg);
#endif

  check_tasks (cstatus,semid);
}
static void
set_system_information(Enna_Buffer *b)
{
    if (!b)
        return;

    enna_buffer_append(b, "<c>");
    enna_buffer_append(b, _("System information"));
    enna_buffer_append(b, "</c><br><br>");
    get_distribution(b);
    get_uname(b);
    get_cpuinfos(b);
    get_loadavg(b);
    get_ram_usage(b);
#ifdef BUILD_LIBSVDRP
    get_vdr(b);
#endif /* BUILD_LIBSVDRP */
#ifdef BUILD_LIBXRANDR
    get_resolution(b);
#endif /* BUILD_LIBXRANDR */
    get_network(b);
    get_default_gw(b);
}
Exemple #4
0
static int get_root_array(char * page, int type, char **start, off_t offset, int length)
{
    switch (type) {
    case PROC_LOADAVG:
        return get_loadavg(page);

    case PROC_UPTIME:
        return get_uptime(page);

    case PROC_MEMINFO:
        return get_meminfo(page);

#ifdef CONFIG_PCI
    case PROC_PCI:
        return get_pci_list(page);
#endif

    case PROC_CPUINFO:
        return get_cpuinfo(page);

    case PROC_VERSION:
        return get_version(page);

#ifdef CONFIG_DEBUG_MALLOC
    case PROC_MALLOC:
        return get_malloc(page);
#endif

#ifdef CONFIG_MODULES
    case PROC_MODULES:
        return get_module_list(page);

    case PROC_KSYMS:
        return get_ksyms_list(page, start, offset, length);
#endif

    case PROC_STAT:
        return get_kstat(page);

    case PROC_DEVICES:
        return get_device_list(page);

    case PROC_INTERRUPTS:
        return get_irq_list(page);

    case PROC_FILESYSTEMS:
        return get_filesystem_list(page);

    case PROC_DMA:
        return get_dma_list(page);

    case PROC_IOPORTS:
        return get_ioport_list(page);
#ifdef CONFIG_BLK_DEV_MD
    case PROC_MD:
        return get_md_status(page);
#endif
#ifdef __SMP_PROF__
    case PROC_SMP_PROF:
        return get_smp_prof_list(page);
#endif
    case PROC_CMDLINE:
        return get_cmdline(page);

    case PROC_MTAB:
        return get_filesystem_info( page );
#ifdef CONFIG_RTC
    case PROC_RTC:
        return get_rtc_status(page);
#endif
    case PROC_LOCKS:
        return get_locks_status(page);
    }
    return -EBADF;
}
Exemple #5
0
static int array_read(struct inode * inode, struct file * file,char * buf, int count)
{
	char * page;
	int length;
	int end;
	unsigned int type, pid;

	if (count < 0)
		return -EINVAL;
	if (!(page = (char*) __get_free_page(GFP_KERNEL)))
		return -ENOMEM;
	type = inode->i_ino;
	pid = type >> 16;
	type &= 0x0000ffff;
	switch (type) {
		case 2:
			length = get_loadavg(page);
			break;
		case 3:
			length = get_uptime(page);
			break;
		case 4:
			length = get_meminfo(page);
			break;
		case 6:
			length = get_version(page);
			break;
		case 9:
			length = get_env(pid, page);
			break;
		case 10:
			length = get_arg(pid, page);
			break;
		case 11:
			length = get_stat(pid, page);
			break;
		case 12:
			length = get_statm(pid, page);
			break;
#ifdef CONFIG_DEBUG_MALLOC
		case 13:
			length = get_malloc(page);
			break;
#endif
		case 14:
			free_page((unsigned long) page);
			return read_core(inode, file, buf, count);
		case 15:
			length = get_maps(pid, page);
			break;
		case 16:
			length = get_module_list(page);
			break;
		case 17:
			length = get_kstat(page);
			break;
		default:
			free_page((unsigned long) page);
			return -EBADF;
	}
	if (file->f_pos >= length) {
		free_page((unsigned long) page);
		return 0;
	}
	if (count + file->f_pos > length)
		count = length - file->f_pos;
	end = count + file->f_pos;
	memcpy_tofs(buf, page + file->f_pos, count);
	free_page((unsigned long) page);
	file->f_pos = end;
	return count;
}