Make the maximum stats name length 48

If we have a maximum stats length then we won't have to worry
about deallocating the strdup'ed string the the calling function
for getting stats.

Change-Id: Ida263d314ebcab99e48386d7e86bcf74e06d067d
Reviewed-on: http://review.couchbase.org/14538
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Memcached now gets a fragmentation stat from tcmalloc

Change-Id: I6fbc59a2eb1f4f4894510c9ed38309212419be10
Reviewed-on: http://review.couchbase.org/14539
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Remove apis for getting allocator fragmentation and allocated bytes

These details can be obtained through the getAllocatorStats()
function and there's no point in having two ways to get them.

Change-Id: Ief9587bb6737bafcb933146e5521a32f0be8aab3
Reviewed-on: http://review.couchbase.org/14540
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Change the name of some tcmalloc stats

We plan on having the ability to be able to track allocations
with different allocator and as a result it doesn't make sense
to have a different set of stats names for specific stats
depending on which allocator is used. For example, every allocator
has keeps track of bytes allocated, the size of the heap, how many
free bytes it has, and how much fragmentation it has caused. These
stats should have more general names.

tcmalloc_allocated_bytes -> total_allocated_bytes
tcmalloc_heap_size       -> total_heap_size
tcmalloc_free_bytes      -> total_free_bytes

Change-Id: I87fd8945591bce20d6de58a25c265efd66e78800
Reviewed-on: http://review.couchbase.org/14541
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Updated allocator hooks stats api to have four default stats

This basically says says that any allocator that uses this api
must be able to at least tell us about how much memory has been
allocated, how much memory the process is using, how much memory
is free, and how much fragmentation there is. Anything extra can
be included as an allocator specific stat.

Change-Id: I6cda3240f49c8437b27eac776be2904056f73b34
Reviewed-on: http://review.couchbase.org/14561
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
Link tcmalloc as shared library

Change-Id: I2549df3baa7e9d904b581362a51ab240040bba5b
Reviewed-on: http://review.couchbase.org/14613
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
Revert "MB-4953 Retrieves a pseudo handle for the current process"

This reverts commit 1c1c4afba708004c160596f5f3aeea708fb609ed.

Change-Id: Iace39854d3b11d318d1fce026e63cc75a4fe1304
Reviewed-on: http://review.couchbase.org/14616
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
Explicitly specify tcmalloc dll to get function address

Since we don't support dlopen with NULL parameter, we need to
explicitly specify tcmalloc dll path.

Change-Id: Ib5876837dcf5e23844d747afb7efd66222c75c83
Reviewed-on: http://review.couchbase.org/14618
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
Explicitly specify tcmalloc dll to get function addresses

Also, use #ifdef instead of #ifndef to make it more straightforward.

Change-Id: Ib61fa60640051af55983e2cfb44e07fe3db460e1
Reviewed-on: http://review.couchbase.org/14637
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
Install tcmalloc under standard directory

It will be specified with ${PREFIX} such as /opt/couchbase. As such,
we don't need to explicitly specify tcmalloc directories for lib
and for include. Addtionally, tcmalloc dll file will be under bin
directory so that we don't need to copy it over here from a different
location.

Change-Id: I0fa021907ad1b62b4ac9f4931b34b3fdb6edef95
Reviewed-on: http://review.couchbase.org/14638
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
fix build error

Since we don't link with any libraries, we don't need to specify
TCMALLOC_LIB_FLAGS

Change-Id: I0803c89f4c46fa51c0cc52e8ccb3498f92287a36
Reviewed-on: http://review.couchbase.org/14707
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
mb-4983 Make sure tcmalloc dll is loaded as early as possible

It will reduce the opportunities that memory is out of tcmalloc
management.

Change-Id: I184e5bd588a19a11b7046f703af087fe1b84ea91
Reviewed-on: http://review.couchbase.org/14817
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>
Merge branch 'branch-181'

* branch-181:
  mb-4983 Make sure tcmalloc dll is loaded as early as possible
  fix build error
  Install tcmalloc under standard directory
  Explicitly specify tcmalloc dll to get function addresses
  Explicitly specify tcmalloc dll to get function address
  Revert "MB-4953 Retrieves a pseudo handle for the current process"
  Link tcmalloc as shared library
  Updated allocator hooks stats api to have four default stats
  Change the name of some tcmalloc stats
  Remove apis for getting allocator fragmentation and allocated bytes
  Memcached now gets a fragmentation stat from tcmalloc
  Make the maximum stats name length 48

Conflicts:
	daemon/memcached.c

Change-Id: I35988af682ab6658256b6790afd1f8e3aa6785a2
Merge "Merge branch 'branch-181'"