亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? micro.c

?? 內(nèi)核中關(guān)于nano計(jì)時(shí)的功能
?? C
字號:
/*********************************************************************** *								       * * Copyright (c) David L. Mills 2001				       * *								       * * Permission to use, copy, modify, and distribute this software and   * * its documentation for any purpose and without fee is hereby	       * * granted, provided that the above copyright notice appears in all    * * copies and that both the copyright notice and this permission       * * notice appear in supporting documentation, and that the name	       * * University of Delaware not be used in advertising or publicity      * * pertaining to distribution of the software without specific,	       * * written prior permission. The University of Delaware makes no       * * representations about the suitability this software for any	       * * purpose. It is provided "as is" without express or implied	       * * warranty.							       * *								       * **********************************************************************/#include "kern.h"/* * Nanosecond time routines * * The following routines implement both a nanosecond and microsecond * system clock. They are intended as drop-in replacements for kernel * clock routines running on 64-bit architectures where a processor * cycle counter (PCC) is available. The implementation provides a true * nanosecond clock for single and multiple processor systems. * * When the kernel time is reckoned directly in nanoseconds (NTP_NANO * defined), the time at each tick interrupt is derived directly from * the kernel time variable. When the kernel time is reckoned in * microseconds, (NTP_NANO undefined), the time is derived from the * kernel time variable together with a variable representing the * leftover nanoseconds at the last tick interrupt. In either case, the * current nanosecond time is reckoned from these values plus an * interpolated value derived by the clock routines in another * architecture-specific module. The interpolation can use either a * dedicated counter or a processor cycle counter (PCC) implemented in * some architectures. * * The current nanosecond time is reckoned from the above values at the * most recent tick interrupt, plus for each individual processor its * PCC scaled by the number of nanoseconds per PCC cycle. The scale * factor is determined by counting the number of PCC cycles that occur * during one second for each processor. This requires an interprocessor * interrupt at intervals of about one second for each processor, in * order to establish the base values. * * The design requires no designated master processor and is robust * against individual fail-stop processor faults. The design allows * system clock frequency and tick interval to be changed while the * system is running. It also provides for the unlikely case where the * individual processor clock rates may be different.  * * Note that all routines must run at priority splclock or higher. *//* * Multiprocessor definitions * * The TIME_READ() macro returns the current system time in a timespec * structure as an atomic action. The NCPUS define specifies the number * of processors in the system. The cpu_number() routine returns the * processor number executing the request. The rpcc() routine returns * the current PCC contents, where PCC_WIDTH is the number of signficant * bits. */#define TIME_READ(t)	((t) = TIMEVAR) /* read microsecond clock */#define PCC_WIDTH 	32	/* significant bits of PCC counter *//* * The following arrays are used to discipline the time in each * processor of a multiprocessor system to a nominal timescale based on * the tick inteval. */struct timespec pcc_time[NCPUS]; /* time at last microset() call */int64_t pcc_pcc[NCPUS];	/* PCC at last microset() */int64_t pcc_numer[NCPUS];	/* change in time last interval */int64_t pcc_denom[NCPUS];	/* change in PCC last interval */long pcc_master[NCPUS];		/* master PCC at last microset() (ns) */int microset_flag[NCPUS];	/* microset() initialization flag */long master_pcc;		/* master PCC at interrupt (ns) *//* * nano_time_rpcc() - read the system clock and PCC * * This routine reads the system clock and process cycle counter (PCC) * as an atomic operation. Note that in some architectures the PCC width * is less than the machine word, but in no case less than PCC_WIDTH * bits, and the high order bits may be junk. */int64_tnano_time_rpcc(tsp)	struct timespec *tsp;	/* nanosecond clock */{#ifdef NTP_NANO	struct timespec t;	/* nanosecond clock */#else	struct timeval t;	/* microsecond clock */#endif /* NTP_NANO */	int64_t pcc;		/* process cycle counter */	TIME_READ(t);		/* must be atomic */	pcc = rpcc();#ifdef NTP_NANO	tsp->tv_sec = t.tv_sec;	tsp->tv_nsec = t.tv_nsec;#else	tsp->tv_sec = t.tv_sec;	tsp->tv_nsec = t.tv_usec * 1000 + time_nano;#endif /* NTP_NANO */	return (pcc & ((1LL << PCC_WIDTH) - 1));}/* * nano_time() - return the current nanosecond time * * The system microsecond and nanosecond clocks are updated at each tick * interrupt. When the kernel time variable counts in microseconds, the * nanosecond clock is assembled from the microsecond clock (timeval * time) and the leftover nanoseconds at the last tick interrupt * (nano_time). When it counts in nanoseconds (timespec time), the value * is used directly. In either case, the actual time is interpolated * between microset() calls using the PCC in each processor. * * Since the PCC's may not be syntonic with each other and the tick * interrupt clock, small differences between the reported times in the * order of a few nanoseconds are normal. For this reason and as the * result of clock phase adjustments, the apparent time may not always * be monotonic increasing; therefore, the reported time is adjusted to * be greater than the last previously reported time by at least one * nanosecond. In the next era when reading the clock takes less than a * nanosecond, we have a problem and may have to upgrade to a picosecond * clock. */longnano_time(tsp)	struct timespec *tsp;{	struct timespec t, u;		/* nanosecond time */	static struct timespec lasttime; /* last time returned */	int64_t pcc, nsec, psec;	/* 64-bit temporaries */	time_t sec;	int i, s;	i = cpu_number();		/* read the time on this CPU */	s = splsched();	pcc = nano_time_rpcc(&t);	/*	 * Determine the current clock time as the time at the last	 * microset() call plus the normalized PCC accumulation since	 * then. This time must fall between the time at the most recent	 * tick interrupt to the time at one tick later. Note that the	 * apparent accumulation can exceed one second, since the	 * nanosecond time can roll over before the tick interrupt that	 * rolls the second.	 */	if (microset_flag[i]) {		psec = pcc - pcc_pcc[i];		if (psec < 0)			psec += 1LL << PCC_WIDTH;		u = pcc_time[i];		psec = psec * pcc_numer[i] / pcc_denom[i] -		    (t.tv_sec - u.tv_sec) * NANOSECOND;		nsec = u.tv_nsec + psec;		if (nsec < t.tv_nsec)			nsec = t.tv_nsec;		else if (nsec > t.tv_nsec + time_tick)			nsec = t.tv_nsec + time_tick;		t.tv_nsec = (long)nsec;		if (t.tv_nsec >= NANOSECOND) {			t.tv_nsec -= NANOSECOND;			t.tv_sec++;		}	} else {		psec = 0;	}	/*	 * Ordinarily, the current clock time is guaranteed to be later	 * by at least one nanosecond than the last time the clock was	 * read. However, this rule applies only if the current time is	 * within one second of the last time. Otherwise, the clock will	 * (shudder) be set backward. The clock adjustment daemon or	 * human equivalent is presumed to be correctly implemented and	 * to set the clock backward only upon unavoidable catastrophe.	 */	sec = lasttime.tv_sec - t.tv_sec;	nsec = lasttime.tv_nsec - t.tv_nsec;	if (nsec < 0) {		nsec += NANOSECOND;		sec--;	}	if (sec == 0) {		t.tv_nsec += nsec + 1;		if (t.tv_nsec >= NANOSECOND) {			t.tv_nsec -= NANOSECOND;			t.tv_sec++;		}	}	*tsp = t;	lasttime = *tsp;	splx(s);	psec += pcc_master[i];	return ((long)psec);}/* * This routine implements the microsecond clock. It simply calls * nano_time() and tosses the nanos. Rounding is a charitable deduction. */voidmicro_time(tv)	struct timeval *tv;		/* microsecond time */{	struct timespec ts;		/* nanosecond time */	nano_time(&ts);			/* convert and round */	tv->tv_sec = ts.tv_sec;	tv->tv_usec = (ts.tv_nsec + 500) / 1000;}/* * This routine is called via interprocessor interrupt from the tick * interrupt routine for each processor separately. It updates the PCC * and time values for the processor relative to the kernel time at the * last tick interrupt. These values are used by nano_time() to * interpolate the nanoseconds since the last call of this routine. Note * that we assume the kernel variables have been zeroed early in life. */voidmicroset(){	struct timespec t, u;		/* nanosecond time */	int64_t pcc, numer, denom;	/* 64-bit temporaries */	int i, s;	i = cpu_number();		/* read the time on this CPU */	s = splextreme();	pcc = nano_time_rpcc(&t);	splx(s);	/*	 * Intialize for first reading. Use the processor rate from the	 * system-dependent firmware.	 */	if (!microset_flag[i]) {		microset_flag[i]++;		pcc_pcc[i] = pcc;		pcc_master[i] = master_pcc;		pcc_time[i] = t;		pcc_numer[i] = NANOSECOND;		pcc_denom[i] = CPU_CLOCK; 		return;	}	/*	 * If the counter wraps or the clock lunges backwards, just	 * ignore it. Things will get well on the next call.	 */	u = pcc_time[i];	pcc_time[i] = t;	numer = (t.tv_sec - u.tv_sec) * NANOSECOND + t.tv_nsec -	    u.tv_nsec; 	denom = pcc - pcc_pcc[i];	pcc_pcc[i] = pcc;	pcc_master[i] = master_pcc;	if (denom < 0)		denom += 1LL << PCC_WIDTH;	if (denom <= 0 || numer <= 0)		return;	/*	 * Save the numerator and denominator for later.	 */	pcc_numer[i] = numer;	pcc_denom[i] = denom;}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线影院国内精品| 国产99久久久国产精品免费看| 亚洲精选视频在线| 一区二区免费看| 91国偷自产一区二区开放时间| 亚洲国产一区二区在线播放| 欧美日韩一区二区三区视频| 人人超碰91尤物精品国产| 精品久久久久久久久久久久久久久 | 国内精品嫩模私拍在线| 精品99久久久久久| 成人免费高清在线观看| 亚洲另类在线一区| 欧美精品国产精品| 加勒比av一区二区| 国产精品久久久久久久久免费桃花 | 欧美一级淫片007| 激情综合色播激情啊| 国产精品毛片久久久久久久| 欧洲视频一区二区| 免费成人结看片| 中文字幕精品一区二区三区精品| 91丨porny丨国产入口| 午夜av区久久| 国产三级精品在线| 在线观看三级视频欧美| 麻豆专区一区二区三区四区五区| 国产欧美精品区一区二区三区| 色天使色偷偷av一区二区| 美女网站视频久久| 伊人一区二区三区| 精品国产91九色蝌蚪| 色婷婷综合激情| 狠狠色丁香婷婷综合| 亚洲色图视频网| 日韩免费看的电影| 日本久久一区二区三区| 国内一区二区在线| 亚洲一区免费观看| 久久久精品免费观看| 欧美理论在线播放| 94-欧美-setu| 国产麻豆视频一区| 日韩经典一区二区| 亚洲欧美日韩国产中文在线| 亚洲精品一区二区三区香蕉| 欧美综合亚洲图片综合区| 国产91在线观看| 蜜乳av一区二区| 亚洲一区在线视频| 国产精品久久二区二区| 精品国产一区二区三区av性色| 欧美在线制服丝袜| www.一区二区| 国产成人在线免费| 国内精品免费在线观看| 青娱乐精品在线视频| 亚洲国产欧美日韩另类综合 | 亚洲激情图片小说视频| 国产香蕉久久精品综合网| 91麻豆精品国产91久久久久 | 在线影院国内精品| 99riav一区二区三区| 国产91精品精华液一区二区三区| 蜜臀av国产精品久久久久| 日韩在线观看一区二区| 午夜精品久久一牛影视| 亚洲一区免费视频| 一区二区三区日韩| 一区二区三区日韩在线观看| 亚洲精品视频免费看| 国产精品国产三级国产aⅴ入口| 久久久激情视频| 久久久99精品免费观看不卡| 亚洲精品在线观| 国产亚洲欧美日韩在线一区| 国产日韩欧美高清| 久久嫩草精品久久久精品| 久久久一区二区| 久久久久久久久一| 国产亚洲欧美一级| 中文字幕高清不卡| 国产精品久久久久久久久免费丝袜| 久久久精品国产99久久精品芒果| 久久久99免费| 国产精品成人一区二区三区夜夜夜| 日本一区二区成人在线| 国产精品欧美精品| 一区二区三区中文字幕精品精品| 成人欧美一区二区三区在线播放| 亚洲精品视频一区| 日本亚洲视频在线| 国产真实精品久久二三区| 国产精品中文有码| 97精品国产露脸对白| 欧美在线视频不卡| 91精品国产高清一区二区三区蜜臀| 日韩亚洲欧美中文三级| 精品久久久久久久久久久久久久久久久 | 中日韩av电影| 亚洲欧美日韩一区二区三区在线观看 | 天堂成人国产精品一区| 久久99精品国产91久久来源| 豆国产96在线|亚洲| 91久久精品午夜一区二区| 正在播放亚洲一区| 国产女人aaa级久久久级| 一区二区激情视频| 久久99精品久久久久久久久久久久| 国产不卡视频在线播放| 欧美性猛片xxxx免费看久爱| 日韩欧美电影一区| 亚洲青青青在线视频| 午夜欧美一区二区三区在线播放| 麻豆一区二区三| 91麻豆免费视频| 欧美电影免费观看高清完整版在线观看 | 污片在线观看一区二区| 国内偷窥港台综合视频在线播放| av在线综合网| 精品久久人人做人人爽| 一区二区三区在线视频免费| 美日韩一区二区| 99免费精品视频| 精品播放一区二区| 亚洲在线中文字幕| 国产suv一区二区三区88区| 欧美日韩国产影片| 国产精品久久久爽爽爽麻豆色哟哟| 午夜激情久久久| av午夜精品一区二区三区| 精品日韩欧美在线| 亚洲精品欧美综合四区| 国产一区二区三区在线观看免费| 欧美性xxxxxx少妇| 国产精品午夜春色av| 精品午夜久久福利影院| 欧美三片在线视频观看| 亚洲日本在线观看| 国产99久久久久| 久久久久久亚洲综合| 亚洲成人免费观看| 99re这里都是精品| 国产亚洲欧美激情| 久久福利资源站| 日韩一区二区三区电影在线观看| 一个色妞综合视频在线观看| 成人性生交大片免费看中文网站| 欧美成人一区二区三区在线观看| 水蜜桃久久夜色精品一区的特点| 91国产丝袜在线播放| 日韩一区在线免费观看| 成人性生交大合| 欧美激情中文字幕一区二区| 激情综合色综合久久| 日韩免费看网站| 麻豆精品国产91久久久久久| 欧美理论在线播放| 偷拍日韩校园综合在线| 欧美日韩国产综合久久 | 国产日韩亚洲欧美综合| 精品中文字幕一区二区| 日韩午夜激情免费电影| 天堂成人国产精品一区| 91精品国产综合久久久久久漫画| 五月激情综合网| 8v天堂国产在线一区二区| 亚瑟在线精品视频| 欧美日本视频在线| 奇米精品一区二区三区在线观看一| 欧美日本精品一区二区三区| 日韩国产在线观看| 日韩三级高清在线| 激情深爱一区二区| 精品粉嫩超白一线天av| 国产激情精品久久久第一区二区| 国产亚洲欧美日韩日本| av不卡在线观看| 亚洲精品成人少妇| 欧美日韩亚洲国产综合| 日韩成人午夜精品| 精品精品国产高清a毛片牛牛| 国产精品18久久久久久久久 | 欧美一区二区不卡视频| 久久99日本精品| 国产视频一区在线播放| 色综合天天综合| 首页综合国产亚洲丝袜| 精品久久久久久久久久久久包黑料| 国产精品1024| 亚洲影院久久精品| 欧美成人性福生活免费看| 韩国一区二区在线观看| 国产精品久久久久一区二区三区共| 91色porny| 日本不卡123| 国产精品色一区二区三区| 欧美最猛黑人xxxxx猛交| 九九精品一区二区| 亚洲婷婷在线视频|