Browse code

- minor gcc-3.0 makefile fixes - f_malloc status clean-up

Andrei Pelinescu-Onciul authored on 15/02/2002 17:02:34
Showing 5 changed files
... ...
@@ -9,7 +9,7 @@
9 9
 VERSION = 0
10 10
 PATCHLEVEL = 8
11 11
 SUBLEVEL = 6
12
-EXTRAVERSION = -3
12
+EXTRAVERSION = -4
13 13
 
14 14
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
15 15
 OS = $(shell uname -s)
... ...
@@ -101,7 +101,7 @@ ifeq ($(mode), release)
101 101
 			#-Wmissing-prototypes \
102 102
 	
103 103
 ifneq (,$(findstring 3.0, $(CC_VER)))
104
-	CFLAGS=-minline-all-stringops -malign-double \
104
+	CFLAGS+=-minline-all-stringops -malign-double \
105 105
 				-march=athlon \
106 106
 				#-mcpu=athlon
107 107
 endif
... ...
@@ -67,7 +67,7 @@ inline static void release_lock(fl_lock_t* lock)
67 67
 	asm volatile(
68 68
 		" movb $0, (%0)" : /*no output*/ : "r"(lock): "memory"
69 69
 		/*" xchg %b0, %1" : "=q" (val), "=m" (*lock) : "0" (val) : "memory"*/
70
-	); /* hmm, maybe lock; movb $0, [%1] would be faster ???*/
70
+	); 
71 71
 #elif defined __sparc
72 72
 	asm volatile(
73 73
 			"membar #LoadStore | #StoreStore \n\t" /*is this really needed?*/
... ...
@@ -329,7 +329,8 @@ int main_loop()
329 329
 						pids[i+1]=pid; /*should be in shared mem.*/
330 330
 				}
331 331
 			}
332
-			close(udp_sock); /*parent*/
332
+			/*parent*/
333
+			/*close(udp_sock)*/; /*if it's closed=>sendto invalid fd errors?*/
333 334
 		}
334 335
 	}
335 336
 	/*this is the main process*/
... ...
@@ -26,6 +26,11 @@
26 26
 						F_MALLOC_OPTIMIZE/ROUNDTO+big_hash_idx((s))- \
27 27
 							F_MALLOC_OPTIMIZE_FACTOR+1 )
28 28
 
29
+#define UN_HASH(h)	( ((h)<(F_MALLOC_OPTIMIZE/ROUNDTO))?(h)*ROUNDTO: \
30
+						1<<((h)-F_MALLOC_OPTIMIZE/ROUNDTO+\
31
+							F_MALLOC_OPTIMIZE_FACTOR-1)\
32
+					)
33
+
29 34
 
30 35
 /* computes hash number for big buckets*/
31 36
 inline static int big_hash_idx(int s)
... ...
@@ -247,6 +252,7 @@ void fm_status(struct fm_block* qm)
247 247
 	struct fm_frag* f;
248 248
 	int i,j;
249 249
 	int h;
250
+	int size;
250 251
 
251 252
 	LOG(L_INFO, "fm_status (%x):\n", qm);
252 253
 	if (!qm) return;
... ...
@@ -271,10 +277,15 @@ void fm_status(struct fm_block* qm)
271 271
 	}
272 272
 */
273 273
 	LOG(L_INFO, "dumping free list:\n");
274
-	for(h=0,i=0;h<F_HASH_SIZE;h++){
274
+	for(h=0,i=0,size=0;h<F_HASH_SIZE;h++){
275 275
 		
276
-		for (f=qm->free_hash[h],j=0; f; f=f->u.nxt_free, i++, j++)
277
-			if (j) LOG(L_INFO, "hash= %3d. fragments no.: %5d\n", h, j);
276
+		for (f=qm->free_hash[h],j=0; f; size+=f->size,f=f->u.nxt_free,i++,j++);
277
+		if (j) LOG(L_INFO, "hash = %3d fragments no.: %5d,\n\t\t"
278
+							" bucket size: %9d - %9d (first %9d)\n",
279
+							h, j, UN_HASH(h),
280
+							((h<F_MALLOC_OPTIMIZE/ROUNDTO)?1:2)*UN_HASH(h),
281
+							qm->free_hash[h]->size
282
+				);
278 283
 		/*
279 284
 		{
280 285
 			LOG(L_INFO, "   %5d.[%3d:%3d] %c  address=%x  size=%d(%x)\n",
... ...
@@ -288,7 +299,7 @@ void fm_status(struct fm_block* qm)
288 288
 		}
289 289
 	*/
290 290
 	}
291
-	LOG(L_INFO, "	Total: %6d fragments\n", i);
291
+	LOG(L_INFO, "TOTAL: %6d free fragments = %6d free bytes\n", i, size);
292 292
 	LOG(L_INFO, "-----------------------------\n");
293 293
 }
294 294
 
... ...
@@ -11,7 +11,7 @@
11 11
 debug=3          # debug level (cmd line: -dddddddddd)
12 12
 #fork=yes          # (cmd. line: -D)
13 13
 fork=yes
14
-fork=no
14
+#fork=no
15 15
 log_stderror=yes # (cmd line: -E)
16 16
 #log_stderror=no	# (cmd line: -E)
17 17