gecko-dev/tools/profiler/core/ProfilerBacktrace.h
Nicholas Nethercote 4b364cf3f3 Bug 1375299 (part 1) - Reduce usage of MOZ_GECKO_PROFILER. r=mstange.
This patch reduces the differences between builds where the profiler is enabled
and those where the profiler is disabled. It does this by removing numerous
MOZ_GECKO_PROFILER checks.

These changes have the following consequences.

- Various functions and classes are now defined in all builds, and so can be
  used unconditionally: profiler_add_marker(), profiler_set_js_context(),
  profiler_clear_js_context(), profiler_get_pseudo_stack(), AutoProfilerLabel.
  (They are effectively no-ops in non-profiler builds, of course.)

- The no-op versions of PROFILER_* are now gone. The remaining versions are
  almost no-ops when the profiler isn't built.

--HG--
extra : rebase_source : 8fb5e8757600210c2f77865694d25162f0b7698a
2017-06-22 06:26:16 +10:00

50 lines
1.5 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=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 __PROFILER_BACKTRACE_H
#define __PROFILER_BACKTRACE_H
#include "mozilla/UniquePtrExtensions.h"
class ProfileBuffer;
class SpliceableJSONWriter;
class ThreadInfo;
class UniqueStacks;
namespace mozilla {
class TimeStamp;
}
// ProfilerBacktrace encapsulates a synchronous sample.
class ProfilerBacktrace
{
public:
ProfilerBacktrace(const char* aName, int aThreadId,
mozilla::UniquePtr<ProfileBuffer> aBuffer);
~ProfilerBacktrace();
// ProfilerBacktraces' stacks are deduplicated in the context of the
// profile that contains the backtrace as a marker payload.
//
// That is, markers that contain backtraces should not need their own stack,
// frame, and string tables. They should instead reuse their parent
// profile's tables.
void StreamJSON(SpliceableJSONWriter& aWriter,
const mozilla::TimeStamp& aProcessStartTime,
UniqueStacks& aUniqueStacks);
private:
ProfilerBacktrace(const ProfilerBacktrace&);
ProfilerBacktrace& operator=(const ProfilerBacktrace&);
mozilla::UniqueFreePtr<char> mName;
int mThreadId;
mozilla::UniquePtr<ProfileBuffer> mBuffer;
};
#endif // __PROFILER_BACKTRACE_H