summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Norbye <Trond.Norbye@sun.com>2009-01-28 10:49:35 +0100
committerDustin Sallings <dustin@spy.net>2009-01-29 13:41:02 -0800
commitd675caba17f30709adcc7d0b1e44edfbd1619c1a (patch)
tree43288323ece206a8dacb5efd8905cd5dd4683e10
parent74908abc795f896708764127be8879f7c48e0902 (diff)
downloadmemcached-d675caba17f30709adcc7d0b1e44edfbd1619c1a.tar.gz
Remove stats malloc and stats maps
-rw-r--r--configure.ac18
-rw-r--r--memcached.c49
-rw-r--r--slabs.c93
3 files changed, 0 insertions, 160 deletions
diff --git a/configure.ac b/configure.ac
index 6e6ed70..bfe0243 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,24 +143,6 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
AC_HEADER_STDBOOL
AC_C_CONST
-# We don't want to enable mallinfo on Solaris, because that will enable
-# libmalloc and from the manpage: These routines are space-efficient but
-# have lower performance. Their usage can result in serious performance
-# degradation.
-case "$target_os" in
- *solaris*)
- ;;
- *)
- AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?]))
- AC_CHECK_MEMBER([struct mallinfo.arena], [
- AC_DEFINE(HAVE_STRUCT_MALLINFO,,[do we have stuct mallinfo?])
- ], ,[
-#include <malloc.h>
- ])
- AC_SEARCH_LIBS(mallinfo, malloc)
- ;;
-esac
-
dnl From licq: Copyright (c) 2000 Dirk Mueller
dnl Check if the type socklen_t is defined anywhere
AC_DEFUN([AC_C_SOCKLEN_T],
diff --git a/memcached.c b/memcached.c
index 2dbdb4f..18f2419 100644
--- a/memcached.c
+++ b/memcached.c
@@ -2260,55 +2260,6 @@ static void process_stat(conn *c, token_t *tokens, const size_t ntokens) {
return;
}
-#ifdef HAVE_MALLOC_H
-#ifdef HAVE_STRUCT_MALLINFO
- if (strcmp(subcommand, "malloc") == 0) {
- int len = 0;
- char *buf = get_stats("malloc", strlen("malloc"),
- &append_ascii_stats, (void *)c, &len);
- write_and_free(c, buf, len);
- return;
- }
-#endif /* HAVE_STRUCT_MALLINFO */
-#endif /* HAVE_MALLOC_H */
-
-#if !defined(WIN32) || !defined(__APPLE__)
- if (strcmp(subcommand, "maps") == 0) {
- char *wbuf;
- int wsize = 8192; /* should be enough */
- int fd;
- int res;
-
- if ((wbuf = (char *)malloc(wsize)) == NULL) {
- out_string(c, "SERVER_ERROR out of memory writing stats maps");
- return;
- }
-
- fd = open("/proc/self/maps", O_RDONLY);
- if (fd == -1) {
- out_string(c, "SERVER_ERROR cannot open the maps file");
- free(wbuf);
- return;
- }
-
- res = read(fd, wbuf, wsize - 6); /* 6 = END\r\n\0 */
- if (res == wsize - 6) {
- out_string(c, "SERVER_ERROR buffer overflow");
- free(wbuf); close(fd);
- return;
- }
- if (res == 0 || res == -1) {
- out_string(c, "SERVER_ERROR can't read the maps file");
- free(wbuf); close(fd);
- return;
- }
- memcpy(wbuf + res, "END\r\n", 5);
- write_and_free(c, wbuf, res + 5);
- close(fd);
- return;
- }
-#endif
-
/* NOTE: how to tackle detail with binary? */
if (strcmp(subcommand, "detail") == 0) {
if (ntokens < 4)
diff --git a/slabs.c b/slabs.c
index 6a7b706..c3c480b 100644
--- a/slabs.c
+++ b/slabs.c
@@ -22,13 +22,6 @@
#include <string.h>
#include <assert.h>
-#ifdef HAVE_MALLOC_H
-/* OpenBSD has a malloc.h, but warns to use stdlib.h instead */
-#ifndef __OpenBSD__
-#include <malloc.h>
-#endif
-#endif
-
#define POWER_SMALLEST 1
#define POWER_LARGEST 200
#define POWER_BLOCK 1048576
@@ -370,92 +363,6 @@ char *get_stats(const char *stat_type, int nkey,
return buf;
}
-#ifdef HAVE_MALLOC_H
-#ifdef HAVE_STRUCT_MALLINFO
- else if (strcmp(stat_type, "malloc") == 0) {
- buf = malloc(1024);
- char *pos = buf;
- struct mallinfo info;
- uint32_t linelen = 0;
-
- if (buf == NULL) {
- *buflen = -1;
- return NULL;
- }
-
- info = mallinfo();
-
- char val[128];
- uint32_t nbytes = 0;
-
- vlen = sprintf(val, "%ld", (long)info.arena);
- nbytes = add_stats(pos, "arena_size", strlen("arena_size"), val,
- vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- vlen = sprintf(val, "%ld", (long)info.ordblks);
- nbytes = add_stats(pos, "free_chunks", strlen("free_chunks"), val,
- vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- vlen = sprintf(val, "%ld", (long)info.smblks);
- nbytes = add_stats(pos, "fastbin_blocks", strlen("fastbin_blocks"),
- val, vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- vlen = sprintf(val, "%ld", (long)info.hblks);
- nbytes = add_stats(pos, "mmapped_regions", strlen("mmapped_regions"),
- val, vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- vlen = sprintf(val, "%ld", (long)info.hblkhd);
- nbytes = add_stats(pos, "mmapped_space", strlen("mmapped_space"),
- val, vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- vlen = sprintf(val, "%ld", (long)info.usmblks);
- nbytes = add_stats(pos, "max_total_alloc", strlen("max_total_alloc"),
- val, vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- vlen = sprintf(val, "%ld", (long)info.fsmblks);
- nbytes = add_stats(pos, "fastbin_space", strlen("fastbin_space"),
- val, vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- vlen = sprintf(val, "%ld", (long)info.uordblks);
- nbytes = add_stats(pos, "total_alloc", strlen("total_alloc"), val,
- vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- vlen = sprintf(val, "%ld", (long)info.fordblks);
- nbytes = add_stats(pos, "total_free", strlen("total_free"), val,
- vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- vlen = sprintf(val, "%ld", (long)info.keepcost);
- nbytes = add_stats(pos, "releasable_space", strlen("releasable_space"),
- val, vlen, c);
- linelen += nbytes;
- pos += nbytes;
-
- linelen += add_stats(pos, NULL, 0, NULL, 0, c);
- *buflen = linelen;
-
- return buf;
- }
-#endif /* HAVE_STRUCT_MALLINFO */
-#endif /* HAVE_MALLOC_H */
-
return NULL;
}