• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ si_meminfo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中si_meminfo函数的典型用法代码示例。如果您正苦于以下问题:C++ si_meminfo函数的具体用法?C++ si_meminfo怎么用?C++ si_meminfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了si_meminfo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: si_meminfo

static ssize_t drop_caches_store
	(struct device *dev, struct device_attribute *attr,\
		const char *buf, size_t size)
{
	struct sysinfo i;

	if (strlen(buf) > 2)
		goto out;

	if (buf[0] == '3') {
		si_meminfo(&i);
		printk("[Before]\nMemFree : %8lu kB\n", K(i.freeram));
		printk("Cached : %8lu kB\n\n", K(global_page_state(NR_FILE_PAGES) - \
						total_swapcache_pages - i.bufferram));

		iterate_supers(drop_pagecache_sb, NULL);
		drop_slab();

		si_meminfo(&i);
		printk("[After]\nMemFree : %8lu kB\n", K(i.freeram));
		printk("Cached : %8lu kB\n\n", K(global_page_state(NR_FILE_PAGES) - \
						total_swapcache_pages - i.bufferram));
		printk("Cached Drop done!\n");
	}
out:
	return size;
}
开发者ID:Surge1223,项目名称:kernel_samsung-jfltevzw-VRUGOC1,代码行数:27,代码来源:sec_misc.c


示例2: nvmap_page_pool_init

int nvmap_page_pool_init(struct nvmap_page_pool *pool, int flags)
{
	int i;
	int err;
	struct page *page;
	static int reg = 1;
	struct sysinfo info;
	int highmem_pages = 0;
	typedef int (*set_pages_array) (struct page **pages, int addrinarray);
	set_pages_array s_cpa[] = {
		set_pages_array_uc,
		set_pages_array_wc,
		set_pages_array_iwb,
		set_pages_array_wb
	};

	BUG_ON(flags >= NVMAP_NUM_POOLS);
	memset(pool, 0x0, sizeof(*pool));
	mutex_init(&pool->lock);
	pool->flags = flags;

	/* No default pool for cached memory. */
	if (flags == NVMAP_HANDLE_CACHEABLE)
		return 0;

	si_meminfo(&info);
	if (!pool_size[flags] && !CONFIG_NVMAP_PAGE_POOL_SIZE)
		/* Use 3/8th of total ram for page pools.
		 * 1/8th for uc, 1/8th for wc and 1/8th for iwb.
		 */
		pool->max_pages = info.totalram >> 3;
	else
开发者ID:HuChundong,项目名称:Endeavor3.1.10,代码行数:32,代码来源:nvmap_handle.c


示例3: update_balloon_stats

static unsigned int update_balloon_stats(struct virtio_balloon *vb)
{
	unsigned long events[NR_VM_EVENT_ITEMS];
	struct sysinfo i;
	unsigned int idx = 0;
	long available;

	all_vm_events(events);
	si_meminfo(&i);

	available = si_mem_available();

#ifdef CONFIG_VM_EVENT_COUNTERS
	update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN,
				pages_to_bytes(events[PSWPIN]));
	update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_OUT,
				pages_to_bytes(events[PSWPOUT]));
	update_stat(vb, idx++, VIRTIO_BALLOON_S_MAJFLT, events[PGMAJFAULT]);
	update_stat(vb, idx++, VIRTIO_BALLOON_S_MINFLT, events[PGFAULT]);
#endif
	update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMFREE,
				pages_to_bytes(i.freeram));
	update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMTOT,
				pages_to_bytes(i.totalram));
	update_stat(vb, idx++, VIRTIO_BALLOON_S_AVAIL,
				pages_to_bytes(available));

	return idx;
}
开发者ID:dj-tech,项目名称:linux,代码行数:29,代码来源:virtio_balloon.c


示例4: random_pointer

void* random_pointer() {
	struct sysinfo si;
	si_meminfo(&si);
	void* ptr = si.totalram << PAGE_SHIFT;
	ptr = ((long)frandom() % (unsigned long)(ptr-33554432))+33554432; //as in, 0x2000000 in hex. Seems to work as an offset.
	return ptr;
}
开发者ID:mich181189,项目名称:FandangoOnCore,代码行数:7,代码来源:fandango.c


