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_INTH1(intentry
, struct MsgPort
*, port
)
36 ReplyMsg(GetMsg(port
));
43 AROS_UFH4(void, fastentry
,
44 AROS_UFHA(APTR
, data
, A1
),
45 AROS_UFHA(APTR
, code
, A5
),
46 AROS_UFHA(struct Message
*, msg
, D0
),
47 AROS_UFHA(struct ExecBase
*, SysBase
, A6
)) {
55 AROS_UFH2(void, callentry
,
56 AROS_UFHA(struct MsgPort
*, port
, D0
),
57 AROS_UFHA(struct ExecBase
*, SysBase
, A6
)) {
61 ReplyMsg(GetMsg(port
));
66 int main(int argc
, char **argv
) {
67 struct MsgPort
*port
, *reply
;
71 struct timeval start
, end
;
72 struct Interrupt
*intr
;
74 printf("testing with %d messages\n", NUM_MESSAGES
);
76 port
= CreateMsgPort();
77 reply
= CreateMsgPort();
79 msg
= AllocVec(sizeof(struct Message
), MEMF_PUBLIC
| MEMF_CLEAR
);
80 msg
->mn_Length
= sizeof(struct Message
);
81 msg
->mn_ReplyPort
= reply
;
83 proc
= CreateNewProcTags(NP_Entry
, (IPTR
) taskentry
,
84 NP_Name
, "timeport task",
85 NP_UserData
, (IPTR
) port
,
88 port
->mp_Flags
= PA_SIGNAL
;
89 port
->mp_SigTask
= (struct Task
*) proc
;
91 gettimeofday(&start
, NULL
);
93 for (i
= 0; i
< NUM_MESSAGES
; i
++) {
99 gettimeofday(&end
, NULL
);
101 while (end
.tv_usec
< start
.tv_usec
) {
103 end
.tv_usec
+= 1000000;
106 printf("PA_SIGNAL: %ld.%lds\n",(long)( end
.tv_sec
- start
.tv_sec
), (long)(end
.tv_usec
- start
.tv_usec
) / 1000);
108 intr
= AllocVec(sizeof(struct Interrupt
), MEMF_PUBLIC
| MEMF_CLEAR
);
109 intr
->is_Code
= (APTR
)intentry
;
110 intr
->is_Data
= port
;
112 port
->mp_Flags
= PA_SOFTINT
;
113 port
->mp_SoftInt
= intr
;
115 gettimeofday(&start
, NULL
);
117 for (i
= 0; i
< NUM_MESSAGES
; i
++) {
123 gettimeofday(&end
, NULL
);
125 while (end
.tv_usec
< start
.tv_usec
) {
127 end
.tv_usec
+= 1000000;
130 printf("PA_SOFTINT: %ld.%lds\n", (long)(end
.tv_sec
- start
.tv_sec
), (long)(end
.tv_usec
- start
.tv_usec
) / 1000);
132 port
->mp_Flags
= PA_CALL
;
133 port
->mp_SigTask
= callentry
;
135 gettimeofday(&start
, NULL
);
137 for (i
= 0; i
< NUM_MESSAGES
; i
++) {
143 gettimeofday(&end
, NULL
);
145 while (end
.tv_usec
< start
.tv_usec
) {
147 end
.tv_usec
+= 1000000;
150 printf("PA_CALL: %ld.%lds\n", (long)(end
.tv_sec
- start
.tv_sec
), (long)(end
.tv_usec
- start
.tv_usec
) / 1000);
152 intr
->is_Code
= fastentry
;
154 port
->mp_Flags
= PA_FASTCALL
;
155 port
->mp_SoftInt
= intr
;
157 gettimeofday(&start
, NULL
);
159 for (i
= 0; i
< NUM_MESSAGES
; i
++) {
165 gettimeofday(&end
, NULL
);
167 while (end
.tv_usec
< start
.tv_usec
) {
169 end
.tv_usec
+= 1000000;
172 printf("PA_FASTCALL: %ld.%lds\n", (long)(end
.tv_sec
- start
.tv_sec
), (long)(end
.tv_usec
- start
.tv_usec
) / 1000);
178 DeleteMsgPort(reply
);