зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1673513 - profiler_get_profile_json(SpliceableChunkedJSONWriter&, ...) - r=florian
The main goal is to separate the profile generation (in a JSONWriter) from the final allocation needed to output the profile in one block. This will be needed in the next patch, where the profile generation will be done in a new worker thread, but the shmem allocation *must* be done on the original "ProfilerChild" thread that handles IPC responses. Differential Revision: https://phabricator.services.mozilla.com/D135483
This commit is contained in:
Родитель
bd01dc8480
Коммит
32ed5cbb65
|
@ -5105,24 +5105,37 @@ UniquePtr<char[]> profiler_get_profile(double aSinceTime,
|
|||
return b.ChunkedWriteFunc().CopyData();
|
||||
}
|
||||
|
||||
bool profiler_get_profile_json(
|
||||
SpliceableChunkedJSONWriter& aSpliceableChunkedJSONWriter,
|
||||
double aSinceTime, bool aIsShuttingDown,
|
||||
mozilla::ProgressLogger aProgressLogger) {
|
||||
LOG("profiler_get_profile_json");
|
||||
|
||||
UniquePtr<ProfilerCodeAddressService> service =
|
||||
profiler_code_address_service_for_presymbolication();
|
||||
|
||||
return WriteProfileToJSONWriter(
|
||||
aSpliceableChunkedJSONWriter, aSinceTime, aIsShuttingDown, service.get(),
|
||||
aProgressLogger.CreateSubLoggerFromTo(
|
||||
0.1_pc, "profiler_get_profile_json: WriteProfileToJSONWriter started",
|
||||
99.9_pc, "profiler_get_profile_json: WriteProfileToJSONWriter done"));
|
||||
}
|
||||
|
||||
void profiler_get_profile_json_into_lazily_allocated_buffer(
|
||||
const std::function<char*(size_t)>& aAllocator, double aSinceTime,
|
||||
bool aIsShuttingDown, mozilla::ProgressLogger aProgressLogger) {
|
||||
LOG("profiler_get_profile_json_into_lazily_allocated_buffer");
|
||||
|
||||
UniquePtr<ProfilerCodeAddressService> service =
|
||||
profiler_code_address_service_for_presymbolication();
|
||||
|
||||
SpliceableChunkedJSONWriter b;
|
||||
if (!WriteProfileToJSONWriter(
|
||||
b, aSinceTime, aIsShuttingDown, service.get(),
|
||||
if (!profiler_get_profile_json(
|
||||
b, aSinceTime, aIsShuttingDown,
|
||||
aProgressLogger.CreateSubLoggerFromTo(
|
||||
1_pc,
|
||||
"profiler_get_profile_json_into_lazily_allocated_buffer: "
|
||||
"WriteProfileToJSONWriter started",
|
||||
"profiler_get_profile_json started",
|
||||
98_pc,
|
||||
"profiler_get_profile_json_into_lazily_allocated_buffer: "
|
||||
"WriteProfileToJSONWriter done"))) {
|
||||
"profiler_get_profile_json done"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/ProfileBufferEntrySerialization.h"
|
||||
#include "mozilla/ProfileJSONWriter.h"
|
||||
#include "mozilla/ProfilerUtils.h"
|
||||
#include "mozilla/ProgressLogger.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
@ -84,9 +85,6 @@ typedef uint8_t* Address;
|
|||
// future sampling; this is not time critical, nor dependent on anything else.
|
||||
extern mozilla::Atomic<int, mozilla::MemoryOrdering::Relaxed> gSkipSampling;
|
||||
|
||||
namespace mozilla {
|
||||
class JSONWriter;
|
||||
}
|
||||
void AppendSharedLibraries(mozilla::JSONWriter& aWriter);
|
||||
|
||||
// Convert the array of strings to a bitfield.
|
||||
|
@ -94,6 +92,11 @@ uint32_t ParseFeaturesFromStringArray(const char** aFeatures,
|
|||
uint32_t aFeatureCount,
|
||||
bool aIsStartup = false);
|
||||
|
||||
bool profiler_get_profile_json(
|
||||
SpliceableChunkedJSONWriter& aSpliceableChunkedJSONWriter,
|
||||
double aSinceTime, bool aIsShuttingDown,
|
||||
mozilla::ProgressLogger aProgressLogger);
|
||||
|
||||
void profiler_get_profile_json_into_lazily_allocated_buffer(
|
||||
const std::function<char*(size_t)>& aAllocator, double aSinceTime,
|
||||
bool aIsShuttingDown, mozilla::ProgressLogger aProgressLogger);
|
||||
|
|
Загрузка…
Ссылка в новой задаче