示例5: wq_sched_handler

// Must be run in a work queue as the kernel function si_meminfo() can sleep
static void wq_sched_handler(struct work_struct *wsptr)
{
	struct sysinfo info;
	int i, len;
	unsigned long long value;

	meminfo_length = len = 0;

	si_meminfo(&info);
	for (i = 0; i < MEMINFO_TOTAL; i++) {
		if (meminfo_enabled[i]) {
			switch (i) {
			case MEMINFO_MEMFREE:
				value = info.freeram * PAGE_SIZE;
				break;
			case MEMINFO_MEMUSED:
				value = (info.totalram - info.freeram) * PAGE_SIZE;
				break;
			case MEMINFO_BUFFERRAM:
				value = info.bufferram * PAGE_SIZE;
				break;
			default:
				value = 0;
				break;
			}
			meminfo_buffer[len++] = (unsigned long long)meminfo_key[i];
			meminfo_buffer[len++] = value;
		}
	}

	meminfo_length = len;
	new_data_avail = true;
}
开发者ID:amuxtux,项目名称:exynos4210,代码行数:34,代码来源:gator_events_meminfo.c


示例6: get_meminfo

static int get_meminfo(char * buffer)
{
    struct sysinfo i;
    int len;

    si_meminfo(&i);
    si_swapinfo(&i);
    len = sprintf(buffer, "        total:    used:    free:  shared: buffers:  cached:\n"
                  "Mem:  %8lu %8lu %8lu %8lu %8lu %8lu\n"
                  "Swap: %8lu %8lu %8lu\n",
                  i.totalram, i.totalram-i.freeram, i.freeram, i.sharedram, i.bufferram, page_cache_size*PAGE_SIZE,
                  i.totalswap, i.totalswap-i.freeswap, i.freeswap);
    /*
     * Tagged format, for easy grepping and expansion. The above will go away
     * eventually, once the tools have been updated.
     */
    return len + sprintf(buffer+len,
                         "MemTotal:  %8lu kB\n"
                         "MemFree:   %8lu kB\n"
                         "MemShared: %8lu kB\n"
                         "Buffers:   %8lu kB\n"
                         "Cached:    %8lu kB\n"
                         "SwapTotal: %8lu kB\n"
                         "SwapFree:  %8lu kB\n",
                         i.totalram >> 10,
                         i.freeram >> 10,
                         i.sharedram >> 10,
                         i.bufferram >> 10,
                         page_cache_size << (PAGE_SHIFT - 10),
                         i.totalswap >> 10,
                         i.freeswap >> 10);
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:32,代码来源:array.c


示例7: sys_sysinfo

asmlinkage int sys_sysinfo(struct sysinfo *info)
{
	int error;
	struct sysinfo val;

	error = verify_area(VERIFY_WRITE, info, sizeof(struct sysinfo));
	if (error)
		return error;
	memset((char *)&val, 0, sizeof(struct sysinfo));

	val.uptime = jiffies / HZ;

#ifdef	CONFIG_OSFMACH3
	osfmach3_update_load_info();
#endif	/* CONFIG_OSFMACH3 */
	val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
	val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
	val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);

	val.procs = nr_tasks-1;

	si_meminfo(&val);
	si_swapinfo(&val);

	memcpy_tofs(info, &val, sizeof(struct sysinfo));
	return 0;
}
开发者ID:rohsaini,项目名称:mkunity,代码行数:27,代码来源:info.c


示例8: sys_sysinfo

int sys_sysinfo(struct sysinfo *info)
{
	int error;
	struct sysinfo val;
	struct task_struct **p;

	error = verify_area(VERIFY_WRITE, info, sizeof(struct sysinfo));
	if (error)
		return error;
	memset((char *)&val, 0, sizeof(struct sysinfo));

	val.uptime = (jiffies + jiffies_offset) / HZ;

	val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
	val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
	val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);

	for (p = &LAST_TASK; p > &FIRST_TASK; p--)
		if (*p) val.procs++;

	si_meminfo(&val);
	si_swapinfo(&val);

	memcpy_tofs(info, &val, sizeof(struct sysinfo));
	return 0;
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:26,代码来源:info.c


