uti: futex call function in mcctrl
Previously, futex code of McKerenl was called by mccontrol, but there ware some problems with this method. (Mainly, location of McKernel image on memory) Call futex code in mcctrl instead of the one in McKernel image, giving the following benefits: 1. Not relying on shared kernel virtual address space with Linux any more 2. The cpu id store / retrieve is not needed and resulting in the code Change-Id: Ic40929b64a655b270c435859fa287fedb713ee5c refe: #1428
This commit is contained in:
committed by
Masamichi Takagi
parent
35296c8210
commit
a9973e913d
@@ -34,23 +34,6 @@ double nspw; /* nsec per work */
|
||||
|
||||
#define N_INIT 10000000
|
||||
|
||||
void fwq_init(unsigned long *mem) {
|
||||
struct timespec start, end;
|
||||
unsigned long nsec;
|
||||
int i;
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start);
|
||||
BULK_FSW(N_INIT, mem);
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &end);
|
||||
nsec = (TS2NS(end.tv_sec, end.tv_nsec) - TS2NS(start.tv_sec, start.tv_nsec));
|
||||
nspw = nsec / (double)N_INIT;
|
||||
printf("nsec=%ld, nspw=%f\n", nsec, nspw);
|
||||
}
|
||||
|
||||
void fwq(unsigned long delay_nsec, unsigned long* mem) {
|
||||
//printf("delay_nsec=%ld,count=%f\n", delay_nsec, delay_nsec / nspw);
|
||||
BULK_FSW(delay_nsec / nspw, mem);
|
||||
}
|
||||
|
||||
void *
|
||||
util_thread(void *arg)
|
||||
{
|
||||
@@ -65,7 +48,7 @@ util_thread(void *arg)
|
||||
}
|
||||
errno = 0;
|
||||
|
||||
fwq(500 * 1000 * 1000UL, &mem); /* Sending debug messages through serial takes 0.05 sec */
|
||||
fwq(500 * 1000 * 1000UL); /* Sending debug messages through serial takes 0.05 sec */
|
||||
|
||||
pthread_mutex_lock(&mutex);
|
||||
if (owned) {
|
||||
@@ -84,7 +67,7 @@ int main(int argc, char **argv) {
|
||||
unsigned long mem;
|
||||
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
fwq_init(&mem);
|
||||
fwq_init();
|
||||
|
||||
fprintf(stderr, "CT14001 futex START\n");
|
||||
|
||||
@@ -110,7 +93,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "CT14004 lock first NG\n");
|
||||
}
|
||||
owned = 1;
|
||||
fwq(2000 * 1000 * 1000UL, &mem); /* Need 2 sec to make child sleep */
|
||||
fwq(2000 * 1000 * 1000UL); /* Need 2 sec to make child sleep */
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
pthread_join(thr, NULL);
|
||||
|
||||
Reference in New Issue
Block a user