Diff for /libelwix/src/mem.c between versions 1.2 and 1.4.18.2

version 1.2, 2013/05/30 09:07:33 version 1.4.18.2, 2015/06/25 01:19:09
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013Copyright 2004 - 2015
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 407  mpool_free(mpool_t * __restrict mp, void * __restrict  Line 407  mpool_free(mpool_t * __restrict mp, void * __restrict 
         int idx;          int idx;
         struct tagAlloc *m, *tmp;          struct tagAlloc *m, *tmp;
   
        assert(data);        if (!data)
                 return 0;
         if (!mp) {          if (!mp) {
                 elwix_SetErr(EINVAL, "Pool not specified");                  elwix_SetErr(EINVAL, "Pool not specified");
                 return -1;                  return -1;
Line 733  mpool_xstrdup(const char *str) Line 734  mpool_xstrdup(const char *str)
 {  {
         return mpool_strdup(elwix_mpool, str, elwix_Prog);          return mpool_strdup(elwix_mpool, str, elwix_Prog);
 }  }
   
   /*
    * mpool_xstatistics() - elwix memory pool statistics wrapper
    *
    * @cb = Export statistics to callback
    * return: none
    */
   void
   mpool_xstatistics(mpool_stat_cb cb)
   {
           mpool_statistics(elwix_mpool, cb);
   }
   
   static void
   xdump_show(u_int size, u_int act, u_int inact)
   {
           if (!act && !inact)
                   return; /* skip empty bucket */
   
           if (size < 1024)
                   printf("\t\t* BUCKET %uB size, %u active, %u inactive\n", 
                                   size, act, inact);
           else if (size < 1048576)
                   printf("\t\t* BUCKET %uKB size, %u active, %u inactive\n", 
                                   size / 1024, act, inact);
           else
                   printf("\t\t* BUCKET %uMB size, %u active, %u inactive\n", 
                                   size / 1048576, act, inact);
   }
   
   /*
    * mpool_xdump() - Dump elwix memory pool statistics
    *
    * return: none
    */
   void
   mpool_xdump()
   {
           printf("\n%s(%d)\n------------------------------------------------------------\n", 
                           __func__, __LINE__);
           printf( " ELWIX memory pool ::\n"
                   "\t- quotas Current/Max = %lu/%lu\n"
                   "\t- calls Alloc/Free/Cache = %lu/%lu/%lu\n"
                   "\t- bytes Alloc/Free/Cache = %lu/%lu/%lu\n"
                   "\t- buckets :\n", 
                   elwix_mpool->pool_quota.curr, elwix_mpool->pool_quota.max, 
                   elwix_mpool->pool_calls.alloc, elwix_mpool->pool_calls.free, 
                   elwix_mpool->pool_calls.cache, elwix_mpool->pool_bytes.alloc, 
                   elwix_mpool->pool_bytes.free, elwix_mpool->pool_bytes.cache);
   
           mpool_statistics(elwix_mpool, xdump_show);
           printf("------------------------------------------------------------\n");
   }
   

Removed from v.1.2  
changed lines
  Added in v.1.4.18.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>