您的位置:首页 > 其它

sched clock

2016-06-12 17:15 253 查看


看看各CPU使用哪个clock作为调度时钟?

 

从各自的CNTPCT_EL0
中获取。

CNTPCT_EL0  :  PhysicalTimer Count register.

 

 

kernel-3.18/arch/arm64/include/asm/arch_timer.h

107static inline u64arch_counter_get_cntpct(void)

108{

109         u64 cval;

110

111         isb();

112         asm volatile("mrs %0, cntpct_el0" :"=r" (cval));

113

114         return cval;

115}

 

 

kernel-3.18/kernel/time/sched_clock.c

unsigned long longnotrace sched_clock(void)

{

                u64 epoch_ns;

                u64 epoch_cyc;

                u64 cyc;

                unsigned long seq;

 

                if (cd.suspended)

                                return cd.epoch_ns;

 

                do {

                                seq =raw_read_seqcount_begin(&cd.seq);

                                epoch_cyc = cd.epoch_cyc;

                                epoch_ns = cd.epoch_ns;

                } while (read_seqcount_retry(&cd.seq, seq));

 

                cyc =
read_sched_clock();

                cyc = (cyc - epoch_cyc) & sched_clock_mask;

                return epoch_ns + cyc_to_ns(cyc, cd.mult, cd.shift);

}

 

 

crash-arm64-odm> pread_sched_clock

read_sched_clock = $4 =(u64 (*)(void)) 0xffffffc000843600 <arch_counter_get_cntpct>

 

u64 sched_clock_cpu(intcpu)

{

                if (unlikely(!sched_clock_running))

                                return 0;

 

                return sched_clock();

}

 

u64 cpu_clock(int cpu)

{

                return sched_clock();

}

 

u64 local_clock(void)

{

                return sched_clock();

}

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: