Bug 1423000 - Count jemalloc_stats as an operation. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 30 Nov 2017 10:18:39 +0900
changeset 707237 316ab3e270ee8e14a4f9f3d4feacc6014738a6b4
parent 707236 d799dbcaa01f79f1491c5361d992bba64d94f293
child 707238 b17e3db7d060393b60677fda036788b1983ccf55
push id92052
push userbmo:mh+mozilla@glandium.org
push dateMon, 04 Dec 2017 23:34:17 +0000
reviewersnjn
bugs1423000
milestone59.0a1
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.
memory/replace/logalloc/replay/Replay.cpp
--- 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.