1 #include <exec/types.h>
2 #include <exec/ports.h>
3 #include <dos/dosextens.h>
4 #include <dos/dostags.h>
5 #include <aros/libcall.h>
6 #include <proto/exec.h>
12 #define NUM_MESSAGES (1000000)
14 AROS_UFH3(void, taskentry
,
15 AROS_UFHA(STRPTR
, argPtr
, A0
),
16 AROS_UFHA(ULONG
, argSize
, D0
),
17 AROS_UFHA(struct ExecBase
*, SysBase
, A6
)) {
21 struct MsgPort
*port
= (struct MsgPort
*) FindTask(NULL
)->tc_UserData
;
23 for (i
= 0; i
< NUM_MESSAGES
; i
++) {
25 ReplyMsg(GetMsg(port
));
31 AROS_UFH3(void, intentry
,
32 AROS_UFHA(APTR
, data
, A1
),
33 AROS_UFHA(APTR
, code
, A5
),
34 AROS_UFHA(struct ExecBase
*, SysBase
, A6
)) {
37 struct MsgPort
*port
= (struct MsgPort
*) data
;
40 ReplyMsg(GetMsg(port
));
45 AROS_UFH4(void, fastentry
,
46 AROS_UFHA(APTR
, data
, A1
),
47 AROS_UFHA(APTR
, code
, A5
),
48 AROS_UFHA(struct Message
*, msg
, D0
),
49 AROS_UFHA(struct ExecBase
*, SysBase
, A6
)) {
57 AROS_UFH2(void, callentry
,
58 AROS_UFHA(struct MsgPort
*, port
, D0
),
59 AROS_UFHA(struct ExecBase
*, SysBase
, A6
)) {
63 ReplyMsg(GetMsg(port
));
68 int main(int argc
, char **argv
) {
69 struct MsgPort
*port
, *reply
;
73 struct timeval start
, end
;
74 struct Interrupt
*intr
;
76 printf("testing with %d messages\n", NUM_MESSAGES
);
78 port
= CreateMsgPort();
79 reply
= CreateMsgPort();
81 msg
= AllocVec(sizeof(struct Message
), MEMF_PUBLIC
| MEMF_CLEAR
);
82 msg
->mn_Length
= sizeof(struct Message
);
83 msg
->mn_ReplyPort
= reply
;
85 proc
= CreateNewProcTags(NP_Entry
, (IPTR
) taskentry
,
86 NP_Name
, "timeport task",
87 NP_UserData
, (IPTR
) port
,
90 port
->mp_Flags
= PA_SIGNAL
;
91 port
->mp_SigTask
= (struct Task
*) proc
;
93 gettimeofday(&start
, NULL
);
95 for (i
= 0; i
< NUM_MESSAGES
; i
++) {
101 gettimeofday(&end
, NULL
);
103 while (end
.tv_usec
< start
.tv_usec
) {
105 end
.tv_usec
+= 1000000;
108 printf("PA_SIGNAL: %ld.%lds\n",(long)( end
.tv_sec
- start
.tv_sec
), (long)(end
.tv_usec
- start
.tv_usec
) / 1000);
110 intr
= AllocVec(sizeof(struct Interrupt
), MEMF_PUBLIC
| MEMF_CLEAR
);
111 intr
->is_Code
= intentry
;
112 intr
->is_Data
= port
;
114 port
->mp_Flags
= PA_SOFTINT
;
115 port
->mp_SoftInt
= intr
;
117 gettimeofday(&start
, NULL
);
119 for (i
= 0; i
< NUM_MESSAGES
; i
++) {
125 gettimeofday(&end
, NULL
);
127 while (end
.tv_usec
< start
.tv_usec
) {
129 end
.tv_usec
+= 1000000;
132 printf("PA_SOFTINT: %ld.%lds\n", (long)(end
.tv_sec
- start
.tv_sec
), (long)(end
.tv_usec
- start
.tv_usec
) / 1000);
134 port
->mp_Flags
= PA_CALL
;
135 port
->mp_SigTask
= callentry
;
137 gettimeofday(&start
, NULL
);
139 for (i
= 0; i
< NUM_MESSAGES
; i
++) {
145 gettimeofday(&end
, NULL
);
147 while (end
.tv_usec
< start
.tv_usec
) {
149 end
.tv_usec
+= 1000000;
152 printf("PA_CALL: %ld.%lds\n", (long)(end
.tv_sec
- start
.tv_sec
), (long)(end
.tv_usec
- start
.tv_usec
) / 1000);
154 intr
->is_Code
= fastentry
;
156 port
->mp_Flags
= PA_FASTCALL
;
157 port
->mp_SoftInt
= intr
;
159 gettimeofday(&start
, NULL
);
161 for (i
= 0; i
< NUM_MESSAGES
; i
++) {
167 gettimeofday(&end
, NULL
);
169 while (end
.tv_usec
< start
.tv_usec
) {
171 end
.tv_usec
+= 1000000;
174 printf("PA_FASTCALL: %ld.%lds\n", (long)(end
.tv_sec
- start
.tv_sec
), (long)(end
.tv_usec
- start
.tv_usec
) / 1000);
180 DeleteMsgPort(reply
);