fune/mozglue/baseprofiler/core/ProfilerBacktrace.cpp
Gerald Squelart f14c01769a Bug 1492121 - Enclosing BaseProfiler in namespace mozilla::baseprofiler - r=njn
This prevents potential name clashes between the two profilers.

Differential Revision: https://phabricator.services.mozilla.com/D31930

--HG--
extra : moz-landing-system : lando
2019-06-05 23:41:26 +00:00

44 lines
1.7 KiB
C++

/* -*- Mode: C++; tab-width: 8; 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/. */
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
# include "ProfilerBacktrace.h"
# include "ProfileBuffer.h"
# include "ProfiledThreadData.h"
# include "BaseProfileJSONWriter.h"
# include "ThreadInfo.h"
namespace mozilla {
namespace baseprofiler {
ProfilerBacktrace::ProfilerBacktrace(const char* aName, int aThreadId,
UniquePtr<ProfileBuffer> aBuffer)
: mName(strdup(aName)), mThreadId(aThreadId), mBuffer(std::move(aBuffer)) {}
ProfilerBacktrace::~ProfilerBacktrace() {}
void ProfilerBacktrace::StreamJSON(SpliceableJSONWriter& aWriter,
const TimeStamp& aProcessStartTime,
UniqueStacks& aUniqueStacks) {
// Unlike ProfiledThreadData::StreamJSON, we don't need to call
// ProfileBuffer::AddJITInfoForRange because mBuffer does not contain any
// JitReturnAddr entries. For synchronous samples, JIT frames get expanded
// at sample time.
StreamSamplesAndMarkers(mName.get(), mThreadId, *mBuffer.get(), aWriter, "",
aProcessStartTime,
/* aRegisterTime */ TimeStamp(),
/* aUnregisterTime */ TimeStamp(),
/* aSinceTime */ 0, aUniqueStacks);
}
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER