我继承了一个嵌入式项目,该项目需要一些简单的按功能进行性能分析。它由运行uClinux(2.6.17.7-uc1)的Coldfire(MCF5328)组成。

我不是Coldfire或uClinux(或Linux)的专家,所以请原谅我的无知。

在Windows中,我只需要使用QueryPerformanceCounter来访问x86高分辨率计时器。记录前后的计数器并比较差异。

我了解到Linux在QueryPerformanceCounter上有很多变体:

  • clock_gettime / res
  • getnstimeofday
  • ktime_x

    甚至可以通过访问时间戳计数器

    • get_cycles

      在此设备正在运行的uClinux构建中,这些都不可用。因此,该操作系统似乎没有高分辨率的计时器访问权限。

      这是否意味着Coldfire本身不提供此类功能?还是uClinux端口的作者遗漏了它们?我可以使用硬件上的某些东西,怎么使用呢?

有帮助吗?

解决方案 2

I ended up using one of the four DMA Timers on the Coldfire. It was a simple matter to enable the timer as a free-running, non-interrupt generating, counter. This provides a 12.5ns counter (at 80Mhz).

其他提示

Given how old your kernel is, you may not have support for high-resolution timers.

If you are writing a kernel driver, the APIs are different. If get_cycles() is stubbed out, it probably means your CPU architecture doesn't support a cycle counter. Since your kernel is very old, do_gettimeofday is probably the best you can do, short of writing a driver to directly query some timer hardware.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top