/* linux/kernel/time/jiffies.c*/
static cycle_t jiffies_read(struct clocksource *cs)
{
return (cycle_t) jiffies;
} struct clocksource clocksource_jiffies = {
.name = "jiffies",
.rating = , /* lowest valid rating*/
.read = jiffies_read,
.mask = 0xffffffff, /*32bits*/
.mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
.mult_orig = NSEC_PER_JIFFY << JIFFIES_SHIFT,
.shift = JIFFIES_SHIFT,
}; static int __init init_jiffies_clocksource(void)
{
return clocksource_register(&clocksource_jiffies);
} core_initcall(init_jiffies_clocksource); int clocksource_register(struct clocksource *c)
-->ret = clocksource_enqueue(c);
/*静态全局变量存储下一个精度最高的时钟源
static struct clocksource *next_clocksource;*/
-->next_clocksource = select_clocksource(); struct clocksource *clocksource_get_next(void)
/*静态全局变量存储当前使用的时钟源
static struct clocksource *curr_clocksource = &clocksource_jiffies;*/
-->curr_clocksource = next_clocksource; /*什么时间更换时钟源,以下两种方法选择其一*/
/*1.jiffies时间中断处理函数*/
static irqreturn_t s3c2410_timer_interrupt(int irq, void *dev_id)
-->void timer_tick(void)
-->void do_timer(unsigned long ticks)
-->jiffies_64 += ticks;
-->update_times(ticks);
-->void update_wall_time(void)
/* check to see if there is a new clocksource to use */
-->change_clocksource();
/*2.jiffies时间中断处理函数*/
void clockevents_register_device(struct clock_event_device *dev)
/*内核通知链触发*/
-->clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev); /*通知链注册*/
void __init tick_init(void)
/*static struct notifier_block tick_notifier = {
.notifier_call = tick_notify,
};*/
-->clockevents_register_notifier(&tick_notifier);
/*通知链回调*/
static int tick_notify(struct notifier_block *nb, unsigned long reason,void *dev)
-->static int tick_check_new_device(struct clock_event_device *newdev)
-->static void tick_setup_device(struct tick_device *td,struct clock_event_device *newdev, int cpu,const struct cpumask *cpumask)
-->void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
-->void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
-->dev->event_handler = tick_handle_periodic;
/*event时间处理函数调用*/
void tick_handle_periodic(struct clock_event_device *dev)
-->static void tick_periodic(int cpu)
-->void do_timer(unsigned long ticks)
-->jiffies_64 += ticks;
-->update_times(ticks);
-->void update_wall_time(void)
/* check to see if there is a new clocksource to use */
-->change_clocksource();

/* linux/kernel/time/jiffies.c*/static cycle_t jiffies_read(struct clocksource *cs){return (cycle_t) jiffies;}
struct clocksource clocksource_jiffies = {.name= "jiffies",.rating= 1, /* lowest valid rating*/.read= jiffies_read,.mask= 0xffffffff, /*32bits*/.mult= NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */.mult_orig= NSEC_PER_JIFFY << JIFFIES_SHIFT,.shift= JIFFIES_SHIFT,};
static int __init init_jiffies_clocksource(void){return clocksource_register(&clocksource_jiffies);}
core_initcall(init_jiffies_clocksource);

int clocksource_register(struct clocksource *c)-->ret = clocksource_enqueue(c);/*静态全局变量存储下一个精度最高的时钟源static struct clocksource *next_clocksource;*/-->next_clocksource = select_clocksource();
struct clocksource *clocksource_get_next(void)/*静态全局变量存储当前使用的时钟源static struct clocksource *curr_clocksource = &clocksource_jiffies;*/-->curr_clocksource = next_clocksource;
/*什么时间更换时钟源,以下两种方法选择其一*//*1.jiffies时间中断处理函数*/static irqreturn_t s3c2410_timer_interrupt(int irq, void *dev_id)-->void timer_tick(void)-->void do_timer(unsigned long ticks)-->jiffies_64 += ticks;-->update_times(ticks);-->void update_wall_time(void)/* check to see if there is a new clocksource to use */-->change_clocksource();/*2.jiffies时间中断处理函数*/void clockevents_register_device(struct clock_event_device *dev)/*内核通知链触发*/-->clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
/*通知链注册*/void __init tick_init(void)/*static struct notifier_block tick_notifier = {.notifier_call = tick_notify,};*/-->clockevents_register_notifier(&tick_notifier);/*通知链回调*/static int tick_notify(struct notifier_block *nb, unsigned long reason,void *dev)-->static int tick_check_new_device(struct clock_event_device *newdev)-->static void tick_setup_device(struct tick_device *td,struct clock_event_device *newdev, int cpu,const struct cpumask *cpumask)-->void tick_setup_periodic(struct clock_event_device *dev, int broadcast)-->void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)-->dev->event_handler = tick_handle_periodic;/*event时间处理函数调用*/void tick_handle_periodic(struct clock_event_device *dev)-->static void tick_periodic(int cpu)-->void do_timer(unsigned long ticks)-->jiffies_64 += ticks;-->update_times(ticks);-->void update_wall_time(void)/* check to see if there is a new clocksource to use */-->change_clocksource();

