2016-04-29 6 views
2

Raspberry Piでパフォーマンス測定を行い、clock_gettime()より高い解像度を望みます。パフォーマンス測定にRaspberry Pi Clock Countを使用する方法

そのため、CPUレジスタPMUSERENRを有効にする必要があります。

私のRaspberry Piの/ proc/cpuinfoによれば、「ARMv7 Processor Rev 5(v7l)」があります。だから私は、アーキテクチャリファレンスマニュアルをダウンロードし、私が使用する必要があることが見つかりました:

CRnの= C9、OPC1 = 0、CRMはC14を=、OPC2 = 0

asm ("MCR p15, 0, %0, C9, C14, 0\n\t" :: "r"(1)); 

しかし、カーネルモジュールでこのコードを使用して

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.604846] Internal error: Oops: 5 [#1] SMP ARM 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.715199] Process insmod (pid: 2944, stack limit = 0xac80e210) 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.722399] Stack: (0xac80fe90 to 0xac810000) 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.727920] fe80:          7f1ba0f8 00007fff 80098128 ac80fea8 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.738472] fea0: 80578128 0000002d 00000000 7f1ba0f8 7f1ba0f8 7f1ba26c 7f1ba264 7f1ba134 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.749092] fec0: ac80e000 8057608c ac80feec ac80fed8 8057608c 00000000 00000000 00000000 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.759724] fee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
[email protected] ~/projects/timer $ 
Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.770389] ff00: 00000000 00000000 00000000 00000000 76f5e948 00007390 00000000 76f7b390 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.781147] ff20: 76f5e948 b91a2390 ac80e000 00000000 ac80ffa4 ac80ff40 8009b6c4 80099714 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.792000] ff40: b919b000 00007390 b91a0598 b91a0457 b91a22c8 0000026c 000002ac 00000000 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.802930] ff60: 00000000 00000000 0000001f 00000020 0000000c 0000000a 00000009 00000000 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.813947] ff80: 7ea4371c 00000000 55afc028 00000080 8000fc28 ac80e000 00000000 ac80ffa8 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.825056] ffa0: 8000fa20 8009b5f0 7ea4371c 00000000 76f74000 00007390 76f5e948 76f74000 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.836170] ffc0: 7ea4371c 00000000 55afc028 00000080 55afbf78 00007390 76f5e948 00000000 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.847338] ffe0: 00000000 7ea436c4 76f55fb4 76ec0534 60000010 76f74000 00000000 00000000 

Message from [email protected] at Apr 29 20:58:12 ... 
kernel:[ 84.880715] Code: e51b3084 e1530005 e2455008 0a000009 (e5953014) 

私はカーネルモジュールが新しく、どの方向に進むべきか分かりません。そのようなことをデバッグする良い方法はありますか?

答えて

0

Linuxカーネルには、PMUドライバが付属しています。あなたはそれを活用することができます。私はあなたのためのチュートリアルを書くだろうが、なぜこの男がそれほどうまく説明するときに車輪を再発明する: http://www.carbondesignsystems.com/virtual-prototype-blog/using-the-arm-performance-monitor-unit-pmu-linux-driver

+0

クール、私はそれを試してみましょう。しかし、私のおとずれを引き起こす原因を知っていますか?そのようなエラーはどこから来るのでしょうか? – arm712

+0

実際のカーネルモジュールではなく、insmodプロセスでクラッシュしたようです。 mcr文を削除してモジュールを再コンパイルすると、insmodはまだクラッシュしますか? yesの場合、モジュールをコンパイルするために使用しているカーネルヘッダーは、実際に実行しているカーネルと互換性がありません。あなたは "uname -a"とあなたのmakefileの出力を共有できますか? – Jitesh

関連する問題