version 1.1.2.5, 2012/02/28 09:27:59
|
version 1.1.2.6, 2012/02/28 09:36:36
|
Line 2
|
Line 2
|
#include <aitsess.h> |
#include <aitsess.h> |
|
|
|
|
|
void show(u_int size, u_int act, u_int inact) |
|
{ |
|
if (!act && !inact) |
|
return; |
|
|
|
if (size < 1024) |
|
printf("Statistics:: BUCKET %uB size, %u active, %u inactive\n", size, act, inact); |
|
else if (size < 1024 * 1024) |
|
printf("Statistics:: BUCKET %uKB size, %u active, %u inactive\n", size / 1024, act, inact); |
|
else |
|
printf("Statistics:: BUCKET %uMB size, %u active, %u inactive\n", size / (1024 * 1024), act, inact); |
|
} |
|
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
Line 35 main(int argc, char **argv)
|
Line 48 main(int argc, char **argv)
|
// mpool_free(mp, addr, 0); |
// mpool_free(mp, addr, 0); |
} |
} |
|
|
|
printf("1)\n"); |
|
mpool_statistics(mp, show); |
|
|
mpool_free(mp, addr, 0); |
mpool_free(mp, addr, 0); |
|
|
|
printf("2)\n"); |
|
mpool_statistics(mp, show); |
|
|
mpool_purge(mp, 0); |
mpool_purge(mp, 0); |
|
|
|
printf("3)\n"); |
|
mpool_statistics(mp, show); |
|
|
addr = mpool_malloc(mp, 4000, "mdaaa 4000"); |
addr = mpool_malloc(mp, 4000, "mdaaa 4000"); |
if (!addr) { |
if (!addr) { |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
printf("Error:: #%d - %s\n", sess_GetErrno(), sess_GetError()); |
Line 48 main(int argc, char **argv)
|
Line 70 main(int argc, char **argv)
|
printf("addr=%p chkaddr=%d addr_size=%d\n", addr, mpool_chkaddr(addr), mpool_getsizebyaddr(addr)); |
printf("addr=%p chkaddr=%d addr_size=%d\n", addr, mpool_chkaddr(addr), mpool_getsizebyaddr(addr)); |
mpool_free(mp, addr, 0); |
mpool_free(mp, addr, 0); |
|
|
|
printf("Done.\n"); |
|
mpool_statistics(mp, show); |
mpool_destroy(&mp); |
mpool_destroy(&mp); |
return 0; |
return 0; |
} |
} |