On 19 Apr 2024, at 14:00, Andrew Warkentin <andreww...@gmail.com> wrote:
> 
> Somehow I said Send()/Recv()/Reply() when I meant Call()/Recv()/Send()
> (MCS of course doesn't even have a distinct Reply() function).

the correct syscall to use is ReplyWait():

Recv(…);
while (1) {
        ReplyWait(…);
}

Es per my blog: Send() and Recv() should only ever be used in initialisation 
and exception handling.

> The QNX/Linux equivalent is:
> 
> int main()
> {
>    char buf[100];
>    int f = open("/dev/null", O_WRONLY);
>    int i;
>    for (i = 0; i < 10; i++) {
>        uint64_t start = __rdtsc();
>        uint64_t end;
>        int j;
>        for (j = 0; j < 10000; j++){
>            if (write(f, buf, 100) != 100){
>                printf("cannot write\n");
>                exit(1);
>            }
>        }
>        end = __rdtsc();
>        printf("cycles: %u\n", end - start);
>    }
> }

so you’re using standard I/O to /dev/null

My Posix is a bit rusty, but this should be buffered in the library (i.e. most 
calls will *not* result in a system call).
And, given that the output goes to /dev/null, the data may be thrown away 
completely.

Basically you’re measuring the cost of a function call.

Gernot
_______________________________________________
Devel mailing list -- devel@sel4.systems
To unsubscribe send an email to devel-leave@sel4.systems

Reply via email to