buf->start_slack = start_slack;
buf->sbrked_remains = sbrked_remains;
MALLOC_UNLOCK;
+ buf->nbuckets = NBUCKETS;
if (level) {
for (i = MIN_BUCKET ; i < NBUCKETS; i++) {
if (i >= buflen)
Perl_dump_mstats(pTHX_ char *s)
{
#ifdef DEBUGGING_MSTATS
- register int i, j;
- register union overhead *p;
+ register int i;
perl_mstats_t buffer;
- unsigned long nf[NBUCKETS];
- unsigned long nt[NBUCKETS];
- struct chunk_chain_s* nextchain;
+ UV nf[NBUCKETS];
+ UV nt[NBUCKETS];
buffer.nfree = nf;
buffer.ntotal = nt;
if (s)
PerlIO_printf(Perl_error_log,
- "Memory allocation statistics %s (buckets %ld(%ld)..%ld(%ld)\n",
+ "Memory allocation statistics %s (buckets %"IVdf"(%"IVdf")..%"IVdf"(%"IVdf")\n",
s,
- (long)BUCKET_SIZE_REAL(MIN_BUCKET),
- (long)BUCKET_SIZE(MIN_BUCKET),
- (long)BUCKET_SIZE_REAL(buffer.topbucket),
- (long)BUCKET_SIZE(buffer.topbucket));
- PerlIO_printf(Perl_error_log, "%8ld free:", buffer.totfree);
+ (IV)BUCKET_SIZE_REAL(MIN_BUCKET),
+ (IV)BUCKET_SIZE(MIN_BUCKET),
+ (IV)BUCKET_SIZE_REAL(buffer.topbucket),
+ (IV)BUCKET_SIZE(buffer.topbucket));
+ PerlIO_printf(Perl_error_log, "%8"IVdf" free:", buffer.totfree);
for (i = MIN_EVEN_REPORT; i <= buffer.topbucket; i += BUCKETS_PER_POW2) {
PerlIO_printf(Perl_error_log,
((i < 8*BUCKETS_PER_POW2 || i == 10*BUCKETS_PER_POW2)
- ? " %5d"
- : ((i < 12*BUCKETS_PER_POW2) ? " %3d" : " %d")),
+ ? " %5"UVuf
+ : ((i < 12*BUCKETS_PER_POW2) ? " %3"UVuf : " %"UVuf)),
buffer.nfree[i]);
}
#ifdef BUCKETS_ROOT2
for (i = MIN_BUCKET + 1; i <= buffer.topbucket_odd; i += BUCKETS_PER_POW2) {
PerlIO_printf(Perl_error_log,
((i < 8*BUCKETS_PER_POW2 || i == 10*BUCKETS_PER_POW2)
- ? " %5d"
- : ((i < 12*BUCKETS_PER_POW2) ? " %3d" : " %d")),
+ ? " %5"UVuf
+ : ((i < 12*BUCKETS_PER_POW2) ? " %3"UVuf : " %"UVuf)),
buffer.nfree[i]);
}
#endif
- PerlIO_printf(Perl_error_log, "\n%8ld used:", buffer.total - buffer.totfree);
+ PerlIO_printf(Perl_error_log, "\n%8"IVdf" used:", buffer.total - buffer.totfree);
for (i = MIN_EVEN_REPORT; i <= buffer.topbucket; i += BUCKETS_PER_POW2) {
PerlIO_printf(Perl_error_log,
((i < 8*BUCKETS_PER_POW2 || i == 10*BUCKETS_PER_POW2)
- ? " %5d"
- : ((i < 12*BUCKETS_PER_POW2) ? " %3d" : " %d")),
+ ? " %5"IVdf
+ : ((i < 12*BUCKETS_PER_POW2) ? " %3"IVdf : " %"IVdf)),
buffer.ntotal[i] - buffer.nfree[i]);
}
#ifdef BUCKETS_ROOT2
for (i = MIN_BUCKET + 1; i <= buffer.topbucket_odd; i += BUCKETS_PER_POW2) {
PerlIO_printf(Perl_error_log,
((i < 8*BUCKETS_PER_POW2 || i == 10*BUCKETS_PER_POW2)
- ? " %5d"
- : ((i < 12*BUCKETS_PER_POW2) ? " %3d" : " %d")),
+ ? " %5"IVdf
+ : ((i < 12*BUCKETS_PER_POW2) ? " %3"IVdf : " %"IVdf)),
buffer.ntotal[i] - buffer.nfree[i]);
}
#endif
- PerlIO_printf(Perl_error_log, "\nTotal sbrk(): %ld/%ld:%ld. Odd ends: pad+heads+chain+tail: %ld+%ld+%ld+%ld.\n",
+ PerlIO_printf(Perl_error_log, "\nTotal sbrk(): %"IVdf"/%"IVdf":%"IVdf". Odd ends: pad+heads+chain+tail: %"IVdf"+%"IVdf"+%"IVdf"+%"IVdf".\n",
buffer.total_sbrk, buffer.sbrks, buffer.sbrk_good,
buffer.sbrk_slack, buffer.start_slack,
buffer.total_chain, buffer.sbrked_remains);
typedef struct perl_mstats perl_mstats_t;
-struct perl_mstats {
- unsigned long *nfree;
- unsigned long *ntotal;
- long topbucket, topbucket_ev, topbucket_odd, totfree, total, total_chain;
- long total_sbrk, sbrks, sbrk_good, sbrk_slack, start_slack, sbrked_remains;
- long minbucket;
- /* Level 1 info */
- unsigned long *bucket_mem_size;
- unsigned long *bucket_available_size;
-};
-
# define safemalloc Perl_malloc
# define safecalloc Perl_calloc
# define saferealloc Perl_realloc
#endif
+struct perl_mstats {
+ UV *nfree;
+ UV *ntotal;
+ IV topbucket, topbucket_ev, topbucket_odd, totfree, total, total_chain;
+ IV total_sbrk, sbrks, sbrk_good, sbrk_slack, start_slack, sbrked_remains;
+ IV minbucket;
+ /* Level 1 info */
+ UV *bucket_mem_size;
+ UV *bucket_available_size;
+ UV nbuckets;
+};
+
typedef MEM_SIZE STRLEN;
typedef struct op OP;