質問

単純な関数ごとのパフォーマンスプロファイリングを必要とする組み込みプロジェクトを継承しました。これは、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ビルドでは、これらのいずれも使用できません。そのため、OSには高解像度のタイマーアクセスがないようです。

      これは、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