欢迎来到天天文库
浏览记录
ID:18195549
大小:67.50 KB
页数:20页
时间:2018-09-15
《linux高精度时钟分析》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、linux高精度时钟分析锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛铔愯洂http://qgjie456.blog.163.com/MSN锛歲gjie@hotmail.com鏈枃閫傜敤浜?linux-2.6.22.8V0.1娆㈣繋杞浇锛屼絾璇蜂繚鐣欎綔鑰呬俊鎭?锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛锛婏紛涓€銆佹暟鎹粨鏋勫垎鏋?structhr
2、timer_clock_base{structhrtimer_cpu_base*cpu_base;clockid_tindex;structrb_rootactive;structrb_node*first;ktime_tresolution;ktime_t(*get_time)(void);ktime_t(*get_softirq_time)(void);ktime_tsoftirq_time;#ifdefCONFIG_HIGH_RES_TIMERSktime_toffset;int(*reprogram)(struct
3、hrtimer*t,structhrtimer_clock_base*b,ktime_tn);#endif};structhrtimer_cpu_base{spinlock_tlock;structlock_class_keylock_key;structhrtimer_clock_baseclock_base[HRTIMER_MAX_CLOCK_BASES];#ifdefCONFIG_HIGH_RES_TIMERSktime_texpires_next;inthres_active;structlist_headcb_p
4、ending;unsignedlongnr_events;#endif};kernel-2.6.22涓殑armarch鍔犲叆浜嗗dynticks,clocksource/event鏀寔.鎵句簡浜沰ernelclock鍙妕imer瀛愮郴缁熻繎鏉ョ殑鍙樺寲,鎬荤粨涓€涓?涓€鑸潵璇碨oft-Timer(timerwheel/hrtimer)閮芥槸鐢盚ardware-Timer(鏃堕挓涓柇涔嬬被)浠ュ強鐩稿叧鐨刢locksource(e.gGPTinSoc)椹卞姩,鎵€浠ユ垜鎵撶畻鍏堜粠clock杩欏眰寮€濮嬩粙缁?鎺
5、ョ潃鏄痵oft-timer,kerneltimekeeping,鏈€鍚庢潵鐪嬩竴浜涘簲鐢?ClockSourceclocksource瀹氫箟浜嗕竴涓猚lockdevice鐨勫熀鏈睘鎬у強琛屼负,杩欎簺clockdevice涓€鑸兘鏈夎鏁?瀹氭椂,浜х敓涓柇鑳藉姏,姣斿GPT.缁撴瀯瀹氫箟濡備笅:structclocksource{char*name;structlist_headlist;intrating;cycle_t(*read)(void);cycle_tmask;u32mult;/*cycle->xti
6、meinterval,maybetwoclockcycletriggeroneinterrupt(onextimeinterval)*/u32shift;unsignedlongflags;cycle_t(*vread)(void);void(*resume)(void);/*timekeepingspecificdata,ignore*/cycle_tcycle_interval;/*justtherateofGPTcountperOSHZ*/u64xtime_interval;/*xtime_interval=cycl
7、e_interval*mult.*/cycle_tcycle_last____cacheline_aligned_in_smp;/*lastcycleinratecount*/u64xtime_nsec;/*cyclecount,remainfromxtime.tv_nsec*nownsecratecountoffset=xtime_nsec+*xtime.tv_nsec<8、ckdevicecount瀵勫瓨鍣ㄥ綋鍓嶈鏁板€兼帴鍙?淇濆瓨涓婁竴娆″懆鏈熻鏁板€煎拰姣忎釜tick鍛ㄦ湡闂撮殧鍊?杩欎釜缁撴瀯鍐呯殑鍊?鏃犺鏄痗ycle_t,杩樻槸u64绫诲瀷(瀹為檯cycle_t灏辨槸u64)閮芥槸璁℃暟鍊?cycle),鑰屼笉鏄痭sec,sec鍜宩iffies.read(
8、ckdevicecount瀵勫瓨鍣ㄥ綋鍓嶈鏁板€兼帴鍙?淇濆瓨涓婁竴娆″懆鏈熻鏁板€煎拰姣忎釜tick鍛ㄦ湡闂撮殧鍊?杩欎釜缁撴瀯鍐呯殑鍊?鏃犺鏄痗ycle_t,杩樻槸u64绫诲瀷(瀹為檯cycle_t灏辨槸u64)閮芥槸璁℃暟鍊?cycle),鑰屼笉鏄痭sec,sec鍜宩iffies.read(
此文档下载收益归作者所有