annotate example/Pipeline/ppe/Twice.cc @ 963:86e50572561c

SgChange
author tkaito
date Thu, 05 Aug 2010 22:47:38 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
963
86e50572561c SgChange
tkaito
parents:
diff changeset
1 #include <stdio.h>
86e50572561c SgChange
tkaito
parents:
diff changeset
2 #include "SchedTask.h"
86e50572561c SgChange
tkaito
parents:
diff changeset
3 #include "Twice.h"
86e50572561c SgChange
tkaito
parents:
diff changeset
4 #include "Func.h"
86e50572561c SgChange
tkaito
parents:
diff changeset
5
86e50572561c SgChange
tkaito
parents:
diff changeset
6 /* これは必須 */
86e50572561c SgChange
tkaito
parents:
diff changeset
7 SchedDefineTask(Twice);
86e50572561c SgChange
tkaito
parents:
diff changeset
8
86e50572561c SgChange
tkaito
parents:
diff changeset
9 static int
86e50572561c SgChange
tkaito
parents:
diff changeset
10 run(SchedTask *s,void *rbuf, void *wbuf)
86e50572561c SgChange
tkaito
parents:
diff changeset
11 {
86e50572561c SgChange
tkaito
parents:
diff changeset
12 int *i_data;
86e50572561c SgChange
tkaito
parents:
diff changeset
13 int *o_data;
86e50572561c SgChange
tkaito
parents:
diff changeset
14 long length;
86e50572561c SgChange
tkaito
parents:
diff changeset
15
86e50572561c SgChange
tkaito
parents:
diff changeset
16 i_data = (int*)rbuf;
86e50572561c SgChange
tkaito
parents:
diff changeset
17 o_data = (int*)wbuf;
86e50572561c SgChange
tkaito
parents:
diff changeset
18 length = s->read_size()/sizeof(int);
86e50572561c SgChange
tkaito
parents:
diff changeset
19
86e50572561c SgChange
tkaito
parents:
diff changeset
20 for (int i = 0; i < length; i++) {
86e50572561c SgChange
tkaito
parents:
diff changeset
21 o_data[i] = i_data[i] * 2;
86e50572561c SgChange
tkaito
parents:
diff changeset
22 }
86e50572561c SgChange
tkaito
parents:
diff changeset
23 s->printf("PPE %d end\n",s->get_cpuid());
86e50572561c SgChange
tkaito
parents:
diff changeset
24
86e50572561c SgChange
tkaito
parents:
diff changeset
25 return 0;
86e50572561c SgChange
tkaito
parents:
diff changeset
26 }