Thread View: cn.bbs.comp.unix.programming.kernel
1 messages
1 total messages
Started by ��������
Wed, 13 Mar 2002 14:02
Re: ʱ�ӵװ봦��,���½��ʱ�������???
Author: ��������
Date: Wed, 13 Mar 2002 14:02
Date: Wed, 13 Mar 2002 14:02
63 lines
3099 bytes
3099 bytes
/*
* 'kernel_stat.h' contains the definitions needed for doing
* some kernel statistics (CPU usage, context switches ...),
* used by rstatd/perfmeter
*/
#define DK_MAX_MAJOR 64
#define DK_MAX_DISK 16
struct kernel_stat {
unsigned int per_cpu_user[NR_CPUS],
per_cpu_nice[NR_CPUS],
per_cpu_system[NR_CPUS];
������������������
}
struct kernel_stat kstat;
ǰ���жϽ�̵ĵ�ǰ���е�ʱ��Ƭ��û�У����߿����ռ�õ���ʱ��Ƭ
�Ƿ�����Դ���ơ�
�� �� hushui110.bbs@smth.org (�������) �Ĵ������ᵽ: ��
: �� ��: ʱ�ӵװ봦��,���½��ʱ�������???
: ����վ: BBS ˮľ�廪վ (Wed Mar 13 21:18:38 2002)
: ת��վ: APUE!news.tiaozhan.com!thunews.dhs.org!SMTH
:
: update_process_times��
: if (p->counter < 0) {
: p->counter = 0;
: p->need_resched = 1;
: }
: if (p->priority < DEF_PRIORITY)
: kstat.cpu_nice += user;
: else
: kstat.cpu_user += user;
: kstat.cpu_system += system;
: ���� kstat�ṹ����ʲô�õ�
: �����������Ѿ��ж��Ƿ�ʱ���Ƭ�Ѿ�������Ҫ���µ��ȣ������Ժ��update_one_pro
: cess����
: ���õ�do_process_times��ʲô���� ,����Ҳ���ж���ʱ����SIGXCPU��ʱ�ź�
: static inline void do_process_times(struct task_struct *p,
: unsigned long user, unsigned long system)
: {
: long psecs;
: psecs = (p->times.tms_utime += user);
: psecs += (p->times.tms_stime += system);
: if (psecs / HZ > p->rlim[RLIMIT_CPU].rlim_cur) { //����ж������õ�??
: /* Send SIGXCPU every second.. */
: if (!(psecs % HZ))
: send_sig(SIGXCPU, p, 1);
: /* and SIGKILL when we go over max.. */
: if (psecs / HZ > p->rlim[RLIMIT_CPU].rlim_max)
: send_sig(SIGKILL, p, 1);
: }
: }
: --
:
: ����һ�ɳ徢�´�, ������ʵû�й���.
:
:
: [m[31m�� ��Դ:��BBS ˮľ�廪վ smth.org��[FROM: 202.119.71.142][m
--
[m[1;35m�� ��Դ:��UNIX��� apue.dhs.org��[FROM: 211.69.197.81][m
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads