🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ��̣����ں˿ռ���λ�õ�ǰϵͳʱ�䣿

#100
From: falls
Date: Thu, 14 Mar 2002 05:43
47 lines
2471 bytes
�� �� suzhe (������) �Ĵ������ᵽ: ��
: �����ܰ�, �ϴ�!
: 1 ns ��Ӧ�Ŀ��� 1 G ��Ƶ��ѽ! �ĸ� CPU �ܱ߸ɻ��ˢ������� ns ���ļ�ʱ��ѽ?
: ������Ӳ����ʱ��, ������õ� Matrox ͼ��ɼ����Ͼ���Ӳ����ʱ��. ��Ҳ��
: 100 ns ���ľ���.

������˵�IJ������

�ҵ���˼�ǣ��ҿ�30����̣�ѭ��suspend<->resume��30*1000*2�Σ�һ������ʱ��t1

�ɴ��ҵó������л�ʱ��Ϊ: t2=t1/60000

���ҵ�����RTAI LINUX������466�����ʱ��t2��900ns ����

���ֲ��㷽������

#define LOOPS 1000
#define NR_TASKS 30
static RT_TASK thread[NR_TASKS];

ÿ��task����ں���Ϊ��
static void rt_task(int i) {
        while (1)
                rt_task_suspend(thread+t);
}

����ʱ��ĺ������£�
//CPU_FREQΪCPU����Ƶ�����ҵ�C466�����ֵ���Ϊ: 466,000,000
        hard_cli();
        t = rdtsc();
        for (i = 0; i < LOOPS; i++) {
                for (k = 0; k < NR_TASKS; k++) {
                        rt_task_resume(thread + k);
                }
        }
        t = rdtsc() - t;
        hard_sti();
        printk("\n\nFOR %d TASKS: ", NR_TASKS);
        printk("TIME %d (ms), SUSP/RES SWITCHES %d, ", \
                (int)llimd(t, 1000, CPU_FREQ), 2*NR_TASKS*LOOPS);
        printk("SWITCH TIME (INCLUDING FULL FP SUPPORT) %d (ns)\n", \
                (int)llimd(llimd(t, 1000000000, CPU_FREQ),1,2*30*LOOPS));

--

�� ��Դ:��BBS ˮľ�廪վ smth.org��[FROM: 61.190.81.4]
Technical Details
Message-ID: <3lJWVL$sCb@smth.org>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!news.cn99.com!thunews.dhs.org!SMTH

Show Full Headers
Complete Article Headers
X-Google-Language: Chinese,GB
X-Google-Thread: 10e809,ca0bf84899c75368
X-Google-Attributes: gid10e809,public
X-Google-ArrivalTime: 2002-03-13 21:48:07 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!news.cn99.com!thunews.dhs.org!SMTH
From: falls.bbs@smth.org (falls)
Newsgroups: cn.bbs.comp.unix.programming.kernel
Subject: Re: ��̣����ں˿ռ���λ�õ�ǰϵͳʱ�䣿
Date: 14 Mar 2002 05:43:52 GMT
Organization: BBS ˮľ�廪վ
Message-ID: <3lJWVL$sCb@smth.org>
X-Filename: KernelTech/M.1016083941.v0
Lines: 47