Esempio n. 1
0
void
replace_jemalloc_stats(jemalloc_stats_t* aStats)
{
  AutoLock lock(sLock);
  sFuncs->jemalloc_stats(aStats);
  FdPrintf(sFd, "%zu %zu jemalloc_stats()\n", GetPid(), GetTid());
}
Esempio n. 2
0
void
replace_free(void* aPtr)
{
  AutoLock lock(sLock);
  if (aPtr) {
    FdPrintf(sFd, "%zu %zu free(%p)\n", GetPid(), GetTid(), aPtr);
  }
  sFuncs->free(aPtr);
}
Esempio n. 3
0
void*
replace_valloc(size_t aSize)
{
  AutoLock lock(sLock);
  void* ptr = sFuncs->valloc(aSize);
  if (ptr) {
    FdPrintf(sFd, "%zu %zu valloc(%zu)=%p\n", GetPid(), GetTid(), aSize, ptr);
  }
  return ptr;
}
Esempio n. 4
0
void*
replace_memalign(size_t aAlignment, size_t aSize)
{
  AutoLock lock(sLock);
  void* ptr = sFuncs->memalign(aAlignment, aSize);
  if (ptr) {
    FdPrintf(sFd, "%zu %zu memalign(%zu,%zu)=%p\n", GetPid(), GetTid(),
             aAlignment, aSize, ptr);
  }
  return ptr;
}
Esempio n. 5
0
void*
replace_realloc(void* aPtr, size_t aSize)
{
  AutoLock lock(sLock);
  void* new_ptr = sFuncs->realloc(aPtr, aSize);
  if (new_ptr || !aSize) {
    FdPrintf(sFd, "%zu %zu realloc(%p,%zu)=%p\n", GetPid(), GetTid(), aPtr,
             aSize, new_ptr);
  }
  return new_ptr;
}
Esempio n. 6
0
int
replace_posix_memalign(void** aPtr, size_t aAlignment, size_t aSize)
{
  AutoLock lock(sLock);
  int ret = sFuncs->posix_memalign(aPtr, aAlignment, aSize);
  if (ret == 0) {
    FdPrintf(sFd, "%zu %zu posix_memalign(%zu,%zu)=%p\n", GetPid(), GetTid(),
             aAlignment, aSize, *aPtr);
  }
  return ret;
}
Esempio n. 7
0
 void jemalloc_stats(Buffer& aArgs)
 {
   if (aArgs) {
     die("Malformed input");
   }
   jemalloc_stats_t stats;
   ::jemalloc_stats_impl(&stats);
   FdPrintf(2, "#%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
    * for the replay internal data. */
 }