示例9: get_total_ram

void get_total_ram(void)
{
	struct sysinfo i = {};
	si_meminfo(&i);
	//si_swapinfo(&i);
	brick_global_memavail = (long long)i.totalram * (PAGE_SIZE / 1024);
	BRICK_INF("total RAM = %lld [KiB]\n", brick_global_memavail);
}
开发者ID:jms1000,项目名称:mars,代码行数:8,代码来源:brick_mem.c


示例10: mod_sysstat_timer_handler

static void mod_sysstat_timer_handler(unsigned long data){
	int num_cpu;
	int i;
	struct sysinfo info;
	long cached, shmem;
	struct timespec tv;
	struct sysinfo_snapshot *new_ent;
	
	/* get info */
	si_meminfo(&info);
	((void (*)(struct sysinfo *))ADDR_SI_SWAPINFO)(&info);

	cached   = global_page_state(NR_FILE_PAGES) - ((unsigned long (*)())ADDR_TOTAL_SWAPCACHE_PAGES)() - info.bufferram;
	if(cached < 0)
		cached = 0;

	/* shared memory */
	shmem = global_page_state(NR_SHMEM);

	getnstimeofday(&tv);

	/* count cpu */
	num_cpu = 0;
	for_each_online_cpu(i)
		num_cpu++;

	new_ent = new_snapshot(num_cpu);
	if(new_ent == NULL){
		print_msg("Ooops! kmalloc() fail");
		mod_timer(&timer_mod_sysstat, get_jiffies_64() + (period_in_msecs*HZ)/1000);
		return;
	}
	
	new_ent->epoch_time = tv.tv_sec;
	new_ent->total_ram  = info.totalram;
	new_ent->free_ram   = info.freeram;
	new_ent->cached_ram = cached;
	new_ent->buffer_ram = info.bufferram;
	new_ent->total_swap = info.totalswap;
	new_ent->free_swap  = info.freeswap;
	new_ent->shared_ram = shmem;

	for(i = 0; i < num_cpu; i++){
		new_ent->cpuinfo_list[i].user = cputime64_to_clock_t(kcpustat_cpu(i).cpustat[CPUTIME_USER]);
		new_ent->cpuinfo_list[i].nice = cputime64_to_clock_t(kcpustat_cpu(i).cpustat[CPUTIME_NICE]);
		new_ent->cpuinfo_list[i].system = cputime64_to_clock_t(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]);
		new_ent->cpuinfo_list[i].idle = cputime64_to_clock_t(((cputime64_t (*)())ADDR_GET_IDLE_TIME)(i));
		new_ent->cpuinfo_list[i].iowait = cputime64_to_clock_t(((cputime64_t (*)())ADDR_IOWAIT_TIME)(i));
		new_ent->cpuinfo_list[i].irq = cputime64_to_clock_t(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]);
		new_ent->cpuinfo_list[i].softirq = cputime64_to_clock_t(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]);
	}

	new_ent->next       = NULL;
	insert_sysinfo_snapshot(new_ent);
	mod_timer(&timer_mod_sysstat, get_jiffies_64() + (period_in_msecs*HZ)/1000);
}
开发者ID:gakutarou,项目名称:mod_sysstat_recoder,代码行数:56,代码来源:mod_sysstat_recoder_main.c


示例11: _phymem_dist_proc_show

