#if HAVE_MSTATS && HAVE_GNUMALLOC_H
ms_bytes_total += stats.ms_bytes_total;
ms_bytes_free += stats.ms_bytes_free;
-#elif HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
- mp_arena += stats.mp_arena;
- mp_uordblks += stats.mp_uordblks;
- mp_ordblks += stats.mp_ordblks;
- mp_usmblks += stats.mp_usmblks;
- mp_smblks += stats.mp_smblks;
- mp_hblkhd += stats.mp_hblkhd;
- mp_hblks += stats.mp_hblks;
- mp_fsmblks += stats.mp_fsmblks;
- mp_fordblks += stats.mp_fordblks;
-#if HAVE_STRUCT_MALLINFO_MXFAST
- mp_mxfast += stats.mp_mxfast;
- mp_nlblks += stats.mp_nlblks;
- mp_grain += stats.mp_grain;
- mp_uordbytes += stats.mp_uordbytes;
- mp_allocated += stats.mp_allocated;
- mp_treeoverhead += stats.mp_treeoverhead;
-#endif /* HAVE_STRUCT_MALLINFO_MXFAST */
-#endif /* HAVE_MALLINFO && HAVE_STRUCT_MALLINFO */
- total_accounted += stats.total_accounted;
-#if !(HAVE_MSTATS && HAVE_GNUMALLOC_H) && HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
- mem_pool_allocated += stats.mem_pool_allocated;
#endif
+ total_accounted += stats.total_accounted;
gb_saved_count += stats.gb_saved_count;
gb_freed_count += stats.gb_freed_count;
max_fd += stats.max_fd;
double cputime;
double runtime;
#if HAVE_MSTATS && HAVE_GNUMALLOC_H
-
struct mstats ms;
-#elif HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
-
- struct mallinfo mp;
#endif
runtime = tvSubDsec(squid_start, current_time);
stats.ms_bytes_free = ms.bytes_free;
-#elif HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
-
- mp = mallinfo();
-
- stats.mp_arena = mp.arena;
-
- stats.mp_uordblks = mp.uordblks;
- stats.mp_ordblks = mp.ordblks;
-
- stats.mp_usmblks = mp.usmblks;
- stats.mp_smblks = mp.smblks;
-
- stats.mp_hblkhd = mp.hblkhd;
- stats.mp_hblks = mp.hblks;
-
- stats.mp_fsmblks = mp.fsmblks;
-
- stats.mp_fordblks = mp.fordblks;
-
-#if HAVE_STRUCT_MALLINFO_MXFAST
-
- stats.mp_mxfast = mp.mxfast;
-
- stats.mp_nlblks = mp.nlblks;
-
- stats.mp_grain = mp.grain;
-
- stats.mp_uordbytes = mp.uordbytes;
-
- stats.mp_allocated = mp.allocated;
-
- stats.mp_treeoverhead = mp.treeoverhead;
-
-#endif /* HAVE_STRUCT_MALLINFO_MXFAST */
-#endif /* HAVE_MALLINFO */
+#endif
stats.total_accounted = statMemoryAccounted();
{
MemPoolGlobalStats mp_stats;
memPoolGetGlobalStats(&mp_stats);
-#if !(HAVE_MSTATS && HAVE_GNUMALLOC_H) && HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
-
- stats.mem_pool_allocated = mp_stats.TheMeter->alloc.level;
-#endif
-
stats.gb_saved_count = mp_stats.TheMeter->gb_saved.count;
stats.gb_freed_count = mp_stats.TheMeter->gb_freed.count;
}
stats.ms_bytes_free / 1024,
Math::doublePercent(stats.ms_bytes_free, stats.ms_bytes_total));
-#elif HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
-
- storeAppendPrintf(sentry, "Memory usage for %s via mallinfo():\n",APP_SHORTNAME);
-
- storeAppendPrintf(sentry, "\tTotal space in arena: %6.0f KB\n",
- stats.mp_arena / 1024);
-
- storeAppendPrintf(sentry, "\tOrdinary blocks: %6.0f KB %6.0f blks\n",
- stats.mp_uordblks / 1024, stats.mp_ordblks);
-
- storeAppendPrintf(sentry, "\tSmall blocks: %6.0f KB %6.0f blks\n",
- stats.mp_usmblks / 1024, stats.mp_smblks);
-
- storeAppendPrintf(sentry, "\tHolding blocks: %6.0f KB %6.0f blks\n",
- stats.mp_hblkhd / 1024, stats.mp_hblks);
-
- storeAppendPrintf(sentry, "\tFree Small blocks: %6.0f KB\n",
- stats.mp_fsmblks / 1024);
-
- storeAppendPrintf(sentry, "\tFree Ordinary blocks: %6.0f KB\n",
- stats.mp_fordblks / 1024);
-
- double t = stats.mp_fsmblks + stats.mp_fordblks;
-
- storeAppendPrintf(sentry, "\tTotal in use: %6.0f KB %.0f%%\n",
- t / 1024, Math::doublePercent(t, stats.mp_arena + stats.mp_hblkhd));
-
- t = stats.mp_fsmblks + stats.mp_fordblks;
-
- storeAppendPrintf(sentry, "\tTotal free: %6.0f KB %.0f%%\n",
- t / 1024, Math::doublePercent(t, stats.mp_arena + stats.mp_hblkhd));
-
- t = stats.mp_arena + stats.mp_hblkhd;
-
- storeAppendPrintf(sentry, "\tTotal size: %6.0f KB\n",
- t / 1024);
-
-#if HAVE_STRUCT_MALLINFO_MXFAST
-
- storeAppendPrintf(sentry, "\tmax size of small blocks:\t%.0f\n", stats.mp_mxfast);
-
- storeAppendPrintf(sentry, "\tnumber of small blocks in a holding block:\t%.0f\n",
- stats.mp_nlblks);
-
- storeAppendPrintf(sentry, "\tsmall block rounding factor:\t%.0f\n", stats.mp_grain);
-
- storeAppendPrintf(sentry, "\tspace (including overhead) allocated in ord. blks:\t%.0f\n"
- ,stats.mp_uordbytes);
-
- storeAppendPrintf(sentry, "\tnumber of ordinary blocks allocated:\t%.0f\n",
- stats.mp_allocated);
-
- storeAppendPrintf(sentry, "\tbytes used in maintaining the free tree:\t%.0f\n",
- stats.mp_treeoverhead);
-
-#endif /* HAVE_STRUCT_MALLINFO_MXFAST */
-#endif /* HAVE_MALLINFO */
+#endif
storeAppendPrintf(sentry, "Memory accounted for:\n");
-
-#if !(HAVE_MSTATS && HAVE_GNUMALLOC_H) && HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
-
- storeAppendPrintf(sentry, "\tTotal accounted: %6.0f KB %3.0f%%\n",
- stats.total_accounted / 1024, Math::doublePercent(stats.total_accounted, t));
-
-#else
-
storeAppendPrintf(sentry, "\tTotal accounted: %6.0f KB\n",
stats.total_accounted / 1024);
-
-#endif
{
MemPoolGlobalStats mp_stats;
memPoolGetGlobalStats(&mp_stats);
-#if !(HAVE_MSTATS && HAVE_GNUMALLOC_H) && HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
-
- storeAppendPrintf(sentry, "\tmemPool accounted: %6.0f KB %3.0f%%\n",
- stats.mem_pool_allocated / 1024,
- Math::doublePercent(stats.mem_pool_allocated, t));
-
- const double iFree = max(0.0, t - stats.mem_pool_allocated);
- storeAppendPrintf(sentry, "\tmemPool unaccounted: %6.0f KB %3.0f%%\n",
- (t - stats.mem_pool_allocated) / 1024,
- Math::doublePercent(iFree, t));
-#endif
-
storeAppendPrintf(sentry, "\tmemPoolAlloc calls: %9.0f\n",
stats.gb_saved_count);
storeAppendPrintf(sentry, "\tmemPoolFree calls: %9.0f\n",
#if HAVE_MSTATS && HAVE_GNUMALLOC_H
struct mstats ms = mstats();
i = ms.bytes_total;
-#elif HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
- struct mallinfo mp = mallinfo();
- i = mp.arena;
#endif
if (Config.warnings.high_memory < i)
debugs(18, DBG_CRITICAL, "WARNING: Memory usage at " << ((unsigned long int)(i >> 20)) << " MB");
fprintf(debug_log, "\tTotal free: %6d KB %d%%\n",
(int) (ms.bytes_free >> 10),
Math::intPercent(ms.bytes_free, ms.bytes_total));
-#elif HAVE_MALLINFO && HAVE_STRUCT_MALLINFO
-
- struct mallinfo mp;
- int t;
-
- if (!do_mallinfo)
- return;
-
- mp = mallinfo();
-
- fprintf(debug_log, "Memory usage for " APP_SHORTNAME " via mallinfo():\n");
-
- fprintf(debug_log, "\ttotal space in arena: %6ld KB\n",
- (long)mp.arena >> 10);
-
- fprintf(debug_log, "\tOrdinary blocks: %6ld KB %6ld blks\n",
- (long)mp.uordblks >> 10, (long)mp.ordblks);
-
- fprintf(debug_log, "\tSmall blocks: %6ld KB %6ld blks\n",
- (long)mp.usmblks >> 10, (long)mp.smblks);
-
- fprintf(debug_log, "\tHolding blocks: %6ld KB %6ld blks\n",
- (long)mp.hblkhd >> 10, (long)mp.hblks);
-
- fprintf(debug_log, "\tFree Small blocks: %6ld KB\n",
- (long)mp.fsmblks >> 10);
-
- fprintf(debug_log, "\tFree Ordinary blocks: %6ld KB\n",
- (long)mp.fordblks >> 10);
-
- t = mp.uordblks + mp.usmblks + mp.hblkhd;
-
- fprintf(debug_log, "\tTotal in use: %6d KB %d%%\n",
- t >> 10, Math::intPercent(t, mp.arena));
-
- t = mp.fsmblks + mp.fordblks;
-
- fprintf(debug_log, "\tTotal free: %6d KB %d%%\n",
- t >> 10, Math::intPercent(t, mp.arena));
-
-#if HAVE_STRUCT_MALLINFO_MXFAST
-
- fprintf(debug_log, "\tmax size of small blocks:\t%d\n",
- mp.mxfast);
-
- fprintf(debug_log, "\tnumber of small blocks in a holding block:\t%d\n",
- mp.nlblks);
-
- fprintf(debug_log, "\tsmall block rounding factor:\t%d\n",
- mp.grain);
-
- fprintf(debug_log, "\tspace (including overhead) allocated in ord. blks:\t%d\n",
- mp.uordbytes);
-
- fprintf(debug_log, "\tnumber of ordinary blocks allocated:\t%d\n",
- mp.allocated);
-
- fprintf(debug_log, "\tbytes used in maintaining the free tree:\t%d\n",
- mp.treeoverhead);
-
-#endif /* HAVE_STRUCT_MALLINFO_MXFAST */
-#endif /* HAVE_MALLINFO */
+#endif
}
void