Bug 1423000 - Count jemalloc_stats as an operation. r?njn
While jemalloc_stats is not actively doing anything, it can be
cumbersome to not have it count as an operation, because the operation
count shown on jemalloc_stats doesn't match the line number in the input
replay log, and the offset grows as the number of jemalloc_stats
operations grows.
While here, also update a comment about the replay log format.
--- a/memory/replace/logalloc/replay/Replay.cpp
+++ b/memory/replace/logalloc/replay/Replay.cpp
@@ -416,16 +416,17 @@ public:
aSlot.mPtr = ::valloc_impl(size);
}
void jemalloc_stats(Buffer& aArgs)
{
if (aArgs) {
die("Malformed input");
}
+ mOps++;
jemalloc_stats_t stats;
::jemalloc_stats(&stats);
FdPrintf(mStdErr,
"#%zu mapped: %zu; allocated: %zu; waste: %zu; dirty: %zu; "
"bookkeep: %zu; binunused: %zu\n", mOps, stats.mapped,
stats.allocated, stats.waste, stats.page_cache,
stats.bookkeeping, stats.bin_unused);
/* TODO: Add more data, like actual RSS as measured by OS, but compensated
@@ -443,17 +444,17 @@ int
main()
{
size_t first_pid = 0;
FdReader reader(0);
Replay replay;
/* Read log from stdin and dispatch function calls to the Replay instance.
* The log format is essentially:
- * <pid> <function>([<args>])[=<result>]
+ * <pid> <tid> <function>([<args>])[=<result>]
* <args> is a comma separated list of arguments.
*
* The logs are expected to be preprocessed so that allocations are
* attributed a tracking slot. The input is trusted not to have crazy
* values for these slot numbers.
*
* <result>, as well as some of the args to some of the function calls are
* such slot numbers.