timer event的更多相关文章

  1. Microsecond and Millisecond C# Timer[转]

    文章转至:http://www.codeproject.com/Articles/98346/Microsecond-and-Millisecond-NET-Timer IntroductionAny ...

  2. Python 3.X 实现定时器 Timer,制作抽象的Timer定时器基类

    Python 在不依赖第三方库的前提下,对于定时器的实现并不是很完美,但是这不意味着我们无法实现. 阅读了网上的一些资料,得出一些结论,顺手写了一个基类的定时器(Python3) BaseTimer: ...

  3. C#中5中timer的比较

    C#中有5个timer,它们的主要区别如下: System.Threading.Timer  在线程池启动一个后台任务.我前段时间写过一个关于timer的垃圾回收的需要注意一下,参见谁动了我的time ...

  4. Swoole源代码学习记录(十五)——Timer模块分析

    swoole版本号:1.7.7-stable Github地址:点此查看 1.Timer 1.1.swTimer_interval_node 声明: // swoole.h 1045-1050h ty ...

  5. Linux时间子系统之(十七):ARM generic timer驱动代码分析

    专题文档汇总目录 Notes:ARM平台Clock/Timer架构:System counter.Timer以及两者之间关系:Per cpu timer通过CP15访问,System counter通 ...

  6. UEFI EVENT 全解

    Event和Timer在UEFI当中是怎么实现的以及原理,我们先从Timer开始,然后细细的拨开隐藏在底层的实现. 先说Timer,那什么是Timer呢?其实在中文里面我们把它叫做定时/计数器,但是我 ...

  7. Linux时间子系统(十七) ARM generic timer驱动代码分析

    一.前言 关注ARM平台上timer driver(clocksource chip driver和clockevent chip driver)的驱动工程师应该会注意到timer硬件的演化过程.在单 ...

  8. System and method for controlling switching between VMM and VM using enabling value of VMM timer indicator and VMM timer value having a specified time

    In one embodiment, a method includes transitioning control to a virtual machine (VM) from a virtual ...

  9. .net几种timer区别

    概述:.net框架不同名称控件都包含了各种timer,但每个timer有什么具体区别呢? 一.System.Threading private static void ThreadingTimer() ...

随机推荐

  1. Codeforces 1139D(推式子+dp)

    题目传送 推公式博客传送 推完式子就是去朴素地求就行了Orz const int maxn = 1e5 + 5; const int mod = 1e9 + 7; int m, mu[maxn], v ...

  2. python tickle模块与json模块

    #! /usr/bin/env python# -*- coding:utf-8 -*-#JSON(JavaScript Object Notation, JS 对象标记) 是一种轻量级的数据交换格式 ...

  3. vue初级学习--使用 vue-resource 请求数据

    一.导语 我发现好像我最近几次写文,都是在7号,很恰巧啊~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...

  4. SimpleDateFormat 如何安全的使用?

     前言 为什么会写这篇文章?因为这些天在看<阿里巴巴开发手册详尽版>,没看过的可以关注微信公众号:zhisheng,回复关键字:阿里巴巴开发手册详尽版 就可以获得. 关注我 转载请务必注明 ...

  5. Ajax 提交表单【包括文件上传】

    利用js插件实现 <script src="@Url.Content("~/js/layer/jquery.form.min.js")"></ ...

  6. JS中函数与事件

    一.函数: 1.函数就是一个工具,通过一小段代码,完成某个功能: 2.函数的定义: function 函数名(){ ..... } 或者 : var 函数名 = function(){ ...... ...

  7. git与GitHub(二)

    昨天在安装完git之后,出了一个问题,虽然暂时有解决的办法,但是由于电脑中了病毒并且配置低下等原因,这个问题的解决办法目前还有待考证.遇到的问题是这样的: 前提是想试一下git在命令行里的命令:于是: ...

  8. 5个典型的JavaScript面试题

    在IT界,需要大量的 JavaScript 开发者.如果你的能力能够胜任这一角色,那么你将获得许多换工作和提高薪水的机会.但是在你被公司录取之前,你需要展现你的技术,以便通过面试环节.在这篇文章中,我 ...

  9. UVA 1625 Color Length 颜色的长度 (预处理+dp)

    dp[i][j]表示前一个序列拿了i个颜色,后一个序列拿了j个颜色的最小花费. 转移的时候显然只能向dp[i+1][j],或dp[i][j+1]转移,每增加拿走一个颜色,之前已经出现但没结束的颜色个数 ...

  10. build.sbt的定义格式

    一个简单的build.sbt文件内容如下: name := "hello" // 项目名称 organization := "xxx.xxx.xxx" // 组 ...