Граф коммитов

147 Коммитов

Автор SHA1 Сообщение Дата
Randell Jesup b3b313e654 Bug 1595482: change "responsiveness" field to "eventDelay" in profiler r=canaltinova
We want the profiler UI to be able to know if the data can be used for
reconstructing the event delays, since it measures something different
from the old 16ms event injection.

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

--HG--
extra : moz-landing-system : lando
2019-11-18 14:26:14 +00:00
Nazım Can Altınova b7c55f9282 Bug 1468789 - Part 3: Serialize innerWindowID for js/jit frames. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D51861

--HG--
extra : moz-landing-system : lando
2019-11-14 14:15:03 +00:00
Nazım Can Altınova 8f6754f6fc Bug 1468789 - Part 2: Collect inner window id information for js interpreter frames and add a mechanism to get that for jit frames r=gerald,jandem,mstange
Differential Revision: https://phabricator.services.mozilla.com/D51860

--HG--
extra : moz-landing-system : lando
2019-11-15 08:01:30 +00:00
Narcis Beleuzu f0fe67f321 Backed out changeset 70738ac7ba9b (bug 1595482) for xpcshell failures on test_responsiveness.js . CLOSED TREE 2019-11-13 18:28:31 +02:00
Randell Jesup f542396ff9 Bug 1595482: change "responsiveness" field to "eventDelay" in profiler r=canaltinova
We want the profiler UI to be able to know if the data can be used for
reconstructing the event delays, since it measures something different
from the old 16ms event injection.

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

--HG--
extra : moz-landing-system : lando
2019-11-13 14:21:52 +00:00
Randell Jesup 3d6c5b76dd Bug 1572337: Don't call TimeStamp::Now() within SuspendAndSample r=froydnj
Avoids deadlocks on Windows due to Now() taking a lock; if done while we've
paused a thread that holds the lock we will deadlock.

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

--HG--
extra : moz-landing-system : lando
2019-11-08 21:18:06 +00:00
Randell Jesup 05d65a0464 Bug 1572337: Remove old responsiveness profiler measurement r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D44060

--HG--
extra : moz-landing-system : lando
2019-11-08 21:08:07 +00:00
Ciure Andrei b7c3599997 Backed out 3 changesets (bug 1572337, bug 1594015) for causing linting failures and build bustages CLOSED TREE
Backed out changeset 25f074eb5074 (bug 1594015)
Backed out changeset fc8a37c2c22c (bug 1572337)
Backed out changeset 913d6bd82284 (bug 1572337)
2019-11-07 16:37:00 +02:00
Randell Jesup 95be6cffe0 Bug 1572337: Remove old responsiveness profiler measurement r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D44060

--HG--
extra : moz-landing-system : lando
2019-11-07 12:53:35 +00:00
Gerald Squelart 1824e6f651 Bug 1584190 - In JSON profile, counters' sample_groups should be an array of objects - r=canaltinova
profile.counters[n].sample_groups was mistakenly streamed as an object, which
prevents having more than one, and goes against the published format
documentation.

The front-end was implemented to process the incorrect format, so it will need
to be updated as well; hence the version change to 18.

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

--HG--
extra : moz-landing-system : lando
2019-10-30 22:20:06 +00:00
Gerald Squelart d24177fe2a Bug 1587332 - Encapsulate ActivePS::mProfileBuffer as a ProfileBuffer value - r=canaltinova
Having `mProfileBuffer` be a pointer is not really helpful:
- The pointer is never null (It's allocated on ActivePS construction, and
  implicitly deleted on ActivePS destruction); it's never moved-from.
- It requires an extra `new` and an extra `delete`.

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

--HG--
extra : moz-landing-system : lando
2019-10-10 10:52:09 +00:00
Gerald Squelart dff1750481 Bug 1587329 - MOZ_ASSERT(sInstance) in all functions that dereference sInstance - r=canaltinova
Add assertions that all `sInstance` pointers (from both `CorePS` and `ActivePS`)
are not null before being dereferenced.

This is probably more than needed, but it's only `MOZ_ASSERT`s limited to
Nightly, and it should give better feedback in case something goes wrong.

Eventually, I think it would be better to make most methods non-static, and have
a checked reference-to-instance getter.

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

--HG--
extra : moz-landing-system : lando
2019-10-10 10:51:50 +00:00
Nazım Can Altınova 2e832289ac Bug 1512500 - Record parent page information in profiler r=gerald,nika
Differential Revision: https://phabricator.services.mozilla.com/D47426

--HG--
extra : moz-landing-system : lando
2019-10-09 21:25:19 +00:00
Nazım Can Altınova 6379b166c1 Bug 1583271 - Part 3: Remove the disabled assertion and add a mechanism to capture the first non-auto:blank frame r=nika
We are not simply excluding all about:blanks because there might be some
about:blank that user really visits. But for others we don't want to include
the first about:blank because when a BrowsingContext is loaded, and if the
principal matches, the first document loaded in it will share the inner window.

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

--HG--
extra : moz-landing-system : lando
2019-10-09 20:58:06 +00:00
Nazım Can Altınova 20fc64e558 Bug 1583271 - Part 1: Change profiler page information IDs to BrowsingContextID and InnerWindowID r=gerald,nika
We were keeping nsDocShell::mHistoryId and nsDocShell::mOSHE as keys. They
weren't quite good because:
1. While loading an iframe, they were being registered twice with the same
ids(for about:blank and the real URL) sometimes.
2. It wasn't possible to access to the parent mHistoryId and mOSHE from a child
processes if the parent is in a different process. That may not be the case for
now, but it will be after fission.
So we had to find other IDs to:
1. Determine the Tab of the frames.
2. Determine the URLs of the frames.
For the first use case, we were using nsDocShell::mHistoryId for that purpose
but that was wrong. The closest thing that we can get to a tab ID is
BrowsingContext ID because they don't change after a navigation. But iframes
have different BrowsingContext's, so we still need to create a tree to
construct a tab content. That can be either in the front-end or capture time.
For the second use case, we were using a key pair of mHistoryId and mOSHE. We
now chose to keep inner window IDs for that purpose. Inner window IDs are
unique for each navigation loads because inner window correspond to each JS
window global objects. That's why we can use that without any problem. But one
problem is that we cannot handle `history.pushState` and `history.replaceState`
changes with that change since window global objects won't change during those.
But that was the best thing we can do after fission. So this will be a small
sacrifice for us to keep that functionality working after fission.
In that patch we also remove the registration/unregistration calls. We are
going to add those calls in the next patch.

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

--HG--
extra : moz-landing-system : lando
2019-10-09 21:25:11 +00:00
Gerald Squelart 499b5db10f Bug 1583868 - New profiler feature "nostacksampling" - r=gregtatum
Previously, the absence of "stackwalk", "leaf", and "javascript" implied that
the test/user didn't want any sampling, but this caused issues in some tests
that enabled "stackwalk" on platforms that didn't support stack-walking, which
ended up suppressing label-only stacks that the test expected.

we now have an explicit feature "nostacksampling" that disables backtraces from
the samplers in both profilers. This effectively cancels "stackwalk", "leaf",
and "javascript" if present.

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

--HG--
extra : moz-landing-system : lando
2019-10-01 22:49:13 +00:00
Brindusan Cristian 79e9f1a034 Backed out changeset 8989d1a83de8 (bug 1583868) for xpcshell failures at test_ext_geckoProfiler_schema.js. CLOSED TREE 2019-10-01 22:27:11 +03:00
Gerald Squelart fa7dc1a809 Bug 1583868 - New profiler feature "nostacksampling" - r=gregtatum
Previously, the absence of "stackwalk", "leaf", and "javascript" implied that
the test/user didn't want any sampling, but this caused issues in some tests
that enabled "stackwalk" on platforms that didn't support stack-walking, which
ended up suppressing label-only stacks that the test expected.

we now have an explicit feature "nostacksampling" that disables backtraces from
the samplers in both profilers. This effectively cancels "stackwalk", "leaf",
and "javascript" if present.

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

--HG--
extra : moz-landing-system : lando
2019-10-01 14:00:21 +00:00
Gerald Squelart 16dbd4f365 Bug 1582992 - Removed unneded BlocksRingBuffer's entry destructor, and ProfilerBuffer's JS::AutoSuppressGCAnalysis - r=gregtatum
`BlocksRingBuffer` had an "entry destructor" to make it a more generic
container, and it was useful during early prototyping of the new profiler
storage (so that we could store owning pointers).
But this entry destructor is stored in an `std::function`, which gets marked as
a potential GC caller by the js rooting hazard analyzer; and as this bug found,
it's not obvious where to place `JS::AutoSuppressGCAnalysis`, because profiler
entries (including stacks) could be added on one thread while GC happens
elsewhere, which triggers the embedded `AutoAssertNoGC` check.

Since we don't actually use the entry destructor facility in the profiler, it's
easier to just get rid of it. As a bonus, it's a small optimization.
Tests that were using an entry destructor now use the `State` instead, to verify
that entries are pushed and cleared as expected.

If needed in the future outside of the profiler, `BlocksRingBuffer` could again
include an entry destructor, but it would have to be through templating, so that
the class used in the profiler wouldn't contain an `std::function`.

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

--HG--
extra : moz-landing-system : lando
2019-09-23 20:50:20 +00:00
Gerald Squelart 1549c7e36e Bug 1582357 - Allow profiler entries up to the size of the buffer - r=gregtatum
In some situations, entries may in fact take more than half the buffer size
(e.g., when duplicating a stack into a small temporary buffer).
So we now allow blocks to take the full buffer size -- but not more, as they
would start overwriting themselves!

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

--HG--
extra : moz-landing-system : lando
2019-09-19 13:40:01 +00:00
Gerald Squelart 64ec6b96a0 Bug 1581049 - BlocksRingBuffer (de)serializer uses optimized inter-ModuloBuffer copier - r=gregtatum
Instead of copying `BlocksRingBuffer` data byte-by-byte (using iterators byte
dereferencers), we can now use `ModuloBuffer::Iterator::ReadInto(Iterator&)` to
copy them using a small number of `memcpy`s.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:22:42 +00:00
Gerald Squelart 229768ce0a Bug 1581049 - ModuloBuffer::Iterator::ReadInto(ModuloBuffer::Iterator&) - r=gregtatum
Some objects are copied byte-by-byte to/from `ModuloBuffer`s.
E.g., serialized `BlocksRingBuffer`s, or duplicate stacks. (And more to come.)

`Iterator::ReadInto(Iterator&)` optimizes these copies by using the minimum
number of `memcpy`s possible.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:22:30 +00:00
Gerald Squelart 738f482766 Bug 1578329 - profiler_can_accept_markers(), don't store markers when paused - r=gregtatum
profiler_can_accept_markers() is a fast and racy check that markers would
currently be stored, it should be used around potentially-expensive calls to
add markers.

And now markers are no longer stored when the profiler is paused. (Note that the
profiler is paused when a profile is being stored, this will help make this
operation faster.)

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:21:50 +00:00
Gerald Squelart a8b053c3b1 Bug 1578327 - Discard old data just before streaming - r=gregtatum
Since all profiler data is now stored inside ProfileBuffer, there is no real
need to continuously discard old data during sampling (this was particularly
useful to reclaim memory taken by old markers&payloads).

Instead, we can now just discard the old data once, just before starting to
stream it to JSON.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:21:32 +00:00
Gerald Squelart 58ac06a047 Bug 1576555 - Remove unneeded ProfilerMarker - r=gregtatum
Now that what was in ProfilerMarker is stored directly in `BlocksRingBuffer`,
there is no need for this class anymore!
This also removes all the pointer management around it (when added to a TLS
list, moved during sampling, deleted when expired).

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:21:20 +00:00
Gerald Squelart 02d2886883 Bug 1576555 - Don't store temporary ProfilerMarkerPayloads in UniquePtrs - r=gregtatum
Since payloads are not kept alive long after they have been serialized, we can
just create them on the stack and pass a reference to their base (or pointer,
`nullptr` representing "no payloads") to `profiler_add_marker()`.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:21:02 +00:00
Gerald Squelart 666a5caa9d Bug 1576555 - Store markers directly into BlocksRingBuffer - r=gregtatum
Markers and their payloads can now be serialized straight into the profiler's
`BlocksRingBuffer`, which is now thread-safe to allow such concurrent accesses
(even when gPSMutex is not locked).
This already saves us from having to allocate a `PayloadMarker` on the heap, and
from having to manage it in different lists.

The now-thread-safe `BlocksRingBuffer` in `CorePS` cannot be used inside the
critical section of `SamplerThread::Run`, because any mutex function could hang
because of the suspended thread (even though they functionally don't appear to
interact). So the sampler now uses a local `BlocksRingBuffer` without mutex.
As a bonus, the separate buffer helps reduce the number of concurrent locking
operations needed when capturing the stack.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:20:45 +00:00
Gerald Squelart 06043a38e3 Bug 1576555 - BlocksRingBuffer::AppendContents(const BlocksRingBuffer&) - r=gregtatum
Copy the full contents of BlocksRingBuffer into another one.
This is mainly useful to use a temporary buffer to store some data without
contentions, and then integrate the temporary buffer into the main one.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:20:28 +00:00
Gerald Squelart fc93e3d9da Bug 1575448 - De/serialize ProfilerMarkerPayload derived objects - r=gregtatum
Payloads will serialize themselves into a `BlocksRingBuffer` entry when first
captured.
Later they will be deserialized, to stream JSON for the output profile.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:20:10 +00:00
Gerald Squelart 0ffe75f626 Bug 1575448 - ProfilerMarkerPayload::CommonProps - r=gregtatum
The common data members stored in the ProfilerMarkerPayload base class can be
gathered into a struct, which will make it easier to pass around, especially
when a derived object is constructed with these common properties.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:19:53 +00:00
Gerald Squelart ac26c5d9f5 Bug 1576554 - {S,Des}erializer<ProfilerBacktrace> - r=gregtatum
Markers may contain backtraces, so we need to be able to de/serialize them.
This involves de/serializing the underyling `BlocksRingBuffer`.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:19:40 +00:00
Gerald Squelart 9f7c402a79 Bug 1576551 - Store BlocksRingBuffer outside of ProfileBuffer - r=gregtatum
The main `BlocksRingBuffer`s will be stored in `CorePS` (outside of
`ProfileBuffer`s), as we need to be able to safely access the underlying buffers
when profilers are not enabled.

Also `ProfilerBacktrace` will own the `BlocksRingBuffer` that its captured
`ProfileBuffer` uses.

Taking this opportunity to rename the different `mBuffer`s to more useful names.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:19:21 +00:00
Gerald Squelart 74301e6c5c Bug 1576551 - Assume capacity is in 8-byte entries - r=gregtatum
Now that we are using a byte-oriented `BlocksRingBuffer` instead of an array of
9-byte `ProfileBufferEntry`'s, internally the profiler sets the buffer size in
bytes. However all external users (popup, tests, etc.) still assume that the
requested capacity is in entries!

To limit the amount of changes, we will keep assuming externally-visible
capacities are in entries, and convert them to bytes.
Even though entries used to be 9 bytes each, and `BlocksRingBuffer` adds 1 byte
for the entry size, some entries actually need less space (e.g., 32-bit numbers
now take 6 bytes instead of 9), so converting to less than 9 bytes per entry is
acceptable.
We are settling on 8 bytes per entry: It's close to 9, and it's a power of two;
since the effective number of entries was a power of two, and `BlocksRingBuffer`
also uses a power of two size in bytes, this convertion keeps sizes in powers of
two.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:19:14 +00:00
Gerald Squelart 6666138a83 Bug 1576551 - Use BlocksRingBuffer in ProfileBuffer - r=gregtatum
This just replaces `ProfileBuffer`'s self-managed circular buffer with a
`BlocksRingBuffer`.

That `BlocksRingBuffer` does not need its own mutex (yet), because all uses go
through gPSMutex-guarded code.

`ProfileBuffer` now also pre-allocates a small buffer for use in
`DuplicateLastSample()`, this avoids multiple mallocs at each sleeping thread
stack duplication.

Note: Internal "magic" sizes have been multiplied by 8 (and tweaked upwards, to
handle bigger stacks), because they originally were the number of 9-byte
entries, but now it's the buffer size in bytes. (And entries can now be smaller
than 9 bytes, so overall the capacity in entries should be similar or better.)
However, external calls still think they are giving a number of "entries", this
will be handled in the next patch.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:19:12 +00:00
Gerald Squelart 82b9f4f30f Bug 1576551 - AUTO_PROFILER_STATS(locked_profiler_stream_json_for_this_process) - r=gregtatum
Add some stats (off by default) around streaming JSON, as the following patches
may affect it.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:19:10 +00:00
Gerald Squelart c90cc7f5b7 Bug 1580091 - Use BaseProfilerMaybeMutex in BlocksRingBuffer - r=gregtatum
In some situations we will *need* to use a `BlocksRingBuffer` that absolutely
does not use a mutex -- In particular in the critical section of
`SamplerThread::Run()`, when a thread is suspended, because any action on any
mutex (even a private one that no-one else interacts with) can result in a hang.

As a bonus, `BlocksRingBuffer`s that are known not to be used in multi-thread
situations (e.g., backtraces, extracted stacks for duplication, etc.) will waste
less resources trying to lock/unlock their mutex.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:19:08 +00:00
Gerald Squelart cac9b1645b Bug 1580091 - BaseProfilerMaybeMutex and BaseProfilerMaybeAutoLock - r=gregtatum
`BaseProfilerMaybeMutex` wraps a `BaseProfilerMutex` inside a `Maybe`.
The decision to use a mutex or not is set at construction time.
If there is no mutex, all operations do nothing (at the small cost of checking
if the mutex is present.)

`BaseProfilerMaybeAutoLock` is the recommented RAII object to lock and
automatically unlock a `BaseProfilerMaybeMutex` until the end of a block scope.

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

--HG--
extra : moz-landing-system : lando
2019-09-18 01:19:06 +00:00
Bogdan Tara 361c83c1a9 Backed out 21 changesets (bug 1578327, bug 1575448, bug 1580091, bug 1576554, bug 1581049, bug 1576551, bug 1578329, bug 1576555) for platform.cpp related bustage CLOSED TREE
Backed out changeset 27afea20c396 (bug 1581049)
Backed out changeset be1ec4577d37 (bug 1581049)
Backed out changeset b4b6bbb18cc1 (bug 1581049)
Backed out changeset b30942f9db54 (bug 1581049)
Backed out changeset 473c431866f7 (bug 1578329)
Backed out changeset ac492dc3df20 (bug 1578329)
Backed out changeset f51875652f6f (bug 1578327)
Backed out changeset 512b7cbd18f6 (bug 1576555)
Backed out changeset 2d63a9934c00 (bug 1576555)
Backed out changeset ff73f648ab6c (bug 1576555)
Backed out changeset 49f49079bbb5 (bug 1576555)
Backed out changeset e8323157c6f3 (bug 1575448)
Backed out changeset 3b0d726f2dd6 (bug 1575448)
Backed out changeset 5924790abc4b (bug 1576554)
Backed out changeset a14ac9bb5338 (bug 1576554)
Backed out changeset b6d73f5042a7 (bug 1576551)
Backed out changeset 366030bd2d84 (bug 1576551)
Backed out changeset d7ee4148aad9 (bug 1576551)
Backed out changeset ec72dfc7301e (bug 1576551)
Backed out changeset 79b29286f906 (bug 1580091)
Backed out changeset 6f34c2e57ccf (bug 1580091)
2019-09-17 10:16:14 +03:00
Gerald Squelart 541c78764a Bug 1581049 - BlocksRingBuffer (de)serializer uses optimized inter-ModuloBuffer copier - r=gregtatum
Instead of copying `BlocksRingBuffer` data byte-by-byte (using iterators byte
dereferencers), we can now use `ModuloBuffer::Iterator::ReadInto(Iterator&)` to
copy them using a small number of `memcpy`s.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:54:21 +00:00
Gerald Squelart 4c2ab062ce Bug 1581049 - ModuloBuffer::Iterator::ReadInto(ModuloBuffer::Iterator&) - r=gregtatum
Some objects are copied byte-by-byte to/from `ModuloBuffer`s.
E.g., serialized `BlocksRingBuffer`s, or duplicate stacks. (And more to come.)

`Iterator::ReadInto(Iterator&)` optimizes these copies by using the minimum
number of `memcpy`s possible.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:54:03 +00:00
Gerald Squelart b643004d63 Bug 1578329 - profiler_can_accept_markers(), don't store markers when paused - r=gregtatum
profiler_can_accept_markers() is a fast and racy check that markers would
currently be stored, it should be used around potentially-expensive calls to
add markers.

And now markers are no longer stored when the profiler is paused. (Note that the
profiler is paused when a profile is being stored, this will help make this
operation faster.)

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:53:54 +00:00
Gerald Squelart 7d435fc17a Bug 1578327 - Discard old data just before streaming - r=gregtatum
Since all profiler data is now stored inside ProfileBuffer, there is no real
need to continuously discard old data during sampling (this was particularly
useful to reclaim memory taken by old markers&payloads).

Instead, we can now just discard the old data once, just before starting to
stream it to JSON.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:53:52 +00:00
Gerald Squelart 79e1b2e357 Bug 1576555 - Remove unneeded ProfilerMarker - r=gregtatum
Now that what was in ProfilerMarker is stored directly in `BlocksRingBuffer`,
there is no need for this class anymore!
This also removes all the pointer management around it (when added to a TLS
list, moved during sampling, deleted when expired).

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:53:50 +00:00
Gerald Squelart 8364b4ebdb Bug 1576555 - Don't store temporary ProfilerMarkerPayloads in UniquePtrs - r=gregtatum
Since payloads are not kept alive long after they have been serialized, we can
just create them on the stack and pass a reference to their base (or pointer,
`nullptr` representing "no payloads") to `profiler_add_marker()`.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 02:32:21 +00:00
Gerald Squelart b48590ff79 Bug 1576555 - Store markers directly into BlocksRingBuffer - r=gregtatum
Markers and their payloads can now be serialized straight into the profiler's
`BlocksRingBuffer`, which is now thread-safe to allow such concurrent accesses
(even when gPSMutex is not locked).
This already saves us from having to allocate a `PayloadMarker` on the heap, and
from having to manage it in different lists.

The now-thread-safe `BlocksRingBuffer` in `CorePS` cannot be used inside the
critical section of `SamplerThread::Run`, because any mutex function could hang
because of the suspended thread (even though they functionally don't appear to
interact). So the sampler now uses a local `BlocksRingBuffer` without mutex.
As a bonus, the separate buffer helps reduce the number of concurrent locking
operations needed when capturing the stack.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:52:16 +00:00
Gerald Squelart 6d95d503f5 Bug 1576555 - BlocksRingBuffer::AppendContents(const BlocksRingBuffer&) - r=gregtatum
Copy the full contents of BlocksRingBuffer into another one.
This is mainly useful to use a temporary buffer to store some data without
contentions, and then integrate the temporary buffer into the main one.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:51:53 +00:00
Gerald Squelart 5b86107991 Bug 1575448 - De/serialize ProfilerMarkerPayload derived objects - r=gregtatum
Payloads will serialize themselves into a `BlocksRingBuffer` entry when first
captured.
Later they will be deserialized, to stream JSON for the output profile.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:51:41 +00:00
Gerald Squelart 64f0dcdf95 Bug 1575448 - ProfilerMarkerPayload::CommonProps - r=gregtatum
The common data members stored in the ProfilerMarkerPayload base class can be
gathered into a struct, which will make it easier to pass around, especially
when a derived object is constructed with these common properties.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:51:18 +00:00
Gerald Squelart a14e2c944d Bug 1576554 - {S,Des}erializer<ProfilerBacktrace> - r=gregtatum
Markers may contain backtraces, so we need to be able to de/serialize them.
This involves de/serializing the underyling `BlocksRingBuffer`.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 02:16:04 +00:00
Gerald Squelart 003cded47d Bug 1576551 - Store BlocksRingBuffer outside of ProfileBuffer - r=gregtatum
The main `BlocksRingBuffer`s will be stored in `CorePS` (outside of
`ProfileBuffer`s), as we need to be able to safely access the underlying buffers
when profilers are not enabled.

Also `ProfilerBacktrace` will own the `BlocksRingBuffer` that its captured
`ProfileBuffer` uses.

Taking this opportunity to rename the different `mBuffer`s to more useful names.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 02:12:42 +00:00