Linux??????? - PowerPoint PPT Presentation

About This Presentation
Title:

Linux???????

Description:

... Real time clock RTC Time stamp counter TSC Programmable interval timer, ... 8254 CMOS ... – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 45
Provided by: educ5480
Category:

less

Transcript and Presenter's Notes

Title: Linux???????


1
Linux???????
  • ????????????
  • ???(0551-3606864)
  • xlanchen_at_ustc.edu.cn
  • Spring 2009

2
Linux?????????
3
????
  • Linux?????????????
  • ??????????
  • ????time(), ftime()??gettimeofday()
  • ?????
  • settimer(), alarm()
  • ?????????????????????????????

4
???
  • 80x86?????,???????????????
  • ????Real time clock,RTC
  • ??????Time stamp counter,TSC
  • ????????Programmable interval timer, PIT
  • SMP??????APIC???

???? ????
??????????, ????
5
????RTC
  • ??????PC???????
  • ???CPU???????
  • ?????????????RTC?????
  • ????PC??,??????
  • ?CMOS RAM??????????
  • ??Motorala 146818
  • ??IRQ8?????????,???2HZ8192??
  • ????????????

6
  • Linux?????RTC???????
  • ??mach_get_cmos_time
  • ????????/dev/rtc
  • ????????????
  • ????0x70?0x71??????RTC
  • ???????????????????

native_get_wallclock
get_wallclock
read_persistent_clock
timekeeping_init?
timekeeping_resume?
timekeeping_suspend
7
??????TSC
  • ?80x86?????,???CLK????
  • ????????????
  • ?pentium??,??80x86??????????TSC
  • ??64???????????????
  • ????????(CLK)???1
  • ??????400MHz?????,TSC?2.5ns?1
  • rdtsc?????????

8
  • ?Linux2.6.26?,rdtscll()?rdtscl()????TSC???

rdtscl32?
rdtscll64?
native_read_tsc
9
  • ??????????????PIT??,TSC??????????
  • ??,Linux?????????????????CLK???(?CPU?????)
  • native_calculate_cpu_khz
  • ???????????????????TSC?????????
  • ????????????PIT??,CALIBRATE_LATCH
  • ??????????????,?????????????,???????

10
????????PIT
  • ???????,????????????
  • ???8254 CMOS??
  • ??I/O??0x400x43
  • Linux?PIT???
  • 100Hz
  • ??IRQ0??????
  • ?10ms????????,???tick

11
(No Transcript)
12
(No Transcript)
13
Linux???????
  • ???????????????
  • ???????
  • ???????????,???????
  • ??????????
  • ?????????

14
?????????????????
  • Jiffies??
  • ???
  • Xtime??

15
Jiffies??
  • ??????????????tick?
  • ??????1
  • ??jiffies_64

16
???
  • ?????
  • ??????clocksource
  • ?????

17
????? clocksource_register clocksource_list ?rat
ing??
18
???tsc?????
19
??pit?????
init_pit_clocksource????????
20
Xtime??
  • ?????????

21
  • ????
  • 1970?1?1?(UTC)??

22
Xtime???
  • ?????tick????
  • ??update_wall_time
  • ???????xtime???????
  • ???

23
X86????????????
start_kernel
init_timers ???? ?? ???
hrtimers_init ?????? ?? ???
timekeeping_init Xtime?? ???
time_init
sched_clock_init ????
tick_init ???? ???
hpet_time_init
setup_pit_timer ??pit_clockevent? Clockevent?? ???
global_clock_event
24
pit_clockevent
????event_handler???????
25
tick_init??clockevents_register_notifier??tick_not
ifier? clockevents_chain?
notifier_call_chain?? ??clockevents_chain
tick_check_new_device
tick_setup_device
tick_setup_periodic
__raw_notifier_call_chain
tick_set_periodic_handler
raw_notifier_call_chain
??event_handler tick_handle_periodic
clockevents_do_notify
tick_periodic
clockevents_register_device
update_process_times
do_timer
26
(No Transcript)
27
(No Transcript)
28
(No Transcript)
29
(No Transcript)
30
?????????
  • ????
  • ?????(??)
  • ?????(????)
  • ????

31
?????
  • ??????????????,????????????????

32
????????????
  • ??????timer_list??
  • ??init_timer???,???????????????
  • ??????
  • ??add_timer?????????
  • ???????????,?????????,??????????

33
????????
34
????
35
??
36
(No Transcript)
37
????????delayed work
38
????????schedule_timeout
39
????
??delay.S
40
???delay_loop
??tsc??delay_tsc
41
????????????
  • time()
  • ???1970?1?1???0??????
  • ftime()
  • ???1970?1?1???0????????????????
  • ?????timeb
  • gettimeofday()
  • ???1970?1?1???0??????
  • ???sys_gettimeofday()

42
  • settimer()
  • ?????
  • ???????????(??0,?????)
  • alarm()
  • ??SIGALARM??

43
????????
  • date??????????
  • ??time????
  • ??ctime??????

44
Thanks!
  • The end.
Write a Comment
User Comments (0)
About PowerShow.com