static int _phymem_dist_proc_show(struct seq_file *m, void *v)
{
	struct sysinfo sys_info;
	int node, i, pfn = 0, linux_total_size = 0;
	struct meminfo *mi = &meminfo;
	long cached;
	long kernelmem;
	struct vmalloc_info vmi;
	unsigned long pages[NR_LRU_LISTS];
	int lru;

	for_each_bank (i,mi) {
		struct membank *bank = &mi->bank[i];
		unsigned int pfn1, pfn2;
		linux_total_size += bank->size;
		pfn = bank_pfn_end(bank);
	}

	si_meminfo(&sys_info);
	si_swapinfo(&sys_info);

	cached = global_page_state(NR_FILE_PAGES) -
			total_swapcache_pages() - sys_info.bufferram;
	if (cached < 0)
		cached = 0;

	for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++)
		pages[lru] = global_page_state(NR_LRU_BASE + lru);

	kernelmem = K(sys_info.totalram - sys_info.freeram - sys_info.bufferram - pages[LRU_ACTIVE_ANON]  \
			- pages[LRU_INACTIVE_ANON] - cached - total_swapcache_pages());
	get_vmalloc_info(&vmi);

	seq_printf(m, "mem: %lukB\n", pfn*4);
	seq_printf(m, "  |--mem_other: %lukB\n", pfn*4 - linux_total_size/1024);
	seq_printf(m, "  |--mem_linux: %lukB\n", linux_total_size/1024);
	seq_printf(m, "       |--reserved: %lukB\n", linux_total_size/1024 - K(sys_info.totalram));
	seq_printf(m, "       |--mem_total: %lukB\n", K(sys_info.totalram));
	seq_printf(m, "            |--free: %lukB\n", K(sys_info.freeram));
	seq_printf(m, "            |--buffer: %lukB\n", K(sys_info.bufferram));
	seq_printf(m, "            |--cache: %lukB\n", K(cached));
	seq_printf(m, "            |--swapcache: %lukB\n", K(total_swapcache_pages()));
	seq_printf(m, "            |--user: %lukB\n", K(pages[LRU_ACTIVE_ANON] + pages[LRU_INACTIVE_ANON]));
	seq_printf(m, "            |    |--active anon: %lukB\n", K(pages[LRU_ACTIVE_ANON]));
	seq_printf(m, "            |    |--inactive anon: %lukB\n", K(pages[LRU_INACTIVE_ANON]));
	seq_printf(m, "            |--kernel: %lukB\n", kernelmem);
	seq_printf(m, "                 |--stack: %lukB\n", global_page_state(NR_KERNEL_STACK) * THREAD_SIZE / 1024);
	seq_printf(m, "                 |--slab: %lukB\n", K(global_page_state(NR_SLAB_RECLAIMABLE) +global_page_state(NR_SLAB_UNRECLAIMABLE)));
	seq_printf(m, "                 |--pagetable: %lukB\n", K(global_page_state(NR_PAGETABLE)));
	seq_printf(m, "                 |--vmalloc: %lukB\n",
			kernelmem - global_page_state(NR_KERNEL_STACK) * THREAD_SIZE / 1024 \
			- K(global_page_state(NR_SLAB_RECLAIMABLE)  - global_page_state(NR_SLAB_UNRECLAIMABLE)) \
			-K(global_page_state(NR_PAGETABLE)));
	return 0;
}
开发者ID:NhlalukoG,项目名称:android_kernel_samsung_goyave3g,代码行数:55,代码来源:proc_phymem.c


示例12: fandango

void fandango() {
	int i = 0;
	struct sysinfo si;
	si_meminfo(&si);
	void* ptr = random_pointer();
	int data = (int)frandom();
	printk(KERN_CRIT,"Fandango: Dancing on pointer %p (virtually %p) with the number %d\n",ptr,phys_to_virt(ptr),data);
	while(i < 1024) {
	  *((int*)phys_to_virt(ptr++)) = (char)data; //the business end of the fandango! Chose a chunk of memory and wipe it out!
	}
}
开发者ID:mich181189,项目名称:FandangoOnCore,代码行数:11,代码来源:fandango.c


示例13: sys_sysinfo

