mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
ee118c4b83
- Bug 1051146 - Part 1: Introduce the B2G specific build flags, initially enabled. r=smaug (341c7565d) - Bug 1051146 - art 2: Introduce the new Pocketsphinx and Sphinxbase code with no build integration. r=smaug, r=gerv (f29eafa78) - Bug 1051146 - Part 3: Introduce build system changes for the new Pocketsphinx and Sphinxbase code. r=smaug, r=gps (06c60429d) - Bug 1051146 - Part 4: Introduce build system changes for the MOZ_WEBSPEECH_TEST_BACKEND flag. r=smaug, r=gps (16195e66e) - Bug 1051146 - Part 5: Introduce new English model with no build integration. r=smaug (24996aa9c) - Bug 1051146 - Part 6: Introduce build integration of new English model. r=smaug, r=gps (b718751a9) - Bug 1051146 - Part 7: Introduce update scripts for Pocketsphinx and Sphinxbase code. r=smaug (5a85c7ed2) - Bug 1051148 - Part 1: Patch that introduces WebSpeech API implementation. r=smaug (d18e5d86e) - Bug 1171249 - Modified configure.in so MOZ_WEBSPEECH undefined implies both MOZ_WEBSPEECH_TEST_BACKEND and MOZ_WEBSPEECH_MODELS are undefined. r=gps (47d13fc61) - Bug 1051148 - Part 2: Patch that turns off the WebSpeech API implementation using flags. r=gps (8b2ceef89) - Bug 1051146 - Disable Pocketsphinx building on Windows due to bustage. r=gps (48f4a1c27) - Bug 1204703 - Make nsContentSecurityManager scriptable (r=sicking) (fb514951a) - Bug 1215745: Safer implemetation of nsJarChannel::AsyncOpen2. r=ckerschb (3ad0270b4) - partial of Bug 1178892 - Split the profiler into Core & Gecko files and break apart monolithic headers. r=mstange (eda571469) - Bug 1213407 - PluginModuleContentParent should delete its Transport. r=billm (153a54404) - Bug 1169945 - Remove unused plugins.enumerable_names whitelist. r=bsmedberg (52126cbd8) - Bug 1160166 - Disabled plugin meta information often isn't available to content processes. r=jimm (d63331192) - Bug 1165981 - Only allow flash as a plugin on Windows 64-bit builds; r=bsmedberg (bfc073186) - missing bit of 1164543 (5ef55bc55) - Bug 1178963 part 1. Use nsIPluginTagInternal instead of nsPluginTag in cases where it may be nsFakePluginTag. r=peterv (f8702aead) - Bug 1200484 (part 1) - Expose the column number in JS::DescribeScriptedCaller(). r=luke. (85cf65a1c) - Bug 1200484 (part 2) - Use JS column numbers in ReportWrapperDenial(). r=mrbkap. (1de0e6331) - Bug 1200484 (part 3) - Use JS column numbers in WebSocket.cpp. r=baku. (3febdd8bc) - Bug 1200484 (part 4) - Expose the column number in nsJSUtils::GetCallingLocation(). r=mrbkap. (479ae5e2a) - Bug 1200484 (part 5) - Use JS column numbers in XPCNativeInterface::NewInstance(). r=mrbkap. (63e5e4e41) - Bug 1200484 (part 6) - Use JS column numbers in ContentParent::OnChannelError(). r=billm. (4c84ef09d) - Bug 1139718 - Warning when sending MM messages that include XPCOM data (r=smaug) (d50774823) - Bug 1200484 (part 7) - Use JS column numbers in GetParamsForMessage() (bf19fc4cb) - Bug 1200484 (part 8) - Use JS column numbers in EventSource. r=khuey. (64374ed83) - Bug 1200484 (part 9) - Use JS column numbers in nsContentUtils::ReportToConsoleNonLocalized. r=khuey. (4d81c5f4f) - Bug 1200484 (part 10) - Use JS column numbers in indexedDB. r=khuey. (64eec5da6) - Bug 1200484 (part 11) - Set source location when initializing an nsJSScriptTimeoutHandler from a Function. r=peterv. (f135b3a2c) - Bug 1200484 (part 12) - Use JS column numbers in nsJSTimeoutHandler. r=peterv. (8ec21dc04) - Bug 1163664 - Don't check for plugin blocklist state on Android. r=jimm, r=jchen (14b8f3e57) - Bug 1178963 part 2. Implement nsFakePluginTag to represent a non-NPAPI "plugin" that is actually implemented in JavaScript. r=peterv (ba11d6de0) - Bug 1178896 - Add support for determining if a plugin is OOP to nsIPluginHost. r=aklotz (e8689641f) - Bug 1178963 part 3. Make nsPluginHost aware of fake plugins. r=peterv (a2a9f8cb3)
261 lines
6.9 KiB
C++
261 lines
6.9 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/. */
|
|
|
|
ThreadProfile::ThreadProfile(ThreadInfo* aInfo, ProfileBuffer* aBuffer)
|
|
: mThreadInfo(aInfo)
|
|
, mBuffer(aBuffer)
|
|
, mPseudoStack(aInfo->Stack())
|
|
, mMutex(OS::CreateMutex("ThreadProfile::mMutex"))
|
|
, mThreadId(int(aInfo->ThreadId()))
|
|
, mIsMainThread(aInfo->IsMainThread())
|
|
, mPlatformData(aInfo->GetPlatformData())
|
|
, mStackTop(aInfo->StackTop())
|
|
#ifndef SPS_STANDALONE
|
|
, mRespInfo(this)
|
|
#endif
|
|
#ifdef XP_LINUX
|
|
, mRssMemory(0)
|
|
, mUssMemory(0)
|
|
#endif
|
|
{
|
|
MOZ_COUNT_CTOR(ThreadProfile);
|
|
MOZ_ASSERT(aBuffer);
|
|
|
|
// I don't know if we can assert this. But we should warn.
|
|
MOZ_ASSERT(aInfo->ThreadId() >= 0, "native thread ID is < 0");
|
|
MOZ_ASSERT(aInfo->ThreadId() <= INT32_MAX, "native thread ID is > INT32_MAX");
|
|
}
|
|
|
|
ThreadProfile::~ThreadProfile()
|
|
{
|
|
MOZ_COUNT_DTOR(ThreadProfile);
|
|
}
|
|
|
|
void ThreadProfile::addTag(const ProfileEntry& aTag)
|
|
{
|
|
mBuffer->addTag(aTag);
|
|
}
|
|
|
|
void ThreadProfile::addStoredMarker(ProfilerMarker *aStoredMarker) {
|
|
mBuffer->addStoredMarker(aStoredMarker);
|
|
}
|
|
|
|
void ThreadProfile::StreamJSON(SpliceableJSONWriter& aWriter, double aSinceTime)
|
|
{
|
|
// mUniqueStacks may already be emplaced from FlushSamplesAndMarkers.
|
|
if (!mUniqueStacks.isSome()) {
|
|
#ifndef SPS_STANDALONE
|
|
mUniqueStacks.emplace(mPseudoStack->mRuntime);
|
|
#else
|
|
mUniqueStacks.emplace(nullptr);
|
|
#endif
|
|
}
|
|
|
|
aWriter.Start(SpliceableJSONWriter::SingleLineStyle);
|
|
{
|
|
StreamSamplesAndMarkers(aWriter, aSinceTime, *mUniqueStacks);
|
|
|
|
aWriter.StartObjectProperty("stackTable");
|
|
{
|
|
{
|
|
JSONSchemaWriter schema(aWriter);
|
|
schema.WriteField("prefix");
|
|
schema.WriteField("frame");
|
|
}
|
|
|
|
aWriter.StartArrayProperty("data");
|
|
{
|
|
mUniqueStacks->SpliceStackTableElements(aWriter);
|
|
}
|
|
aWriter.EndArray();
|
|
}
|
|
aWriter.EndObject();
|
|
|
|
aWriter.StartObjectProperty("frameTable");
|
|
{
|
|
{
|
|
JSONSchemaWriter schema(aWriter);
|
|
schema.WriteField("location");
|
|
schema.WriteField("implementation");
|
|
schema.WriteField("optimizations");
|
|
schema.WriteField("line");
|
|
schema.WriteField("category");
|
|
}
|
|
|
|
aWriter.StartArrayProperty("data");
|
|
{
|
|
mUniqueStacks->SpliceFrameTableElements(aWriter);
|
|
}
|
|
aWriter.EndArray();
|
|
}
|
|
aWriter.EndObject();
|
|
|
|
aWriter.StartArrayProperty("stringTable");
|
|
{
|
|
mUniqueStacks->mUniqueStrings.SpliceStringTableElements(aWriter);
|
|
}
|
|
aWriter.EndArray();
|
|
}
|
|
aWriter.End();
|
|
|
|
mUniqueStacks.reset();
|
|
}
|
|
|
|
void ThreadProfile::StreamSamplesAndMarkers(SpliceableJSONWriter& aWriter, double aSinceTime,
|
|
UniqueStacks& aUniqueStacks)
|
|
{
|
|
#ifndef SPS_STANDALONE
|
|
// Thread meta data
|
|
if (XRE_GetProcessType() == GeckoProcessType_Plugin) {
|
|
// TODO Add the proper plugin name
|
|
aWriter.StringProperty("name", "Plugin");
|
|
} else if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
|
// This isn't going to really help once we have multiple content
|
|
// processes, but it'll do for now.
|
|
aWriter.StringProperty("name", "Content");
|
|
} else {
|
|
aWriter.StringProperty("name", Name());
|
|
}
|
|
#else
|
|
aWriter.StringProperty("name", Name());
|
|
#endif
|
|
|
|
aWriter.IntProperty("tid", static_cast<int>(mThreadId));
|
|
|
|
aWriter.StartObjectProperty("samples");
|
|
{
|
|
{
|
|
JSONSchemaWriter schema(aWriter);
|
|
schema.WriteField("stack");
|
|
schema.WriteField("time");
|
|
schema.WriteField("responsiveness");
|
|
schema.WriteField("rss");
|
|
schema.WriteField("uss");
|
|
schema.WriteField("frameNumber");
|
|
schema.WriteField("power");
|
|
}
|
|
|
|
aWriter.StartArrayProperty("data");
|
|
{
|
|
if (mSavedStreamedSamples) {
|
|
// We would only have saved streamed samples during shutdown
|
|
// streaming, which cares about dumping the entire buffer, and thus
|
|
// should have passed in 0 for aSinceTime.
|
|
MOZ_ASSERT(aSinceTime == 0);
|
|
aWriter.Splice(mSavedStreamedSamples.get());
|
|
mSavedStreamedSamples.reset();
|
|
}
|
|
mBuffer->StreamSamplesToJSON(aWriter, mThreadId, aSinceTime,
|
|
#ifndef SPS_STANDALONE
|
|
mPseudoStack->mRuntime,
|
|
#else
|
|
nullptr,
|
|
#endif
|
|
aUniqueStacks);
|
|
}
|
|
aWriter.EndArray();
|
|
}
|
|
aWriter.EndObject();
|
|
|
|
aWriter.StartObjectProperty("markers");
|
|
{
|
|
{
|
|
JSONSchemaWriter schema(aWriter);
|
|
schema.WriteField("name");
|
|
schema.WriteField("time");
|
|
schema.WriteField("data");
|
|
}
|
|
|
|
aWriter.StartArrayProperty("data");
|
|
{
|
|
if (mSavedStreamedMarkers) {
|
|
MOZ_ASSERT(aSinceTime == 0);
|
|
aWriter.Splice(mSavedStreamedMarkers.get());
|
|
mSavedStreamedMarkers.reset();
|
|
}
|
|
mBuffer->StreamMarkersToJSON(aWriter, mThreadId, aSinceTime, aUniqueStacks);
|
|
}
|
|
aWriter.EndArray();
|
|
}
|
|
aWriter.EndObject();
|
|
}
|
|
|
|
void ThreadProfile::FlushSamplesAndMarkers()
|
|
{
|
|
// This function is used to serialize the current buffer just before
|
|
// JSRuntime destruction.
|
|
MOZ_ASSERT(mPseudoStack->mRuntime);
|
|
|
|
// Unlike StreamJSObject, do not surround the samples in brackets by calling
|
|
// aWriter.{Start,End}BareList. The result string will be a comma-separated
|
|
// list of JSON object literals that will prepended by StreamJSObject into
|
|
// an existing array.
|
|
//
|
|
// Note that the UniqueStacks instance is persisted so that the frame-index
|
|
// mapping is stable across JS shutdown.
|
|
#ifndef SPS_STANDALONE
|
|
mUniqueStacks.emplace(mPseudoStack->mRuntime);
|
|
#else
|
|
mUniqueStacks.emplace(nullptr);
|
|
#endif
|
|
|
|
{
|
|
SpliceableChunkedJSONWriter b;
|
|
b.StartBareList();
|
|
{
|
|
mBuffer->StreamSamplesToJSON(b, mThreadId, /* aSinceTime = */ 0,
|
|
#ifndef SPS_STANDALONE
|
|
mPseudoStack->mRuntime,
|
|
#else
|
|
nullptr,
|
|
#endif
|
|
*mUniqueStacks);
|
|
}
|
|
b.EndBareList();
|
|
mSavedStreamedSamples = b.WriteFunc()->CopyData();
|
|
}
|
|
|
|
{
|
|
SpliceableChunkedJSONWriter b;
|
|
b.StartBareList();
|
|
{
|
|
mBuffer->StreamMarkersToJSON(b, mThreadId, /* aSinceTime = */ 0, *mUniqueStacks);
|
|
}
|
|
b.EndBareList();
|
|
mSavedStreamedMarkers = b.WriteFunc()->CopyData();
|
|
}
|
|
|
|
// Reset the buffer. Attempting to symbolicate JS samples after mRuntime has
|
|
// gone away will crash.
|
|
mBuffer->reset();
|
|
}
|
|
|
|
PseudoStack* ThreadProfile::GetPseudoStack()
|
|
{
|
|
return mPseudoStack;
|
|
}
|
|
|
|
void ThreadProfile::BeginUnwind()
|
|
{
|
|
mMutex->Lock();
|
|
}
|
|
|
|
void ThreadProfile::EndUnwind()
|
|
{
|
|
mMutex->Unlock();
|
|
}
|
|
|
|
::Mutex& ThreadProfile::GetMutex()
|
|
{
|
|
return *mMutex.get();
|
|
}
|
|
|
|
void ThreadProfile::DuplicateLastSample()
|
|
{
|
|
mBuffer->DuplicateLastSample(mThreadId);
|
|
}
|
|
|