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
@ -74,23 +74,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 mydelay(long delay_nsec, long *mem) {
|
||||
struct timespec start, end;
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start);
|
||||
@ -136,7 +119,7 @@ void *progress_fn(void *_arg) {
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&ep_lock);
|
||||
fwq(random() % 1000000000, &mem); /* 0 - 1 sec */
|
||||
fwq(random() % 1000000000); /* 0 - 1 sec */
|
||||
pthread_mutex_lock(&ep_lock);
|
||||
}
|
||||
return NULL;
|
||||
@ -156,7 +139,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stdout, "CT09002 main running on McKernel INFO\n");
|
||||
}
|
||||
|
||||
fwq_init(&mem);
|
||||
fwq_init();
|
||||
pthread_mutex_init(&ep_lock, NULL);
|
||||
|
||||
for(i = 0; i < NTHR; i++) {
|
||||
@ -189,7 +172,7 @@ int main(int argc, char **argv) {
|
||||
for (i = 0; i < 10; i++) {
|
||||
pthread_mutex_lock(&ep_lock);
|
||||
nevents++;
|
||||
fwq(random() % 1000000000, &mem); /* 0 - 1 sec */
|
||||
fwq(random() % 1000000000); /* 0 - 1 sec */
|
||||
pthread_mutex_unlock(&ep_lock);
|
||||
while (nevents > 0) {
|
||||
FIXED_SIZE_WORK(&mem);
|
||||
|
||||
Reference in New Issue
Block a user