gecko-dev/memory/replace/dmd/DMD.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

292 строки
9.7 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef DMD_h___
#define DMD_h___
#include <string.h>
#include <stdarg.h>
#include "mozilla/DebugOnly.h"
#include "mozilla/Move.h"
#include "mozilla/Types.h"
#include "mozilla/UniquePtr.h"
#include "replace_malloc_bridge.h"
namespace mozilla {
class JSONWriteFunc;
namespace dmd {
struct Sizes {
size_t mStackTracesUsed;
size_t mStackTracesUnused;
size_t mStackTraceTable;
size_t mLiveBlockTable;
size_t mDeadBlockTable;
Sizes() { Clear(); }
void Clear() { memset(this, 0, sizeof(Sizes)); }
};
// See further below for a description of each method. The DMDFuncs class
// should contain a virtual method for each of them (except IsRunning,
// which can be inferred from the DMDFuncs singleton existing).
struct DMDFuncs {
virtual void Report(const void*);
virtual void ReportOnAlloc(const void*);
virtual void ClearReports();
virtual void Analyze(UniquePtr<JSONWriteFunc>);
virtual void SizeOf(Sizes*);
virtual void StatusMsg(const char*, va_list) MOZ_FORMAT_PRINTF(2, 0);
Bug 1094552 (part 5) - DMD: choose the profiling mode at start-up. r=mccr8. This patch moves profiling mode selection from post-processing (in dmd.py) to DMD start-up. This will make it easier to add new kinds of profiling, such as cumulative heap profiling. Specifically: - There's a new --mode option. |LiveWithReports| is the default, as it is currently. - dmd.py's --ignore-reports option is gone. - There's a new |mode| field in the JSON output. - Reports-related operations are now no-ops if DMD isn't in LiveWithReports mode. - Diffs are only allowed for output files that have the same mode. - A new function ResetEverything() replaces the SetSampleBelowSize() and ClearBlocks(), which were used by the test to change DMD options. - The tests in SmokeDMD.cpp are split up so they can be run multiple times, in different modes. The exact combinations of tests and modes has been changed a bit. --HG-- rename : memory/replace/dmd/test/full-reports-empty-expected.txt => memory/replace/dmd/test/full-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-empty-expected.txt => memory/replace/dmd/test/full-empty-live-expected.txt rename : memory/replace/dmd/test/full-heap-sampled-expected.txt => memory/replace/dmd/test/full-sampled-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled2-expected.txt => memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt rename : memory/replace/dmd/test/script-diff-basic-expected.txt => memory/replace/dmd/test/script-diff-live-expected.txt rename : memory/replace/dmd/test/script-diff1.json => memory/replace/dmd/test/script-diff-live1.json rename : memory/replace/dmd/test/script-diff2.json => memory/replace/dmd/test/script-diff-live2.json extra : rebase_source : bf32cc4e0d82aa1a20ceb55e8ea259850b49cc06
2014-12-09 01:45:14 +03:00
virtual void ResetEverything(const char*);
#ifndef REPLACE_MALLOC_IMPL
// We deliberately don't use ReplaceMalloc::GetDMDFuncs here, because if we
// did, the following would happen.
// - The code footprint of each call to Get() larger as GetDMDFuncs ends
// up inlined.
// - When no replace-malloc library is loaded, the number of instructions
// executed is equivalent, but don't necessarily fit in the same cache
// line.
// - When a non-DMD replace-malloc library is loaded, the overhead is
// higher because there is first a check for the replace malloc bridge
// and then for the DMDFuncs singleton.
// Initializing the DMDFuncs singleton on the first access makes the
// overhead even worse. Either Get() is inlined and massive, or it isn't
// and a simple value check becomes a function call.
static DMDFuncs* Get() { return sSingleton.Get(); }
private:
// Wrapper class keeping a pointer to the DMD functions. It is statically
// initialized because it needs to be set early enough.
// Debug builds also check that it's never accessed before the static
// initialization actually occured, which could be the case if some other
// static initializer ended up calling into DMD.
class Singleton {
public:
Singleton()
: mValue(ReplaceMalloc::GetDMDFuncs())
# ifdef DEBUG
,
mInitialized(true)
# endif
{
}
DMDFuncs* Get() {
MOZ_ASSERT(mInitialized);
return mValue;
}
private:
DMDFuncs* mValue;
# ifdef DEBUG
bool mInitialized;
# endif
};
// This singleton pointer must be defined on the program side. In Gecko,
// this is done in xpcom/base/nsMemoryInfoDumper.cpp.
static /* DMDFuncs:: */ Singleton sSingleton;
#endif
};
#ifndef REPLACE_MALLOC_IMPL
// Mark a heap block as reported by a memory reporter.
inline void Report(const void* aPtr) {
DMDFuncs* funcs = DMDFuncs::Get();
if (funcs) {
funcs->Report(aPtr);
}
}
// Mark a heap block as reported immediately on allocation.
inline void ReportOnAlloc(const void* aPtr) {
DMDFuncs* funcs = DMDFuncs::Get();
if (funcs) {
funcs->ReportOnAlloc(aPtr);
}
}
// Clears existing reportedness data from any prior runs of the memory
// reporters. The following sequence should be used.
// - ClearReports()
// - run the memory reporters
// - Analyze()
// This sequence avoids spurious twice-reported warnings.
inline void ClearReports() {
DMDFuncs* funcs = DMDFuncs::Get();
if (funcs) {
funcs->ClearReports();
}
}
// Determines which heap blocks have been reported, and dumps JSON output
// (via |aWriter|) describing the heap.
//
// The following sample output contains comments that explain the format and
// design choices. The output files can be quite large, so a number of
// decisions were made to minimize size, such as using short property names and
// omitting properties whenever possible.
//
// {
// // The version number of the format, which will be incremented each time
// // backwards-incompatible changes are made. A mandatory integer.
Bug 1094552 (part 5) - DMD: choose the profiling mode at start-up. r=mccr8. This patch moves profiling mode selection from post-processing (in dmd.py) to DMD start-up. This will make it easier to add new kinds of profiling, such as cumulative heap profiling. Specifically: - There's a new --mode option. |LiveWithReports| is the default, as it is currently. - dmd.py's --ignore-reports option is gone. - There's a new |mode| field in the JSON output. - Reports-related operations are now no-ops if DMD isn't in LiveWithReports mode. - Diffs are only allowed for output files that have the same mode. - A new function ResetEverything() replaces the SetSampleBelowSize() and ClearBlocks(), which were used by the test to change DMD options. - The tests in SmokeDMD.cpp are split up so they can be run multiple times, in different modes. The exact combinations of tests and modes has been changed a bit. --HG-- rename : memory/replace/dmd/test/full-reports-empty-expected.txt => memory/replace/dmd/test/full-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-empty-expected.txt => memory/replace/dmd/test/full-empty-live-expected.txt rename : memory/replace/dmd/test/full-heap-sampled-expected.txt => memory/replace/dmd/test/full-sampled-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled2-expected.txt => memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt rename : memory/replace/dmd/test/script-diff-basic-expected.txt => memory/replace/dmd/test/script-diff-live-expected.txt rename : memory/replace/dmd/test/script-diff1.json => memory/replace/dmd/test/script-diff-live1.json rename : memory/replace/dmd/test/script-diff2.json => memory/replace/dmd/test/script-diff-live2.json extra : rebase_source : bf32cc4e0d82aa1a20ceb55e8ea259850b49cc06
2014-12-09 01:45:14 +03:00
// //
// // Version history:
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // - 1: Bug 1044709
// // - 2: Bug 1094552
// // - 3: Bug 1100851
// // - 4: Bug 1121830
// // - 5: Bug 1253512
// "version": 5,
//
// // Information about how DMD was invoked. A mandatory object.
// "invocation": {
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // The contents of the $DMD environment variable. A string, or |null| if
// // $DMD is undefined.
// "dmdEnvVar": "--mode=dark-matter",
//
Bug 1094552 (part 5) - DMD: choose the profiling mode at start-up. r=mccr8. This patch moves profiling mode selection from post-processing (in dmd.py) to DMD start-up. This will make it easier to add new kinds of profiling, such as cumulative heap profiling. Specifically: - There's a new --mode option. |LiveWithReports| is the default, as it is currently. - dmd.py's --ignore-reports option is gone. - There's a new |mode| field in the JSON output. - Reports-related operations are now no-ops if DMD isn't in LiveWithReports mode. - Diffs are only allowed for output files that have the same mode. - A new function ResetEverything() replaces the SetSampleBelowSize() and ClearBlocks(), which were used by the test to change DMD options. - The tests in SmokeDMD.cpp are split up so they can be run multiple times, in different modes. The exact combinations of tests and modes has been changed a bit. --HG-- rename : memory/replace/dmd/test/full-reports-empty-expected.txt => memory/replace/dmd/test/full-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-empty-expected.txt => memory/replace/dmd/test/full-empty-live-expected.txt rename : memory/replace/dmd/test/full-heap-sampled-expected.txt => memory/replace/dmd/test/full-sampled-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled2-expected.txt => memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt rename : memory/replace/dmd/test/script-diff-basic-expected.txt => memory/replace/dmd/test/script-diff-live-expected.txt rename : memory/replace/dmd/test/script-diff1.json => memory/replace/dmd/test/script-diff-live1.json rename : memory/replace/dmd/test/script-diff2.json => memory/replace/dmd/test/script-diff-live2.json extra : rebase_source : bf32cc4e0d82aa1a20ceb55e8ea259850b49cc06
2014-12-09 01:45:14 +03:00
// // The profiling mode. A mandatory string taking one of the following
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // values: "live", "dark-matter", "cumulative", "scan".
Bug 1094552 (part 5) - DMD: choose the profiling mode at start-up. r=mccr8. This patch moves profiling mode selection from post-processing (in dmd.py) to DMD start-up. This will make it easier to add new kinds of profiling, such as cumulative heap profiling. Specifically: - There's a new --mode option. |LiveWithReports| is the default, as it is currently. - dmd.py's --ignore-reports option is gone. - There's a new |mode| field in the JSON output. - Reports-related operations are now no-ops if DMD isn't in LiveWithReports mode. - Diffs are only allowed for output files that have the same mode. - A new function ResetEverything() replaces the SetSampleBelowSize() and ClearBlocks(), which were used by the test to change DMD options. - The tests in SmokeDMD.cpp are split up so they can be run multiple times, in different modes. The exact combinations of tests and modes has been changed a bit. --HG-- rename : memory/replace/dmd/test/full-reports-empty-expected.txt => memory/replace/dmd/test/full-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-empty-expected.txt => memory/replace/dmd/test/full-empty-live-expected.txt rename : memory/replace/dmd/test/full-heap-sampled-expected.txt => memory/replace/dmd/test/full-sampled-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled2-expected.txt => memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt rename : memory/replace/dmd/test/script-diff-basic-expected.txt => memory/replace/dmd/test/script-diff-live-expected.txt rename : memory/replace/dmd/test/script-diff1.json => memory/replace/dmd/test/script-diff-live1.json rename : memory/replace/dmd/test/script-diff2.json => memory/replace/dmd/test/script-diff-live2.json extra : rebase_source : bf32cc4e0d82aa1a20ceb55e8ea259850b49cc06
2014-12-09 01:45:14 +03:00
// "mode": "dark-matter",
// },
//
// // Details of all analyzed heap blocks. A mandatory array.
// "blockList": [
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // An example of a heap block.
// {
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // Requested size, in bytes. This is a mandatory integer.
// "req": 3584,
//
// // Requested slop size, in bytes. This is mandatory if it is non-zero,
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // but omitted otherwise.
// "slop": 512,
//
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // The stack trace at which the block was allocated. An optional
// // string that indexes into the "traceTable" object. If omitted, no
// // allocation stack trace was recorded for the block.
// "alloc": "A",
//
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // One or more stack traces at which this heap block was reported by a
// // memory reporter. An optional array that will only be present in
// // "dark-matter" mode. The elements are strings that index into
// // the "traceTable" object.
// "reps": ["B"]
//
// // The number of heap blocks with exactly the above properties. This
// // is mandatory if it is greater than one, but omitted otherwise.
// // (Blocks with identical properties don't have to be aggregated via
// // this property, but it can greatly reduce output file size.)
// "num": 5,
//
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // The address of the block. This is mandatory in "scan" mode, but
// // omitted otherwise.
// "addr": "4e4e4e4e",
//
// // The contents of the block, read one word at a time. This is
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// // mandatory in "scan" mode for blocks at least one word long, but
// // omitted otherwise.
// "contents": ["0", "6", "7f7f7f7f", "0"]
// }
// ],
//
// // The stack traces referenced by elements of the "blockList" array. This
// // could be an array, but making it an object makes it easier to see
// // which stacks correspond to which references in the "blockList" array.
// "traceTable": {
// // Each property corresponds to a stack trace mentioned in the "blocks"
// // object. Each element is an index into the "frameTable" object.
// "A": ["D", "E"],
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// "B": ["F", "G"]
// },
//
// // The stack frames referenced by the "traceTable" object. The
// // descriptions can be quite long, so they are stored separately from the
// // "traceTable" object so that each one only has to be written once.
// // This could also be an array, but again, making it an object makes it
// // easier to see which frames correspond to which references in the
// // "traceTable" object.
// "frameTable": {
// // Each property key is a frame key mentioned in the "traceTable" object.
// // Each property value is a string containing a frame description. Each
// // frame description must be in a format recognized by the stack-fixing
// // scripts (e.g. fix_linux_stack.py), which require a frame number at
// // the start. Because each stack frame description in this table can
// // be shared between multiple stack traces, we use a dummy value of
// // #00. The proper frame number can be reconstructed later by scripts
// // that output stack traces in a conventional non-shared format.
// "D": "#00: foo (Foo.cpp:123)",
// "E": "#00: bar (Bar.cpp:234)",
// "F": "#00: baz (Baz.cpp:345)",
Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm. DMD currently uses a very hacky form of "sampling" by default to avoid recording stack traces for all blocks. This makes DMD run faster than when it records all stack traces. This patch changes the sampling method used; in fact, it avoids "sampling" at all. The existence of all heap blocks is now recorded exactly, but by default we only record an allocation stack for each heap block if a Bernoulli trial succeeds. This choice works well because getting the stack trace is ~100x slower than recording the block's existence. Overall, this approach is simpler and it also gives better output -- the choice of which blocks to record allocation stacks for is mathematically sound, no stack trace gets blamed for allocations it didn't do, and block counts and sizes are now always exact. Other specific things changed. - All notion of sampling is removed from the various data structures. - The --sample-below option is removed in favour of --stacks={partial,full}. - The format of the JSON output file has changed. - The names of various test files have changed to reflect concept changes. --HG-- rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 06:42:22 +03:00
// "G": "#00: quux (Quux.cpp:456)"
// }
// }
Bug 1094552 (part 5) - DMD: choose the profiling mode at start-up. r=mccr8. This patch moves profiling mode selection from post-processing (in dmd.py) to DMD start-up. This will make it easier to add new kinds of profiling, such as cumulative heap profiling. Specifically: - There's a new --mode option. |LiveWithReports| is the default, as it is currently. - dmd.py's --ignore-reports option is gone. - There's a new |mode| field in the JSON output. - Reports-related operations are now no-ops if DMD isn't in LiveWithReports mode. - Diffs are only allowed for output files that have the same mode. - A new function ResetEverything() replaces the SetSampleBelowSize() and ClearBlocks(), which were used by the test to change DMD options. - The tests in SmokeDMD.cpp are split up so they can be run multiple times, in different modes. The exact combinations of tests and modes has been changed a bit. --HG-- rename : memory/replace/dmd/test/full-reports-empty-expected.txt => memory/replace/dmd/test/full-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-empty-expected.txt => memory/replace/dmd/test/full-empty-live-expected.txt rename : memory/replace/dmd/test/full-heap-sampled-expected.txt => memory/replace/dmd/test/full-sampled-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled2-expected.txt => memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt rename : memory/replace/dmd/test/script-diff-basic-expected.txt => memory/replace/dmd/test/script-diff-live-expected.txt rename : memory/replace/dmd/test/script-diff1.json => memory/replace/dmd/test/script-diff-live1.json rename : memory/replace/dmd/test/script-diff2.json => memory/replace/dmd/test/script-diff-live2.json extra : rebase_source : bf32cc4e0d82aa1a20ceb55e8ea259850b49cc06
2014-12-09 01:45:14 +03:00
//
// Implementation note: normally, this function wouldn't be templated, but in
// that case, the function is compiled, which makes the destructor for the
// UniquePtr fire up, and that needs JSONWriteFunc to be fully defined. That,
// in turn, requires to include JSONWriter.h, which includes
// double-conversion.h, which ends up breaking various things built with
// -Werror for various reasons.
Bug 1094552 (part 5) - DMD: choose the profiling mode at start-up. r=mccr8. This patch moves profiling mode selection from post-processing (in dmd.py) to DMD start-up. This will make it easier to add new kinds of profiling, such as cumulative heap profiling. Specifically: - There's a new --mode option. |LiveWithReports| is the default, as it is currently. - dmd.py's --ignore-reports option is gone. - There's a new |mode| field in the JSON output. - Reports-related operations are now no-ops if DMD isn't in LiveWithReports mode. - Diffs are only allowed for output files that have the same mode. - A new function ResetEverything() replaces the SetSampleBelowSize() and ClearBlocks(), which were used by the test to change DMD options. - The tests in SmokeDMD.cpp are split up so they can be run multiple times, in different modes. The exact combinations of tests and modes has been changed a bit. --HG-- rename : memory/replace/dmd/test/full-reports-empty-expected.txt => memory/replace/dmd/test/full-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-empty-expected.txt => memory/replace/dmd/test/full-empty-live-expected.txt rename : memory/replace/dmd/test/full-heap-sampled-expected.txt => memory/replace/dmd/test/full-sampled-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled2-expected.txt => memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt rename : memory/replace/dmd/test/script-diff-basic-expected.txt => memory/replace/dmd/test/script-diff-live-expected.txt rename : memory/replace/dmd/test/script-diff1.json => memory/replace/dmd/test/script-diff-live1.json rename : memory/replace/dmd/test/script-diff2.json => memory/replace/dmd/test/script-diff-live2.json extra : rebase_source : bf32cc4e0d82aa1a20ceb55e8ea259850b49cc06
2014-12-09 01:45:14 +03:00
//
template <typename JSONWriteFunc>
inline void Analyze(UniquePtr<JSONWriteFunc> aWriteFunc) {
DMDFuncs* funcs = DMDFuncs::Get();
if (funcs) {
funcs->Analyze(std::move(aWriteFunc));
}
}
// Gets the size of various data structures. Used to implement a memory
// reporter for DMD.
inline void SizeOf(Sizes* aSizes) {
DMDFuncs* funcs = DMDFuncs::Get();
if (funcs) {
funcs->SizeOf(aSizes);
}
}
// Prints a status message prefixed with "DMD[<pid>]". Use sparingly.
MOZ_FORMAT_PRINTF(1, 2)
inline void StatusMsg(const char* aFmt, ...) {
DMDFuncs* funcs = DMDFuncs::Get();
if (funcs) {
va_list ap;
va_start(ap, aFmt);
funcs->StatusMsg(aFmt, ap);
va_end(ap);
}
}
// Indicates whether or not DMD is running.
inline bool IsRunning() { return !!DMDFuncs::Get(); }
Bug 1094552 (part 5) - DMD: choose the profiling mode at start-up. r=mccr8. This patch moves profiling mode selection from post-processing (in dmd.py) to DMD start-up. This will make it easier to add new kinds of profiling, such as cumulative heap profiling. Specifically: - There's a new --mode option. |LiveWithReports| is the default, as it is currently. - dmd.py's --ignore-reports option is gone. - There's a new |mode| field in the JSON output. - Reports-related operations are now no-ops if DMD isn't in LiveWithReports mode. - Diffs are only allowed for output files that have the same mode. - A new function ResetEverything() replaces the SetSampleBelowSize() and ClearBlocks(), which were used by the test to change DMD options. - The tests in SmokeDMD.cpp are split up so they can be run multiple times, in different modes. The exact combinations of tests and modes has been changed a bit. --HG-- rename : memory/replace/dmd/test/full-reports-empty-expected.txt => memory/replace/dmd/test/full-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-empty-expected.txt => memory/replace/dmd/test/full-empty-live-expected.txt rename : memory/replace/dmd/test/full-heap-sampled-expected.txt => memory/replace/dmd/test/full-sampled-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled2-expected.txt => memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt rename : memory/replace/dmd/test/script-diff-basic-expected.txt => memory/replace/dmd/test/script-diff-live-expected.txt rename : memory/replace/dmd/test/script-diff1.json => memory/replace/dmd/test/script-diff-live1.json rename : memory/replace/dmd/test/script-diff2.json => memory/replace/dmd/test/script-diff-live2.json extra : rebase_source : bf32cc4e0d82aa1a20ceb55e8ea259850b49cc06
2014-12-09 01:45:14 +03:00
// Resets all DMD options and then sets new ones according to those specified
// in |aOptions|. Also clears all recorded data about allocations. Only used
// for testing purposes.
inline void ResetEverything(const char* aOptions) {
DMDFuncs* funcs = DMDFuncs::Get();
if (funcs) {
Bug 1094552 (part 5) - DMD: choose the profiling mode at start-up. r=mccr8. This patch moves profiling mode selection from post-processing (in dmd.py) to DMD start-up. This will make it easier to add new kinds of profiling, such as cumulative heap profiling. Specifically: - There's a new --mode option. |LiveWithReports| is the default, as it is currently. - dmd.py's --ignore-reports option is gone. - There's a new |mode| field in the JSON output. - Reports-related operations are now no-ops if DMD isn't in LiveWithReports mode. - Diffs are only allowed for output files that have the same mode. - A new function ResetEverything() replaces the SetSampleBelowSize() and ClearBlocks(), which were used by the test to change DMD options. - The tests in SmokeDMD.cpp are split up so they can be run multiple times, in different modes. The exact combinations of tests and modes has been changed a bit. --HG-- rename : memory/replace/dmd/test/full-reports-empty-expected.txt => memory/replace/dmd/test/full-empty-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-empty-expected.txt => memory/replace/dmd/test/full-empty-live-expected.txt rename : memory/replace/dmd/test/full-heap-sampled-expected.txt => memory/replace/dmd/test/full-sampled-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt rename : memory/replace/dmd/test/full-heap-unsampled1-expected.txt => memory/replace/dmd/test/full-unsampled1-live-expected.txt rename : memory/replace/dmd/test/full-reports-unsampled2-expected.txt => memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt rename : memory/replace/dmd/test/script-diff-basic-expected.txt => memory/replace/dmd/test/script-diff-live-expected.txt rename : memory/replace/dmd/test/script-diff1.json => memory/replace/dmd/test/script-diff-live1.json rename : memory/replace/dmd/test/script-diff2.json => memory/replace/dmd/test/script-diff-live2.json extra : rebase_source : bf32cc4e0d82aa1a20ceb55e8ea259850b49cc06
2014-12-09 01:45:14 +03:00
funcs->ResetEverything(aOptions);
}
}
#endif
} // namespace dmd
} // namespace mozilla
#endif /* DMD_h___ */