🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.unix.programming.kernel
Article #81

Re: ʱ�ӵװ봦��,���½��ʱ�������???

#81
From: ��������
Date: Wed, 13 Mar 2002 14:02
63 lines
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);
:  }
: }
: --
: 
: ����һ�ɳ徢�´�, �׿�����ʵû�й���.
: 
: 
: �� ��Դ:��BBS ˮľ�廪վ smth.org��[FROM: 202.119.71.142]
--
�� ��Դ:��UNIX��� apue.dhs.org��[FROM: 211.69.197.81] 
Technical Details
Message-ID: <3lJ8Ic$0Lh@apue.dhs.org>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!62.24.128.9.MISMATCH!news-1.opaltelecom.net!newsfeed.icl.net!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.cn99.com!news.tiaozhan.com!APUE

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10e809,755a5633b7949d53
X-Google-Attributes: gid10e809,public
X-Google-ArrivalTime: 2002-03-13 06:15:48 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!62.24.128.9.MISMATCH!news-1.opaltelecom.net!newsfeed.icl.net!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.cn99.com!news.tiaozhan.com!APUE
From: ysqcn.bbs@apue.dhs.org (��������)
Newsgroups: cn.bbs.comp.unix.programming.kernel
Subject: Re: ʱ�ӵװ봦��,���½��ʱ�������???
Date: 13 Mar 2002 14:02:02 GMT
Organization: APUE
Message-ID: <3lJ8Ic$0Lh@apue.dhs.org>
X-Filename: UKP/M.1016028038.A
Lines: 63