如何衡量ISR执行时间? [英] How to measure ISR execution time?

查看:126
本文介绍了如何衡量ISR执行时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux内核2.6.32上. 我面临的一个问题是,在一些我不知道的情况下/某些情况下,两个ISR(串行和以太网)之一要花费更多的时间(数百微秒).我想得到每次ISR执行时的时差.

I am on linux kernel 2.6.32. I am facing an issue in which one of the two ISR (serial and ethernet) are taking more time (hundreds of microseconds) on several occasion/under some scenarios which I don't know. I would like to get the time difference every time the ISR executes.

最好的方法是什么(就所涉及的开销而言,这是最便宜的).我看不到ARM体系结构具有某些TSC寄存器(read_tsc api),因为它可以在其他体系结构上提供给我直接访问时间的权限.

What would be the best way (least expensive in terms of overhead involved). I don't see ARM architecture has some TSC register (read_tsc api) which would give me direct access to time as it offers on some other architecture.

所以想法是 1)调用ISR的时刻开始计时 2)ISR完成的时刻测量时间. 3)得到1和2的差,将其存储在某个变量中. 4)继续执行步骤1至2,并且当步骤3中接收的值大于过去的值时,将其覆盖(保留/保留具有最大延迟的值). 问题发生时(某些突发情况会打印该值)或最后10个值的数组.

So Idea is 1) The moment ISR is invoked measure time 2) the moment ISR is complete measure the time. 3) get the difference of 1 and 2 store it in some variable. 4) Keep doing the steps 1 to 2 and when the value received in the step 3 is greater than the past value overwrite it (keep/preserve value with maximum latency). When the issue happens (some abrupt condition print the value) or array of last 10 value).

我需要在内核驱动程序中进行操作,所以让我知道什么是最便宜的方法.

I need to do in kernel driver so let me know what would be the least expensive way.

推荐答案

OMAP3具有Cortex-A8内核.那确实有性能监视器单元(PMU).周期计数(CCNT)对应于x86 TSC,除非您必须在阅读之前启用它的计数. BeagleBoard帖子中的好信息.

OMAP3 has Cortex-A8 core. That does have Performance Monitor Unit (PMU). Cycle Count (CCNT) would correspond to x86 TSC, except probably you have to enable it counting before you read. Good info in BeagleBoard post.

在2.6.32.55中,我看到arch/arm/oprofile/op_model_v7.c提供了完全的访问和控制权.我的需求是裸机,我使用了 ARM示例代码很简单,并且对我有用.

In 2.6.32.55 I see arch/arm/oprofile/op_model_v7.c gives full access and control. My need was bare-metal, I used ARM example code that was simple and worked for me.

也可以使用OMAP3 GPT,但这将需要更多工作,例如从PRCM设置其时钟输入.

It would also be possible to use an OMAP3 GPT, but that would be more work, e.g. to get its clock input set up from PRCM.

这篇关于如何衡量ISR执行时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