60 |
|
#endif |
61 |
|
|
62 |
|
static COLOR avsum = BLKCOLOR; /* computed ambient value sum */ |
63 |
< |
static unsigned int nambvals = 0; /* number of computed ambient values */ |
63 |
> |
static unsigned int nambvals = 0; /* total number of indirect values */ |
64 |
> |
static unsigned int nambshare = 0; /* number of values from file */ |
65 |
|
static unsigned long ambclock = 0; /* ambient access clock */ |
66 |
|
static unsigned long lastsort = 0; /* time of last value sort */ |
67 |
|
static long sortintvl = SORT_INTVL; /* time until next sort */ |
70 |
|
/* |
71 |
|
* Track access times unless we are sharing ambient values |
72 |
|
* through memory on a multiprocessor, when we want to avoid |
73 |
< |
* claiming our own memory (copy on write). |
73 |
> |
* claiming our own memory (copy on write). Go ahead anyway |
74 |
> |
* if more than two thirds of our values are unshared. |
75 |
|
*/ |
76 |
< |
#define tracktime (shm_boundary == NULL || ambfp == NULL) |
76 |
> |
#define tracktime (shm_boundary == NULL || nambvals > 3*nambshare) |
77 |
|
|
78 |
|
#define AMBFLUSH (BUFSIZ/AMBVALSIZ) |
79 |
|
|
145 |
|
avinsert(avstore(&amb)); |
146 |
|
/* align */ |
147 |
|
fseek(ambfp, -((ftell(ambfp)-headlen)%AMBVALSIZ), 1); |
148 |
+ |
nambshare = nambvals; |
149 |
|
} else if ((ambfp = fopen(afile, "w+")) != NULL) |
150 |
|
initambfile(1); |
151 |
|
else { |