Browse code

- fixed alloc optimize to small - nicer *malloc status

Andrei Pelinescu-Onciul authored on 15/02/2002 14:10:40
Showing 8 changed files
... ...
@@ -9,7 +9,7 @@
9 9
 VERSION = 0
10 10
 PATCHLEVEL = 8
11 11
 SUBLEVEL = 6
12
-EXTRAVERSION = 2
12
+EXTRAVERSION = -3
13 13
 
14 14
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
15 15
 OS = $(shell uname -s)
... ...
@@ -60,7 +60,7 @@ ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ )
60 60
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
61 61
 	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\
62 62
 	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
63
-	 -DUSE_SYNONIM #-DF_MALLOC \
63
+	 -DUSE_SYNONIM -DF_MALLOC \
64 64
 	 #-DEXTRA_DEBUG 
65 65
 	 #-DVQ_MALLOC  -DDBG_LOCK  #-DSTATS
66 66
 	 #-DDBG_QM_MALLOC #-DNO_DEBUG
... ...
@@ -73,11 +73,11 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
73 73
 
74 74
 # arh. specific definitions
75 75
 ifeq ($(ARCH), i386)
76
-#	DEFS+= -DFAST_LOCK
76
+	DEFS+= -DFAST_LOCK
77 77
 endif
78 78
 
79 79
 ifeq ($(ARCH), sparc64)
80
-#	DEFS+= -DFAST_LOCK
80
+	DEFS+= -DFAST_LOCK
81 81
 endif
82 82
 
83 83
 
... ...
@@ -94,7 +94,7 @@ static char flags[]=
94 94
 static char help_msg[]= "\
95 95
 Usage: " NAME " -l address [-l address] [options]\n\
96 96
 Options:\n\
97
-    -c		 Perform loop checks and compute branches\n\
97
+    -c           Perform loop checks and compute branches\n\
98 98
     -f file      Configuration file (default " CFG_FILE ")\n\
99 99
     -p port      Listen on the specified port (default: 5060)\n\
100 100
     -l address   Listen on the specified address (multiple -l mean\n\
... ...
@@ -257,11 +257,10 @@ void fm_status(struct fm_block* qm)
257 257
 			qm->used, qm->real_used, qm->size-qm->real_used);
258 258
 	LOG(L_INFO, " max used (+overhead)= %d\n", qm->max_real_used);
259 259
 #endif
260
-	
260
+	/*
261 261
 	LOG(L_INFO, "dumping all fragments:\n");
262 262
 	for (f=qm->first_frag, i=0;((char*)f<(char*)qm->last_frag) && (i<10);
263
-			f=FRAG_NEXT(f)
264
-			,i++){
263
+			f=FRAG_NEXT(f), i++){
265 264
 		LOG(L_INFO, "    %3d. %c  address=%x  size=%d\n", i, 
266 265
 				(f->u.reserved)?'a':'N',
267 266
 				(char*)f+sizeof(struct fm_frag), f->size);
... ...
@@ -270,10 +269,14 @@ void fm_status(struct fm_block* qm)
270 270
 				(f->u.is_free)?"freed":"alloc'd", f->file, f->func, f->line);
271 271
 #endif
272 272
 	}
273
+*/
273 274
 	LOG(L_INFO, "dumping free list:\n");
274 275
 	for(h=0,i=0;h<F_HASH_SIZE;h++){
275 276
 		
276
-		for (f=qm->free_hash[h],j=0; f; f=f->u.nxt_free, i++, j++){
277
+		for (f=qm->free_hash[h],j=0; f; f=f->u.nxt_free, i++, j++)
278
+			if (j) LOG(L_INFO, "hash= %3d. fragments no.: %5d\n", h, j);
279
+		/*
280
+		{
277 281
 			LOG(L_INFO, "   %5d.[%3d:%3d] %c  address=%x  size=%d(%x)\n",
278 282
 					i, h, j,
279 283
 					(f->u.reserved)?'a':'N',
... ...
@@ -283,7 +286,9 @@ void fm_status(struct fm_block* qm)
283 283
 				(f->u.reserved)?"freed":"alloc'd", f->file, f->func, f->line);
284 284
 #endif
285 285
 		}
286
+	*/
286 287
 	}
288
+	LOG(L_INFO, "	Total: %6d fragments\n", i);
287 289
 	LOG(L_INFO, "-----------------------------\n");
288 290
 }
289 291
 
... ...
@@ -16,7 +16,7 @@
16 16
 
17 17
 
18 18
 
19
-#define F_MALLOC_OPTIMIZE_FACTOR 10 /*used below */
19
+#define F_MALLOC_OPTIMIZE_FACTOR 11 /*used below */
20 20
 #define F_MALLOC_OPTIMIZE  (1<<F_MALLOC_OPTIMIZE_FACTOR)
