*** ./src/map.h.ORIG Fri Jan 21 14:42:56 2011 --- ./src/map.h Fri Jan 21 14:43:06 2011 *************** *** 27,33 **** time_t time; }; ! struct hash_struct *tab; int size; OAHash *tab_hash; --- 27,33 ---- time_t time; }; ! struct hash_struct *AIXtab; int size; OAHash *tab_hash; *** ./src/map.cc.ORIG Fri Jan 21 14:43:01 2011 --- ./src/map.cc Fri Jan 21 16:39:32 2011 *************** *** 9,15 **** { size = passed_size; ! tab = (struct hash_struct *)malloc(size * sizeof(struct hash_struct)); /* initialise map to be empty */ this->empty(0, size); --- 9,15 ---- { size = passed_size; ! AIXtab = (struct hash_struct *)malloc(size * sizeof(struct hash_struct)); /* initialise map to be empty */ this->empty(0, size); *************** *** 26,32 **** int x; struct hash_struct *ptr; ! for(ptr = &tab[from], x = from; x < to; ++ptr, ++x) { ptr->refcount = 0; ptr->pos = x; --- 26,32 ---- int x; struct hash_struct *ptr; ! for(ptr = &AIXtab[from], x = from; x < to; ++ptr, ++x) { ptr->refcount = 0; ptr->pos = x; *************** *** 39,45 **** int map::destroy(void) { ! free(tab); tab_hash->destroy(); delete tab_hash; --- 39,45 ---- int map::destroy(void) { ! free(AIXtab); tab_hash->destroy(); delete tab_hash; *************** *** 57,63 **** * quite expensive, so we'd like to do this as infrequently as * possible */ newtab = (struct hash_struct *) ! realloc(tab, newsize * sizeof(struct hash_struct)); /* did it work? */ if (!newtab) --- 57,63 ---- * quite expensive, so we'd like to do this as infrequently as * possible */ newtab = (struct hash_struct *) ! realloc(AIXtab, newsize * sizeof(struct hash_struct)); /* did it work? */ if (!newtab) *************** *** 66,72 **** exit(1); } ! tab = newtab; /* empty the new area */ this->empty(size, newsize); --- 66,72 ---- exit(1); } ! AIXtab = newtab; /* empty the new area */ this->empty(size, newsize); *************** *** 77,83 **** tab_hash->create(newsize*9); for (x = 0 ; x < size ; ++x) { ! tab_hash->insert(tab[x].string, &tab[x]); } // dprintf("%p resize from %d to %d\n", this, size, newsize); --- 77,83 ---- tab_hash->create(newsize*9); for (x = 0 ; x < size ; ++x) { ! tab_hash->insert(AIXtab[x].string, &AIXtab[x]); } // dprintf("%p resize from %d to %d\n", this, size, newsize); *************** *** 97,110 **** { /* we wanted to insert, but didn't, so the refcount for this * particular entry is incremented */ ! tab[x].refcount++; // dprintf("%d Found %p %d for %s\n", time(NULL), this, x, string); return x; } /* find free table slot FIXME make this more efficient */ ! for (ptr = &tab[0], x = 0; x <= size; ++ptr, ++x) { if (x == size) { --- 97,110 ---- { /* we wanted to insert, but didn't, so the refcount for this * particular entry is incremented */ ! AIXtab[x].refcount++; // dprintf("%d Found %p %d for %s\n", time(NULL), this, x, string); return x; } /* find free table slot FIXME make this more efficient */ ! for (ptr = &AIXtab[0], x = 0; x <= size; ++ptr, ++x) { if (x == size) { *************** *** 113,119 **** /* realloc may well move the table in * memory so update the pointer */ ! ptr = &tab[x]; break; } --- 113,119 ---- /* realloc may well move the table in * memory so update the pointer */ ! ptr = &AIXtab[x]; break; } *************** *** 183,189 **** char *map::reverse(int pos) { /* return pointer to char for this string pos */ ! return tab[pos].string; } void map::sub_ref(int pos) --- 183,189 ---- char *map::reverse(int pos) { /* return pointer to char for this string pos */ ! return AIXtab[pos].string; } void map::sub_ref(int pos) *************** *** 191,197 **** // dprintf("%d subref %p %d for %s\n", // time(NULL), this, pos, tab[pos].string); ! if (tab[pos].refcount > 0) ! tab[pos].refcount--; } --- 191,197 ---- // dprintf("%d subref %p %d for %s\n", // time(NULL), this, pos, tab[pos].string); ! if (AIXtab[pos].refcount > 0) ! AIXtab[pos].refcount--; } *** ./src/timed_circle.h.ORIG Fri Jan 21 14:44:07 2011 --- ./src/timed_circle.h Fri Jan 21 14:44:27 2011 *************** *** 48,54 **** unsigned int hitpos; /* how far along hits array we are */ HIT *hits; /* hits for this second go into array */ ! } *tab; /* for walk() */ unsigned int walk_bucketpos; --- 48,54 ---- unsigned int hitpos; /* how far along hits array we are */ HIT *hits; /* hits for this second go into array */ ! } *AIXtab; /* for walk() */ unsigned int walk_bucketpos; *** ./src/apachetop.cc.ORIG Fri Jan 21 16:14:50 2011 --- ./src/apachetop.cc Fri Jan 21 16:22:55 2011 *************** *** 1109,1115 **** --- 1109,1120 ---- if ( !strlen( fileName ) ) { strcpy( fileName, "/tmp/atop.XXXXXX" ); + #ifdef _AIX + mktemp( fileName ); + mkdir( fileName, 0700 ); + #else mkdtemp( fileName ); + #endif strncat( fileName, "/debug", sizeof(fileName ) ); } *** ./src/apachetop.h.ORIG Fri Jan 21 16:34:33 2011 --- ./src/apachetop.h Fri Jan 21 16:35:19 2011 *************** *** 56,62 **** --- 56,66 ---- # include "pcre_cpp_wrapper.h" #endif + #ifdef _AIX + #include + #else #include + #endif #include #include *** ./src/hits_circle.cc.ORIG Fri Jan 21 16:35:34 2011 --- ./src/hits_circle.cc Fri Jan 21 16:36:17 2011 *************** *** 16,24 **** pos = 0; walkpos = 0; ! tab = (circle_struct *) calloc(size, sizeof( circle_struct)); ! if (!tab) { abort(); } --- 16,24 ---- pos = 0; walkpos = 0; ! AIXtab = (circle_struct *) calloc(size, sizeof( circle_struct)); ! if (!AIXtab) { abort(); } *************** *** 36,42 **** /* insert the given data into the current position, * and update pos to point at next position */ ! posptr = &tab[pos]; if (posptr->time == 0) /* if this is a new insert, increment our count */ --- 36,42 ---- /* insert the given data into the current position, * and update pos to point at next position */ ! posptr = &AIXtab[pos]; if (posptr->time == 0) /* if this is a new insert, increment our count */ *************** *** 91,103 **** *lb = NULL; ! if (walkpos == size || tab[walkpos].time == 0) { walkpos = 0; return -1; } ! *lb = &tab[walkpos]; ++walkpos; return 0; --- 91,103 ---- *lb = NULL; ! if (walkpos == size || AIXtab[walkpos].time == 0) { walkpos = 0; return -1; } ! *lb = &AIXtab[walkpos]; ++walkpos; return 0; *************** *** 115,123 **** else tmp = pos + 1; /* earliest is next element */ ! if (tab[tmp].time > 0) ! return tab[tmp].time; ! return tab[0].time; } --- 115,123 ---- else tmp = pos + 1; /* earliest is next element */ ! if (AIXtab[tmp].time > 0) ! return AIXtab[tmp].time; ! return AIXtab[0].time; } *** ./src/timed_circle.cc.ORIG Fri Jan 21 16:36:29 2011 --- ./src/timed_circle.cc Fri Jan 21 16:37:33 2011 *************** *** 25,34 **** size++; /* malloc the buckets */ ! tab = (struct timed_circle_struct *) malloc(size * sizeof(struct timed_circle_struct)); ! if (tab == NULL) return -1; this->initbuckets(0, size); --- 25,34 ---- size++; /* malloc the buckets */ ! AIXtab = (struct timed_circle_struct *) malloc(size * sizeof(struct timed_circle_struct)); ! if (AIXtab == NULL) return -1; this->initbuckets(0, size); *************** *** 47,53 **** struct timed_circle_struct *ptr; /* clear some values to 0 */ ! for(x = from, ptr = &tab[x] ; x < to; ++x, ++ptr) { /* set up hits array for this bucket */ --- 47,53 ---- struct timed_circle_struct *ptr; /* clear some values to 0 */ ! for(x = from, ptr = &AIXtab[x] ; x < to; ++x, ++ptr) { /* set up hits array for this bucket */ *************** *** 70,76 **** struct timed_circle_struct *bucket; //dprintf("resetting bucket stats %d\n", r); ! bucket = &tab[r]; /* reset statistics for this bucket */ bucket->time = now; --- 70,76 ---- struct timed_circle_struct *bucket; //dprintf("resetting bucket stats %d\n", r); ! bucket = &AIXtab[r]; /* reset statistics for this bucket */ bucket->time = now; *************** *** 113,119 **** this->garbagecollection(); /* for the relevant bucket for this second.. */ ! bucket = &tab[bucketpos]; /* see if we have a free slot */ if (bucket->hitpos == bucket->hitsize) --- 113,119 ---- this->garbagecollection(); /* for the relevant bucket for this second.. */ ! bucket = &AIXtab[bucketpos]; /* see if we have a free slot */ if (bucket->hitpos == bucket->hitsize) *************** *** 171,177 **** //dprintf("entering walk at bucket %d, hit %d\n", walk_bucketpos, walk_hitpos); /* see if we're at the end of this bucket */ ! bucket = &tab[walk_bucketpos]; if (walk_hitpos == bucket->hitpos) { //dprintf("end of bucket %d\n", walk_bucketpos); --- 171,177 ---- //dprintf("entering walk at bucket %d, hit %d\n", walk_bucketpos, walk_hitpos); /* see if we're at the end of this bucket */ ! bucket = &AIXtab[walk_bucketpos]; if (walk_hitpos == bucket->hitpos) { //dprintf("end of bucket %d\n", walk_bucketpos); *************** *** 190,196 **** return -1; } ! bucket = &tab[walk_bucketpos]; /* anything in this bucket? */ while (walk_bucketpos < MAX_BUCKET && bucket->hitpos == 0) --- 190,196 ---- return -1; } ! bucket = &AIXtab[walk_bucketpos]; /* anything in this bucket? */ while (walk_bucketpos < MAX_BUCKET && bucket->hitpos == 0) *************** *** 199,205 **** /* try the next one */ ++walk_bucketpos; walk_hitpos = 0; ! bucket = &tab[walk_bucketpos]; //dprintf("skipped to bucket %d\n", walk_bucketpos); /* see if we're out of buckets; --- 199,205 ---- /* try the next one */ ++walk_bucketpos; walk_hitpos = 0; ! bucket = &AIXtab[walk_bucketpos]; //dprintf("skipped to bucket %d\n", walk_bucketpos); /* see if we're out of buckets; *************** *** 232,238 **** reqcount = 0; bytecount = 0; rc_summary[2] = rc_summary[3] = rc_summary[4] = rc_summary[5] = 0; ! for(x = 0, bucket = &tab[0] ; x < bucketsize ; ++x, ++bucket) { reqcount += bucket->reqcount; bytecount += bucket->bytecount; --- 232,238 ---- reqcount = 0; bytecount = 0; rc_summary[2] = rc_summary[3] = rc_summary[4] = rc_summary[5] = 0; ! for(x = 0, bucket = &AIXtab[0] ; x < bucketsize ; ++x, ++bucket) { reqcount += bucket->reqcount; bytecount += bucket->bytecount; *************** *** 254,260 **** * need to empty them here. */ ! if (tab[bucketpos].time < now) { prevbucket = bucketpos; bucketpos = (now - gstats.start) % bucketsize; --- 254,260 ---- * need to empty them here. */ ! if (AIXtab[bucketpos].time < now) { prevbucket = bucketpos; bucketpos = (now - gstats.start) % bucketsize; *************** *** 292,298 **** struct timed_circle_struct *ptr; /* this may take up some considerable time with a large circle? */ ! for(x = 0, ptr = &tab[0] ; x < MAX_BUCKET ; ++x, ++ptr) t = getMIN(ptr->time, t); return t; --- 292,298 ---- struct timed_circle_struct *ptr; /* this may take up some considerable time with a large circle? */ ! for(x = 0, ptr = &AIXtab[0] ; x < MAX_BUCKET ; ++x, ++ptr) t = getMIN(ptr->time, t); return t; *** ./configure.ORIG Fri Jan 21 16:37:51 2011 --- ./configure Fri Jan 21 16:38:01 2011 *************** *** 4273,4279 **** esac ! $as_echo "#define malloc rpl_malloc" >>confdefs.h fi --- 4273,4279 ---- esac ! #$as_echo "#define malloc rpl_malloc" >>confdefs.h fi *** ./src/hits_circle.h.ORIG Wed Feb 16 16:28:48 2011 --- ./src/hits_circle.h Wed Feb 16 16:28:58 2011 *************** *** 22,28 **** double rc_summary[6]; typedef struct logbits circle_struct; ! circle_struct *tab; int size; /* total size of circle table */ int pos; /* where are we now? */ --- 22,28 ---- double rc_summary[6]; typedef struct logbits circle_struct; ! circle_struct *AIXtab; int size; /* total size of circle table */ int pos; /* where are we now? */