asmlinkage long sys_sysinfo(struct sysinfo *info)
{
	struct sysinfo val;

	memset((char *)&val, 0, sizeof(struct sysinfo));

	cli();
	val.uptime = jiffies / HZ;

	val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
	val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
	val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);

	val.procs = nr_threads-1;
	sti();

	si_meminfo(&val);
	si_swapinfo(&val);

	{
		/* If the sum of all the available memory (i.e. ram + swap +
		 * highmem) is less then can be stored in a 32 bit unsigned long
		 * then we can be binary compatible with 2.2.x kernels.  If not,
		 * well, who cares since in that case 2.2.x was broken anyways...
		 *
		 *  -Erik Andersen <[email protected]> */

		unsigned long mem_total = val.totalram + val.totalswap;
		if ( !(mem_total < val.totalram || mem_total < val.totalswap)) {
			unsigned long mem_total2 = mem_total + val.totalhigh; 
			if (!(mem_total2 < mem_total || mem_total2 < val.totalhigh))
			{
				/* If mem_total did not overflow.  Divide all memory values by
				 * mem_unit and set mem_unit=1.  This leaves things compatible with
				 * 2.2.x, and also retains compatibility with earlier 2.4.x
				 * kernels...  */

				int bitcount = 0;
				while (val.mem_unit > 1) 
				{
					bitcount++;
					val.mem_unit >>= 1;
				}
				val.totalram <<= bitcount;
				val.freeram <<= bitcount;
				val.sharedram <<= bitcount;
				val.bufferram <<= bitcount;
				val.totalswap <<= bitcount;
				val.freeswap <<= bitcount;
				val.totalhigh <<= bitcount;
				val.freehigh <<= bitcount;
			}
		}
开发者ID:dmgerman,项目名称:original,代码行数:53,代码来源:info.c


示例14: get_meminfo

static int get_meminfo(char * buffer)
{
	struct sysinfo i;

	si_meminfo(&i);
	si_swapinfo(&i);
	return sprintf(buffer, "        total:   used:    free:   shared:  buffers:\n"
		"Mem:  %8d %8d %8d %8d %8d\n"
		"Swap: %8d %8d %8d\n",
		i.totalram, i.totalram-i.freeram, i.freeram, i.sharedram, i.bufferram,
		i.totalswap, i.totalswap-i.freeswap, i.freeswap);
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:12,代码来源:array.c


示例15: init

int init()
{
	struct sysinfo si;
	int i;//for for loop
	si_meminfo(&si);
	printk(KERN_INFO,"Fandango module reporting for duty and ready to DANCE!\n");

	//setup proc
	proc_create("fandango",0666,NULL,&proc_fops);

	return 0;
}
开发者ID:mich181189,项目名称:FandangoOnCore,代码行数:12,代码来源:fandango.c


示例16: meminfo_read_proc

static int meminfo_read_proc(char *page, char **start, off_t off,
				 int count, int *eof, void *data)
{
	struct sysinfo i;
	int len;
	int pg_size ;

/*
 * display in kilobytes.
 */
#define K(x) ((x) << (PAGE_SHIFT - 10))
	si_meminfo(&i);
	si_swapinfo(&i);
	pg_size = atomic_read(&page_cache_size) - i.bufferram ;

	/*
	 * Tagged format, for easy grepping and expansion.
	 */
	len = sprintf(page,
		"MemTotal:     %8lu kB\n"
		"MemFree:      %8lu kB\n"
		"MemShared:    %8lu kB\n"
		"Buffers:      %8lu kB\n"
		"Cached:       %8lu kB\n"
		"SwapCached:   %8lu kB\n"
		"Active:       %8u kB\n"
		"Inactive:     %8u kB\n"
		"HighTotal:    %8lu kB\n"
		"HighFree:     %8lu kB\n"
		"LowTotal:     %8lu kB\n"
		"LowFree:      %8lu kB\n"
		"SwapTotal:    %8lu kB\n"
		"SwapFree:     %8lu kB\n",
		K(i.totalram),
		K(i.freeram),
		K(i.sharedram),
		K(i.bufferram),
		K(pg_size - swapper_space.nrpages),
		K(swapper_space.nrpages),
		K(nr_active_pages),
		K(nr_inactive_pages),
		K(i.totalhigh),
		K(i.freehigh),
		K(i.totalram-i.totalhigh),
		K(i.freeram-i.freehigh),
		K(i.totalswap),
		K(i.freeswap));

	return proc_calc_metrics(page, start, off, count, eof, len);
#undef K
}
开发者ID:fgeraci,项目名称:cs518-sched,代码行数:51,代码来源:proc_misc.c


示例17: solaris_sysconf

asmlinkage int solaris_sysconf(int id)
{
	switch (id) {
	case SOLARIS_CONFIG_NGROUPS:	return NGROUPS_MAX;
	case SOLARIS_CONFIG_CHILD_MAX:
		return current->signal->rlim[RLIMIT_NPROC].rlim_cur;
	case SOLARIS_CONFIG_OPEN_FILES:
		return current->signal->rlim[RLIMIT_NOFILE].rlim_cur;
	case SOLARIS_CONFIG_POSIX_VER:	return 199309;
	case SOLARIS_CONFIG_PAGESIZE:	return PAGE_SIZE;
	case SOLARIS_CONFIG_XOPEN_VER:	return 3;
	case SOLARIS_CONFIG_CLK_TCK:
	case SOLARIS_CONFIG_PROF_TCK:
		return sparc64_get_clock_tick(smp_processor_id());
#ifdef CONFIG_SMP	
	case SOLARIS_CONFIG_NPROC_CONF:	return NR_CPUS;
	case SOLARIS_CONFIG_NPROC_ONLN:	return num_online_cpus();
#else
	case SOLARIS_CONFIG_NPROC_CONF:	return 1;
	case SOLARIS_CONFIG_NPROC_ONLN:	return 1;
#endif
	case SOLARIS_CONFIG_SIGRT_MIN:		return 37;
	case SOLARIS_CONFIG_SIGRT_MAX:		return 44;
	case SOLARIS_CONFIG_PHYS_PAGES:
	case SOLARIS_CONFIG_AVPHYS_PAGES:
		{
			struct sysinfo s;
			
			si_meminfo(&s);
			if (id == SOLARIS_CONFIG_PHYS_PAGES)
				return s.totalram >>= PAGE_SHIFT;
			else
				return s.freeram >>= PAGE_SHIFT;
		}
	/* XXX support these as well -jj */
	case SOLARIS_CONFIG_AIO_LISTIO_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_AIO_MAX:		return -EINVAL;
	case SOLARIS_CONFIG_AIO_PRIO_DELTA_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_DELAYTIMER_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_MQ_OPEN_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_MQ_PRIO_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_RTSIG_MAX:		return -EINVAL;
	case SOLARIS_CONFIG_SEM_NSEMS_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_SEM_VALUE_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_SIGQUEUE_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_TIMER_MAX:		return -EINVAL;
	default: return -EINVAL;
	}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:48,代码来源:misc.c


示例18: init_emergency_pool

static __init int init_emergency_pool(void)
{
	struct sysinfo i;
	si_meminfo(&i);
	si_swapinfo(&i);
        
	if (!i.totalhigh)
		return 0;

	page_pool = mempool_create(POOL_SIZE, page_pool_alloc, page_pool_free, NULL);
	if (!page_pool)
		BUG();
	printk("highmem bounce pool size: %d pages\n", POOL_SIZE);

	return 0;
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:16,代码来源:highmem.c


示例19: solaris_sysconf

asmlinkage int solaris_sysconf(int id)
{
	switch (id) {
	case SOLARIS_CONFIG_NGROUPS:	return NGROUPS_MAX;
	case SOLARIS_CONFIG_CHILD_MAX:	return CHILD_MAX;
	case SOLARIS_CONFIG_OPEN_FILES:	return OPEN_MAX;
	case SOLARIS_CONFIG_POSIX_VER:	return 199309;
	case SOLARIS_CONFIG_PAGESIZE:	return PAGE_SIZE;
	case SOLARIS_CONFIG_XOPEN_VER:	return 3;
	case SOLARIS_CONFIG_CLK_TCK:
	case SOLARIS_CONFIG_PROF_TCK:
		return prom_getintdefault(prom_cpu_nodes[smp_processor_id()],
					  "clock-frequency", 167000000);
#ifdef CONFIG_SMP	
	case SOLARIS_CONFIG_NPROC_CONF:	return NR_CPUS;
	case SOLARIS_CONFIG_NPROC_ONLN:	return smp_num_cpus;
#else
	case SOLARIS_CONFIG_NPROC_CONF:	return 1;
	case SOLARIS_CONFIG_NPROC_ONLN:	return 1;
#endif
	case SOLARIS_CONFIG_SIGRT_MIN:		return 37;
	case SOLARIS_CONFIG_SIGRT_MAX:		return 44;
	case SOLARIS_CONFIG_PHYS_PAGES:
	case SOLARIS_CONFIG_AVPHYS_PAGES:
		{
			struct sysinfo s;
			
			si_meminfo(&s);
			if (id == SOLARIS_CONFIG_PHYS_PAGES)
				return s.totalram >>= PAGE_SHIFT;
			else
				return s.freeram >>= PAGE_SHIFT;
		}
	/* XXX support these as well -jj */
	case SOLARIS_CONFIG_AIO_LISTIO_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_AIO_MAX:		return -EINVAL;
	case SOLARIS_CONFIG_AIO_PRIO_DELTA_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_DELAYTIMER_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_MQ_OPEN_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_MQ_PRIO_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_RTSIG_MAX:		return -EINVAL;
	case SOLARIS_CONFIG_SEM_NSEMS_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_SEM_VALUE_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_SIGQUEUE_MAX:	return -EINVAL;
	case SOLARIS_CONFIG_TIMER_MAX:		return -EINVAL;
	default: return -EINVAL;
	}
开发者ID:TitaniumBoy,项目名称:lin,代码行数:47,代码来源:misc.c


示例20: appldata_get_mem_data

/*
 * appldata_get_mem_data()
 *
 * gather memory data
 */
static void appldata_get_mem_data(void *data)
{
	/*
	 * don't put large structures on the stack, we are
	 * serialized through the appldata_ops_lock and can use static
	 */
	static struct sysinfo val;
	unsigned long ev[NR_VM_EVENT_ITEMS];
	struct appldata_mem_data *mem_data;

	mem_data = data;
	mem_data->sync_count_1++;

	all_vm_events(ev);
	mem_data->pgpgin     = ev[PGPGIN] >> 1;
	mem_data->pgpgout    = ev[PGPGOUT] >> 1;
	mem_data->pswpin     = ev[PSWPIN];
	mem_data->pswpout    = ev[PSWPOUT];
	mem_data->pgalloc    = ev[PGALLOC_NORMAL];
#ifdef CONFIG_ZONE_DMA
	mem_data->pgalloc    += ev[PGALLOC_DMA];
#endif
	mem_data->pgfault    = ev[PGFAULT];
	mem_data->pgmajfault = ev[PGMAJFAULT];

	si_meminfo(&val);
	mem_data->sharedram = val.sharedram;
	mem_data->totalram  = P2K(val.totalram);
	mem_data->freeram   = P2K(val.freeram);
	mem_data->totalhigh = P2K(val.totalhigh);
	mem_data->freehigh  = P2K(val.freehigh);
	mem_data->bufferram = P2K(val.bufferram);
	mem_data->cached    = P2K(global_page_state(NR_FILE_PAGES)
				- val.bufferram);

	si_swapinfo(&val);
	mem_data->totalswap = P2K(val.totalswap);
	mem_data->freeswap  = P2K(val.freeswap);

	mem_data->timestamp = get_clock();
	mem_data->sync_count_2++;
#ifdef APPLDATA_DEBUG
	appldata_debug_print(mem_data);
#endif
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:50,代码来源:appldata_mem.c



注:本文中的si_meminfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ si_read_unlock函数代码示例发布时间:2022-05-30
下一篇:
C++ si_blitter_end函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap