Unix Technical Forum

[Patch:] Remove of dead code for unused #define ALLOC_STATS in httpd

This is a discussion on [Patch:] Remove of dead code for unused #define ALLOC_STATS in httpd within the lucky.openbsd.tech forums, part of the OpenBSD category; --> Thanks for looking at this one. Much simpler and sure is useless as is anyway. May be this time ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > lucky.openbsd.tech

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-22-2008, 01:17 PM
Daniel Ouellet
 
Posts: n/a
Default [Patch:] Remove of dead code for unused #define ALLOC_STATS in httpd

Thanks for looking at this one.

Much simpler and sure is useless as is anyway.

May be this time around it will make it in.

Regards,

Daniel

++++++++++++++++++++++++++++++

Index: alloc.c
================================================== =================
RCS file: /cvs/src/usr.sbin/httpd/src/main/alloc.c,v
retrieving revision 1.15
diff -u -r1.15 alloc.c
--- alloc.c 9 Feb 2005 12:13:09 -0000 1.15
+++ alloc.c 2 Apr 2006 08:47:12 -0000
@@ -114,11 +114,6 @@
*/
/* #define MAKE_TABLE_PROFILE */

-/* Provide some statistics on the cost of allocations. It requires a
- * bit of an understanding of how alloc.c works.
- */
-/* #define ALLOC_STATS */
-
#ifdef POOL_DEBUG
#ifdef ALLOC_USE_MALLOC
# error "sorry, no support for ALLOC_USE_MALLOC and POOL_DEBUG at the
same time"
@@ -183,13 +178,6 @@
static union block_hdr *global_block_list;
#define FREE_POOL ((struct pool *)(-1))
#endif
-#ifdef ALLOC_STATS
-static unsigned long long num_free_blocks_calls;
-static unsigned long long num_blocks_freed;
-static unsigned max_blocks_in_one_free;
-static unsigned num_malloc_calls;
-static unsigned num_malloc_bytes;
-#endif

#ifdef ALLOC_DEBUG
#define FILL_BYTE ((char)(0xa5))
@@ -232,10 +220,6 @@
*/
size += CLICK_SZ;
#endif
-#ifdef ALLOC_STATS
- ++num_malloc_calls;
- num_malloc_bytes += size + sizeof(union block_hdr);
-#endif
request_size = size + sizeof(union block_hdr);
#if defined(EAPI_MM)
if (is_shm)
@@ -299,9 +283,6 @@
free(blok);
}
#else
-#ifdef ALLOC_STATS
- unsigned num_blocks;
-#endif
/* First, put new blocks at the head of the free list ---
* we'll eventually bash the 'next' pointer of the last block
* in the chain to point to the free blocks we already had.
@@ -326,13 +307,7 @@
* now.
*/

-#ifdef ALLOC_STATS
- num_blocks = 1;
-#endif
while (blok->h.next != NULL) {
-#ifdef ALLOC_STATS
- ++num_blocks;
-#endif
chk_on_blk_list(blok, old_free_list);
blok->h.first_avail = (char *) (blok + 1);
debug_fill(blok->h.first_avail, blok->h.endp - blok->h.first_avail);
@@ -353,14 +328,6 @@

blok->h.next = old_free_list;

-#ifdef ALLOC_STATS
- if (num_blocks > max_blocks_in_one_free) {
- max_blocks_in_one_free = num_blocks;
- }
- ++num_free_blocks_calls;
- num_blocks_freed += num_blocks;
-#endif
-
(void) ap_release_mutex(alloc_mutex);
#if defined(EAPI_MM)
if (blok->h.is_shm)
@@ -569,20 +536,6 @@
return ap_mm_useable();
}

-#ifdef ALLOC_STATS
-static void dump_stats(void)
-{
- fprintf(stderr,
- "alloc_stats: [%d] #free_blocks %llu #blocks %llu max %u #malloc %u
#bytes %u\n",
- (int)getpid(),
- num_free_blocks_calls,
- num_blocks_freed,
- max_blocks_in_one_free,
- num_malloc_calls,
- num_malloc_bytes);
-}
-#endif
-
API_EXPORT(pool *) ap_init_alloc(void)
{
#ifdef POOL_DEBUG
@@ -594,9 +547,6 @@
alloc_mutex = ap_create_mutex(NULL);
spawn_mutex = ap_create_mutex(NULL);
permanent_pool = ap_make_sub_pool(NULL);
-#ifdef ALLOC_STATS
- atexit(dump_stats);
-#endif

return permanent_pool;
}

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:34 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com