annotate example/renew_task/spe/SpeProfile.cc @ 2054:2e7a6f40672f draft

add param(4) in FileMapReduce.cc
author masa
date Fri, 29 Jan 2016 15:56:28 +0900
parents 768452fab95e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
1 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 192
diff changeset
2 * SPU Decrementerを用いた処理時間計測
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
3 */
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
4
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
5 #include "SpeProfile.h"
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 192
diff changeset
6 /* DMA転送に関する関数を使用するために必要なインクルードファイル */
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
7 #include <spu_intrinsics.h>
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
8 #include <stdio.h>
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
9
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 192
diff changeset
10 /* SPU Decrementerの初期値 */
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
11 #define SPU_DECREMENTER_INITIAL_VALUE 0x7FFFFFFFU
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
12
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
13 SpeProfile::SpeProfile(void): profile(0) {}
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
14
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
15 void SpeProfile::ProfStart(void)
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
16 {
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 192
diff changeset
17 /* SPU Decrementerに初期値を設定 */
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
18 spu_writech(SPU_WrDec, SPU_DECREMENTER_INITIAL_VALUE);
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
19
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 192
diff changeset
20 /* 計測開始時間をSPU Decrementerから読み取る */
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
21 profile = spu_readch(SPU_RdDec);
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
22 }
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
23
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
24 void SpeProfile::ProfStop(void)
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
25 {
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 192
diff changeset
26 /* 計測終了時間をSPU Decrementerから読み取り, 計測開始時間との差を計算 */
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
27 profile -= spu_readch(SPU_RdDec);
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
28 }
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
29
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
30 void SpeProfile::ProfPrint(void)
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
31 {
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 192
diff changeset
32 /* 処理時間を出力 */
192
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
33 printf("SPE time by SPU Decrementer: %f\n",
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
34 profile / 79800000.0f * 1000.0f);
6694da357750 add example/renew_task
gongo@localhost.localdomain
parents:
diff changeset
35 }