Ship script gates wave 4 behind AXP_DEBLOB_WAVE4, documents secrets cert path, and adds deblob appliers plus tests; docs capture Swissquote fix and parity. Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
#include <errno.h>
|
|
#include <malloc.h>
|
|
#include <sys/param.h>
|
|
#include <unistd.h>
|
|
|
|
#include <private/MallocXmlElem.h>
|
|
|
|
#include "h_malloc.h"
|
|
|
|
__BEGIN_DECLS
|
|
int h_malloc_info(int options, FILE* fp);
|
|
__END_DECLS
|
|
|
|
int h_malloc_info(int options, FILE* fp) {
|
|
if (options != 0) {
|
|
errno = EINVAL;
|
|
return -1;
|
|
}
|
|
|
|
fflush(fp);
|
|
int fd = fileno(fp);
|
|
MallocXmlElem root(fd, "malloc", "version=\"jemalloc-1\"");
|
|
|
|
// Dump all of the large allocations in the arenas.
|
|
for (size_t i = 0; i < h_mallinfo_narenas(); i++) {
|
|
struct mallinfo mi = h_mallinfo_arena_info(i);
|
|
if (mi.hblkhd != 0) {
|
|
MallocXmlElem arena_elem(fd, "heap", "nr=\"%d\"", i);
|
|
{
|
|
MallocXmlElem(fd, "allocated-large").Contents("%zu", mi.ordblks);
|
|
MallocXmlElem(fd, "allocated-huge").Contents("%zu", mi.uordblks);
|
|
MallocXmlElem(fd, "allocated-bins").Contents("%zu", mi.fsmblks);
|
|
|
|
size_t total = 0;
|
|
for (size_t j = 0; j < h_mallinfo_nbins(); j++) {
|
|
struct mallinfo mi = h_mallinfo_bin_info(i, j);
|
|
if (mi.ordblks != 0) {
|
|
MallocXmlElem bin_elem(fd, "bin", "nr=\"%d\"", j);
|
|
MallocXmlElem(fd, "allocated").Contents("%zu", mi.ordblks);
|
|
MallocXmlElem(fd, "nmalloc").Contents("%zu", mi.uordblks);
|
|
MallocXmlElem(fd, "ndalloc").Contents("%zu", mi.fordblks);
|
|
total += mi.ordblks;
|
|
}
|
|
}
|
|
MallocXmlElem(fd, "bins-total").Contents("%zu", total);
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|