rdtsc equivalent on v4?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

rdtsc equivalent on v4?

960件の閲覧回数
klaus
Contributor I
Hi,

does anyone have an idea how to best get something equivalent to the x86 rdtsc instruction on a v4 core (mcf548x specifically) for reading out a cycle count?

I was considering using the second slice timer to count down from ffffffff, read the SCNT register  use the inverted value. The problem with that is that this is supposed to work from userspace, and the MBAR region is locked down to kernel accesses.

Thanks!
Klaus
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

513件の閲覧回数
mon3al
Contributor I

Hi,

Did you ever come up with a solution to this. I'm trying measure CPU clock frequency. I was thinking of counting instructions in a loop and them using a timer to measure the time it took.

0 件の賞賛
返信

513件の閲覧回数
TomE
Specialist II

I program a spare DMA Timer to free-run at an appropriate rate, and use that for all "real time" measurements. Having it run at 1MHz is very convenient for the software as it doesn't involve any "human time to clock tick" conversions.

 

The following assumes that the timer is running:

 

/* * Define an architecture-neutral microsecond function. For * the mcf5329 CPU we're suing DMA Timer 1 to count * microseconds. */#define DEBUG_US()  (MCF_DTIM1_DTCN)

...
uint32_t nTimer = DEBUG_US();

... Do whatever ...

nTimer = DEBUG_US() - nTimer;
printf("Whatever took %dus\n", nTimer);

 Tom

 

0 件の賞賛
返信