21 21
 								/* size to optimize for,
22 22
 									(most allocs < this size),
... ...
@@ -417,7 +417,7 @@ void qm_status(struct qm_block* qm)
417 417
 		
418 418
 		for (f=qm->free_hash[h].head.u.nxt_free,j=0; 
419 419
 				f!=&(qm->free_hash[h].head); f=f->u.nxt_free, i++, j++);
420
-		if (j) LOG(L_INFO, "hash= %3d. fragments no.: %5d\n", h, j);
420
+			if (j) LOG(L_INFO, "hash= %3d. fragments no.: %5d\n", h, j);
421 421
 	}
422 422
 	LOG(L_INFO, "-----------------------------\n");
423 423
 }
... ...
@@ -18,7 +18,7 @@
18 18
 
19 19
 
20 20
 
21
-#define QM_MALLOC_OPTIMIZE_FACTOR 10 /*used below */
21
+#define QM_MALLOC_OPTIMIZE_FACTOR 11 /*used below */
22 22
 #define QM_MALLOC_OPTIMIZE  (1<<QM_MALLOC_OPTIMIZE_FACTOR)
23 23
 								/* size to optimize for,
24 24
 									(most allocs < this size),
... ...
@@ -39,7 +39,6 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
39 39
    struct lump          *lump_chain, *lump_tmp, **lump_anchor, **lump_anchor2;
40 40
    struct lump_rpl    *rpl_lump, **rpl_lump_anchor;
41 41
    char                       *p,*foo;
42
-   int k1=0,k2=0,k3=0,k4=0,k5=0,k6=0;
43 42
 
44 43
 
45 44
    /*computing the length of entire sip_msg structure*/
... ...
@@ -83,17 +82,17 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
83 83
    else
84 84
       lump_chain = org_msg->repl_add_rm;
85 85
    while (lump_chain)
86
-   {  k1++;
86
+   {  
87 87
       len += lump_len( lump_chain );
88 88
       lump_tmp = lump_chain->before;
89 89
       while ( lump_tmp )
90
-      {  k2++;
90
+      {  
91 91
          len += lump_len( lump_tmp );
92 92
          lump_tmp = lump_tmp->before;
93 93
       }
94 94
       lump_tmp = lump_chain->after;
95 95
       while ( lump_tmp )
96
-      {  k3++;
96
+      {  
97 97
          len += lump_len( lump_tmp );
98 98
          lump_tmp = lump_tmp->after;
99 99
       }
... ...
@@ -271,13 +270,13 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
271 271
       lump_anchor = &(new_msg->repl_add_rm);
272 272
    }
273 273
    while (lump_chain)
274
-   {  k4++;
274
+   {  
275 275
       lump_clone( (*lump_anchor) , lump_chain , p );
276 276
       /*before list*/
277 277
       lump_tmp = lump_chain->before;
278 278
       lump_anchor2 = &((*lump_anchor)->before);
279 279
       while ( lump_tmp )
280
-      {  k5++;
280
+      {  
281 281
          lump_clone( (*lump_anchor2) , lump_tmp , p );
282 282
          lump_anchor2 = &((*lump_anchor2)->before);
283 283
          lump_tmp = lump_tmp->before;
... ...
@@ -286,7 +285,7 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
286 286
       lump_tmp = lump_chain->after;
287 287
       lump_anchor2 = &((*lump_anchor)->after);
288 288
       while ( lump_tmp )
289
-      {  k6++;
289
+      {  
290 290
          lump_clone( (*lump_anchor2) , lump_tmp , p );
291 291
          lump_anchor2 = &((*lump_anchor2)->after);
292 292
          lump_tmp = lump_tmp->after;
... ...
@@ -308,8 +307,6 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
308 308
        (*rpl_lump_anchor)->next=0;
309 309
        rpl_lump_anchor = &((*rpl_lump_anchor)->next);
310 310
    }
311
-    DBG("DEBUG:cloner (  %d < %d,%d> )  ---  ( %d < %d , %d > )\n",
312
-       k1,k2,k3,k4,k5,k6);
313 311
     DBG("DEBUG:cloner --------<%d>---------<%d>-------------\n",len,p-foo);
314 312
    return new_msg;
315 313
 }
... ...
@@ -254,19 +254,18 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
254 254
 				goto error;
255 255
 			}
256 256
 			memset(to_b, 0, sizeof(struct to_body));
257
-			/*
258 257
 			hdr->body.s=tmp;
259 258
 			tmp=parse_to(tmp, end,to_b);
260 259
 			if (to_b->error==PARSE_ERROR){
261 260
 				LOG(L_ERR, "ERROR: get_hdr_field: bad to header\n");
262 261
 				pkg_free(to_b);
263 262
 				goto error;
264
-			}*/
265
-			hdr->parsed=to_b;/*
263
+			}
264
+			hdr->parsed=to_b;
266 265
 			hdr->body.len=tmp-hdr->body.s;
267 266
 			DBG("get_hdr_field: to <%s>: <%s>=[%d] <%c> [%d]\n",
268 267
 				hdr->name.s, to_b->body.s,to_b->body.len,*tmp,hdr->body.len);
269
-			break;*/
268
+			break;
270 269
 		case HDR_FROM:
271 270
 		case HDR_CALLID:
272 271
 		case HDR_CONTACT: