Bug 1360471 (part 4) - Use a bitfield to represent profiler features. r=mstange.

Currently the profiler mostly uses an array of strings to represent which
features are available and in use. This patch changes the profiler core to use
a uint32_t bitfield, which is a much simpler and faster representation.
(nsProfiler and the profiler add-on still use the array of strings, alas.) The
new ProfilerFeature type defines the values in the bitfield.

One side-effect of this change is that profiler_feature_active() now can be
used to query all features. Previously it was just a subset.

Another side-effect is that profiler_get_available_features() no longer incorrectly
indicates support for Java and stack-walking when they aren't supported. (The
handling of task tracer support is unchanged, because the old code handled it
correctly.)
This commit is contained in:
Nicholas Nethercote
2017-05-01 14:23:34 +10:00
parent da42e4205e
commit a7e5660c91
23 changed files with 300 additions and 343 deletions

View File

@@ -2659,18 +2659,12 @@ PluginModuleChild::ProcessNativeEvents() {
mozilla::ipc::IPCResult
PluginModuleChild::RecvStartProfiler(const ProfilerInitParams& params)
{
nsTArray<const char*> featureArray;
for (size_t i = 0; i < params.features().Length(); ++i) {
featureArray.AppendElement(params.features()[i].get());
}
nsTArray<const char*> filterArray;
for (size_t i = 0; i < params.filters().Length(); ++i) {
filterArray.AppendElement(params.filters()[i].get());
}
profiler_start(params.entries(), params.interval(),
featureArray.Elements(), featureArray.Length(),
profiler_start(params.entries(), params.interval(), params.features(),
filterArray.Elements(), filterArray.Length());
return IPC_OK();