Skip to content

Commit 3a1d877

Browse files
committed
[GAP9] Fixed Zero Cyclecounter Issue
1 parent 6b5c2e5 commit 3a1d877

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

DeeployTest/Platforms/GAP9/src/deeploytest.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define SLAVESTACKSIZE 3800
1818

1919
struct pi_device cluster_dev;
20+
uint32_t total_cycles = 0;
2021

2122
typedef struct {
2223
void *expected;
@@ -68,7 +69,12 @@ void InitNetworkWrapper(void *args) {
6869

6970
void RunNetworkWrapper(void *args) {
7071
(void)args;
72+
// Initialize performance counter in cluster context
73+
ResetTimer();
74+
StartTimer();
7175
RunNetwork(pi_core_id(), pi_cl_cluster_nb_cores());
76+
total_cycles = getCycles();
77+
StopTimer();
7278
}
7379

7480
int main(void) {
@@ -113,10 +119,7 @@ int main(void) {
113119

114120
pi_cluster_task(&cluster_task, RunNetworkWrapper, NULL);
115121
cluster_task.slave_stack_size = SLAVESTACKSIZE;
116-
ResetTimer();
117-
StartTimer();
118122
pi_cluster_send_task_to_cl(&cluster_dev, &cluster_task);
119-
StopTimer();
120123

121124
#ifndef CI
122125
printf("Output:\r\n");
@@ -175,7 +178,7 @@ int main(void) {
175178
}
176179
}
177180

178-
printf("Runtime: %u cycles\r\n", getCycles());
181+
printf("Runtime: %u cycles\r\n", total_cycles);
179182
printf("Errors: %u out of %u \r\n", tot_err, tot_tested);
180183

181184
return 0;

0 commit comments

Comments
 (0)