🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.unix.programming.kernel
1 messages
1 total messages Started by falls Thu, 14 Mar 2002 05:43
Re: ��̣����ں˿ռ���λ�õ�ǰϵͳʱ�䣿
#100
Author: 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]
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