Other Parts Discussed in Thread: AM3517
hello
is there a real-time kernel patch available for the kernel which is delivered with the PSP for the AM3517? currently i'm using the PSP 03.00.00.02 which has the kernel version 2.6.31-rc7.
Update:
The main reason why I have asked for a RT patch for the AM3517 PSP is because I've noticed that the time resolution of the kernel seems to be very low. I've written a small test application that calls clock_gettime() before and after a for-loop:
#include <time.h>
#include <stdio.h>
#include <string.h>
void diff(struct timespec* t1, struct timespec* t2);
int main()
{
int i;
struct timespec ts_before, ts_after;
memset(&ts_before, 0, sizeof ts_before);
memset(&ts_after, 0, sizeof ts_after);
printf("looping 500x ... \n");
clock_gettime(CLOCK_MONOTONIC, &ts_before);
for (i = 0; i < 500; ++i );
clock_gettime(CLOCK_MONOTONIC, &ts_after);
diff(&ts_before, &ts_after);
printf("looping 1000x ... \n");
clock_gettime(CLOCK_MONOTONIC, &ts_before);
for (i = 0; i < 1000; ++i );
clock_gettime(CLOCK_MONOTONIC, &ts_after);
diff(&ts_before, &ts_after);
printf("looping 2000x ... \n");
clock_gettime(CLOCK_MONOTONIC, &ts_before);
for (i = 0; i < 2000; ++i );
clock_gettime(CLOCK_MONOTONIC, &ts_after);
diff(&ts_before, &ts_after);
printf("looping 3000x ... \n");
clock_gettime(CLOCK_MONOTONIC, &ts_before);
for (i = 0; i < 3000; ++i );
clock_gettime(CLOCK_MONOTONIC, &ts_after);
diff(&ts_before, &ts_after);
printf("looping 5000x ... \n");
clock_gettime(CLOCK_MONOTONIC, &ts_before);
for (i = 0; i < 5000; ++i );
clock_gettime(CLOCK_MONOTONIC, &ts_after);
diff(&ts_before, &ts_after);
return 0;
}
void diff(struct timespec* t1, struct timespec* t2)
{
int diff_s = t2->tv_sec - t1->tv_sec;
int diff_ns = t2->tv_nsec - t1->tv_nsec;
printf("time diff %ds, %dns\n", diff_s, diff_ns);
}
The output of the program is the following:
looping 500x ...
time diff 0s, 0ns
looping 1000x ...
time diff 0s, 0ns
looping 2000x ...
time diff 0s, 30517ns
looping 3000x ...
time diff 0s, 30518ns
looping 5000x ...
time diff 0s, 61035ns
looping 500x ...
time diff 0s, 30518ns
looping 1000x ...
time diff 0s, 30518ns
looping 2000x ...
time diff 0s, 30517ns
looping 3000x ...
time diff 0s, 30518ns
looping 5000x ...
time diff 0s, 61035ns
looping 500x ...
time diff 0s, 0ns
looping 1000x ...
time diff 0s, 30517ns
looping 2000x ...
time diff 0s, 30518ns
looping 3000x ...
time diff 0s, 61035ns
looping 5000x ...
time diff 0s, 91553ns
As you can see, only get multiples of 30.5usec! For me this leads to the conclusion that the resolution of clock_gettime() is only 30usec when it should be less than 10usec I'd have guessed...
Can anyone confirm this and does anyone have a solution for getting a higher resolution clock/timer?
thx, dominique