tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Bogus time values for time(1)



This happens with the following multithreaded program:

#include <pthread.h>

void *f(void *arg)
{
        return(NULL);
}

int main(void)
{
        int i, j;
        const int nthr = 10;
        pthread_t tid[nthr];

        for (j = 0; j < 1000; j++)
        {
                for (i = 0; i < nthr; i++)
                {
                        pthread_create(&tid[i], NULL, &f, NULL);
                }

                for (i = 0; i < nthr; i++)
                        pthread_join(tid[i], NULL);
        }

        pthread_exit(NULL);
}

atom$ time ./a.out
        0.11 real      7333.60 user     31167.82 sys

Any ideas? This was run on 5.1_STABLE amd64 (Intel Atom D510 CPU).


Home | Main Index | Thread Index | Old Index