Commit Graph

216 Commits

Author SHA1 Message Date
Markus Stange
ddece4ba4f Bug 1630895 - Infer categories for Java frames. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D71383
2020-04-17 23:30:10 +00:00
Gerald Squelart
97cb0a90bd Bug 1626837 - ProfileChunkedBuffer (de)serialization - r=canaltinova
This is needed to embed a small buffer (e.g., containing one backtrace attached
to a marker) into a bigger buffer (e.g., the main profiler buffer).

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

--HG--
extra : moz-landing-system : lando
2020-04-15 03:26:06 +00:00
Gerald Squelart
1feb663e29 Bug 1626837 - ProfileChunkedBuffer read functions - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D69498

--HG--
extra : moz-landing-system : lando
2020-04-15 03:25:48 +00:00
Gerald Squelart
8e1dfc3db0 Bug 1626837 - ProfileChunkedBuffer detail::InChunkPointer - r=canaltinova
`InChunkPointer` is an internal accessor pointing at a position inside a chunk.
It can handle up to two groups of chunks (typically the extant chunks stored in
the chunk manager, and the current chunk.

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

--HG--
extra : moz-landing-system : lando
2020-04-15 03:25:40 +00:00
Gerald Squelart
23b9adb050 Bug 1626837 - ProfileChunkedBuffer write functions - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D69496

--HG--
extra : moz-landing-system : lando
2020-04-15 03:25:33 +00:00
Gerald Squelart
b001bcf853 Bug 1626837 - ProfileChunkedBuffer chunk request mechanism - r=canaltinova
To ensure that a spare chunk is ready to handle data that will eventually
overflow the current chunk, `ProfileChunkedBuffer` uses
`ProfileBufferChunk::RequestChunk()` to queue a request for a new chunk.

This request should be handled off-thread by the buffer user -- but a response
is not guaranteed, so the buffer does not rely on it and can get a new chunk
on the spot if really needed.

Because the request is asynchronous, and because either the buffer or the user
could be destroyed while a request is in flight, a shared
`RequestedChunkRefCountedHolder` object is used:
- When the request is handled, the new chunk (or nullptr) is given to the
  holder.
- When the buffer needs a new chunk, it can retrieve the new chunk if the
  request was successfully fulfilled.
If the requestee is destroyed first, the request won't be fulfilled and the
buffer will carry on without relying on requests.
If the requester is destroyed first, the holder (with a potential requested
chunk) will just get destroyed after the request is fulfilled or the requestee
is destroyed as well.

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

--HG--
extra : moz-landing-system : lando
2020-04-15 03:21:45 +00:00
Gerald Squelart
61054fffee Bug 1626837 - ProfileChunkedBuffer ChunkManager handling - r=canaltinova
`ProfileChunkedBuffer` can handle zero or one `ProfileBufferChunkManager` at a
time, and can optionally take ownership of the manager.

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

--HG--
extra : moz-landing-system : lando
2020-04-15 03:21:27 +00:00
Gerald Squelart
dcbdec35d9 Bug 1626837 - ProfileChunkedBuffer basic data and functions - r=canaltinova
ProfileChunkedBuffer simulates a near-infinite buffer over ProfileBufferChunks.
It uses a ProfileBufferChunkManager to get chunks and later release them.
Its use is similar to BlocksRingBuffer:
- It reserves blocks in chunks, adds some structure (just the size of the entry
  that follows), and lets a user-provided writer write the entry.
- It allows reading past entries.
- It can be in an "out-of-session" state where APIs are still available but do
  nothing.

It is intended to eventually replace BlocksRingBuffer.

This patch starts with the basic structure, following patches will add all
planned features.

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

--HG--
extra : moz-landing-system : lando
2020-04-15 03:21:09 +00:00
Gerald Squelart
989ad20d1d Bug 1626837 - Add BlocksRingBuffer::IsInSession() - r=canaltinova
`ProfileBuffer` used to check if a `BlocksRingBuffer` was in session by looking
at its buffer size.
Now `IsInSession()` should be used, it is clearer in intent, and will make the
transition to `ProfileChunkedBuffer` slightly easier.

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

--HG--
extra : moz-landing-system : lando
2020-04-15 03:20:51 +00:00
Gerald Squelart
ca9fa3fe8f Bug 1627563 - Replace MOZ_MUST_USE with [[nodiscard]] in mozglue/baseprofiler. r=canaltinova
Also move MOZ_MUST_USE before function declarations' specifiers and return type. While clang and gcc's attribute((warn_unused_result)) can appear before, between, or after function specifiers and return types, the [[nodiscard]] attribute must precede the function specifiers.

And removed a few unneded `#include "mozilla/Attributes.h"`.

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

--HG--
extra : moz-landing-system : lando
2020-04-06 10:04:38 +00:00
Gerald Squelart
d4709d16f3 Bug 1625856 - ProfileBufferChunkManagerWithLocalLimit - r=canaltinova
`ProfileBufferChunkManagerWithLocalLimit` is a chunk manager that enforces a
memory limit in each process.

It is meant to mimic the main way `BlocksRingBuffer` works, so that we can more
easily switch to the new buffer storage without introducing the extra complexity
of inter-process memory coordination yet.

`ProfileBufferChunkManagerWithLocalLimit` will still offer a benefit over
`BlocksRingBuffer`, in that it won't allocate the maximum buffer size
immediately -- speeding the initialization, and hopefully even reducing the
total Firefox memory consumption in short-lived processes.

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

--HG--
extra : moz-landing-system : lando
2020-04-02 03:09:36 +00:00
Gerald Squelart
de1f096fd6 Bug 1624257 - ProfileBufferChunkManagerSingle - r=canaltinova
Chunk manager dealing with only one chunk at a time.

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

--HG--
extra : moz-landing-system : lando
2020-03-29 23:49:32 +00:00
Gerald Squelart
2e503c9a92 Bug 1624257 - ProfileBufferChunkManager - r=canaltinova
Base class for chunk managers.

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

--HG--
extra : moz-landing-system : lando
2020-03-29 23:25:35 +00:00
André Bargull
13bfe75b97 Bug 1625138 - Part 40: Replace remaining mozilla::IsSame with std::is_same. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68560

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:21 +00:00
James Willcox
2ef4e466f8 Bug 1291377 - Don't use custom linker on Android 6.0+ r=glandium
We still need it for Android < 6.0 (API 23) because otherwise we don't
have a way to hook up mozalloc.

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

--HG--
extra : moz-landing-system : lando
2020-03-20 15:35:48 +00:00
Gerald Squelart
c80fa7258c Bug 1623228 - ProfileBufferChunk - r=canaltinova
A `ProfileBufferChunk` represents a single chunk of memory, with an optional
link to the next chunk.

In the new Fission-compatible profiler storage, chunks will be allocated by a
chunk manager, filled with data by the profiler, and then released back to the
chunk manager.
The chunk manager may decide to destroy or recycle old chunks based on memory
limits (per process, or for the entire Firefox app).

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

--HG--
extra : moz-landing-system : lando
2020-03-24 01:04:33 +00:00
Razvan Maries
f86965f8af Backed out changeset 1a28a2477439 (bug 1623228) for build bustages on ProfileBufferChunk.h. CLOSED TREE 2020-03-23 23:29:12 +02:00
Gerald Squelart
df0599ee6d Bug 1623228 - ProfileBufferChunk - r=canaltinova
A `ProfileBufferChunk` represents a single chunk of memory, with an optional
link to the next chunk.

In the new Fission-compatible profiler storage, chunks will be allocated by a
chunk manager, filled with data by the profiler, and then released back to the
chunk manager.
The chunk manager may decide to destroy or recycle old chunks based on memory
limits (per process, or for the entire Firefox app).

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

--HG--
extra : moz-landing-system : lando
2020-03-23 18:16:08 +00:00
Bogdan Tara
05377fcd08 Backed out changeset fe0c22951e7c (bug 1291377) for mozglue related Android bustages CLOSED TREE 2020-03-20 16:39:42 +02:00
James Willcox
e2c25ee165 Bug 1291377 - Don't use custom linker on Android 6.0+ r=glandium
We still need it for Android < 6.0 (API 23) because otherwise we don't
have a way to hook up mozalloc.

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

--HG--
extra : moz-landing-system : lando
2020-03-20 14:20:48 +00:00
Gerald Squelart
7dd306dcd9 Bug 1623195 - Optimize ProfileBufferEntryWriter::Serializer<Variant> - r=canaltinova
The old code was using `std::index_sequence_for` to call templated functions for
*every* possible Variant alternative.
Instead, using `Variant::match()` with a generic lambda (that also takes the
current Variant index, thanks to bug 1621865) means we're only calling the
function corresponding to the current alternative.

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

--HG--
extra : moz-landing-system : lando
2020-03-18 10:23:10 +00:00
Chris Fronk
d5b004443b Bug 1143478 - Rename mozilla::Pair to CompactPair. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D64511

--HG--
rename : mfbt/Pair.h => mfbt/CompactPair.h
extra : moz-landing-system : lando
2020-03-17 12:42:12 +00:00
Markus Stange
3349423265 Bug 1557570 - Build the base profiler on Android. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D64998

--HG--
extra : moz-landing-system : lando
2020-03-17 03:27:35 +00:00
Markus Stange
de0a0463d6 Bug 1557570 - Make baseprofiler/core/shared-libraries-linux.cc compile on Android. r=glandium
Stop including "Linker.h" and always include <link.h> instead, which also comes with ElfW() and other things that this code needs.
Also fix up "!/" path detection code.

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

--HG--
extra : moz-landing-system : lando
2020-03-17 03:26:57 +00:00
Markus Stange
6d980e05bb Bug 1618979 - Use PrintToConsole for things that should always be printed. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D64996

--HG--
extra : moz-landing-system : lando
2020-03-17 03:26:19 +00:00
Markus Stange
e3cd7fc71c Bug 1618979 - Tweak base profiler logging. r=gerald
This fixes the declaration of (BaseProfiler)LogTest. It also makes it so that the logs show up on Android.
In xpcom we have printf_stderr which does something similar and also handles Windows.

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

--HG--
extra : moz-landing-system : lando
2020-03-17 03:25:40 +00:00
Markus Stange
e54247708a Bug 1619362 - Sync up the two profiler feature lists again. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D65012

--HG--
extra : moz-landing-system : lando
2020-03-17 03:25:02 +00:00
Markus Stange
f38f79b818 Bug 1619362 - Remove two unused variables. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D64990

--HG--
extra : moz-landing-system : lando
2020-03-17 03:24:23 +00:00
Markus Stange
345b2ee888 Bug 1619362 - Parse MOZ_BASE_PROFILER_STARTUP_DURATION and _INTERVAL. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D64988

--HG--
extra : moz-landing-system : lando
2020-03-17 04:11:20 +00:00
Gerald Squelart
bc32add109 Bug 1622179 - Replace direct dependencies on BlocksRingBuffer with ProfileBufferEntryWriter's where possible - r=canaltinova
This removes most dependencies on BlocksRingBuffer, to ease the transition to
the upcoming Fission-friendly profile buffer, including:
- Length type,
- SumBytes(),
- Gecko extensions of serialization.

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

--HG--
rename : tools/profiler/public/BlocksRingBufferGeckoExtensions.h => tools/profiler/public/ProfileBufferEntrySerializationGeckoExtensions.h
extra : moz-landing-system : lando
2020-03-16 20:32:35 +00:00
Gerald Squelart
3aec963bb6 Bug 1621866 - Use C++17 fold expressions in ProfileBufferEntrySerialization.h - r=canaltinova
Fold expressions are more expressive and probably produce better code than the
older template-recursion and initializer_list patterns.

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

--HG--
extra : moz-landing-system : lando
2020-03-12 21:05:31 +00:00
Bob Owen
22f20a8d00 Bug 1557282 Part 2: Fix profiler issues when using SetLockdownDefaultDacl. r=dmajor
When we are running from a network drive the new feature in part 1 doesn't work.
So this uses DuplicateHandle instead of OpenThread to get the thread handle used
by the profiler.
It also removes a DuplicateHandle THREAD_ALL_ACCESS call that also fails and a
DuplicateHandle to get a real process handle, which only seems to have been to
fix something on Windows XP.
The handle passed in is always the profiler one, so already has the necessary
permissions. If no thread handle is passed then the pseudo handle is used.

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

--HG--
extra : moz-landing-system : lando
2020-03-12 20:40:50 +00:00
Narcis Beleuzu
feebca4edf Backed out 4 changesets (bug 1557282) as requested by tjr . CLOSED TREE
Backed out changeset deabd1e1018b (bug 1557282)
Backed out changeset 25e5b5ba8ac3 (bug 1557282)
Backed out changeset 30afcaf2782a (bug 1557282)
Backed out changeset f83095f739e0 (bug 1557282)

--HG--
extra : rebase_source : 1730b805fbd8d0b786f7dcec71aa9c02a8f7a93a
2020-03-12 19:39:27 +02:00
Bob Owen
f25e4ba8c6 Bug 1557282 Part 2: Fix profiler issues when using SetLockdownDefaultDacl.
When we are running from a network drive the new feature in part 1 doesn't work.
So this uses DuplicateHandle instead of OpenThread to get the thread handle used
by the profiler.
It also removes a DuplicateHandle THREAD_ALL_ACCESS call that also fails and a
DuplicateHandle to get a real process handle, which only seems to have been to
fix something on Windows XP.
The handle passed in is always the profiler one, so already has the necessary
permissions. If no thread handle is passed then the pseudo handle is used.

Depends on D66610

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

--HG--
extra : moz-landing-system : lando
2020-03-12 16:57:45 +00:00
Gerald Squelart
9e0576b94c Bug 1620515 - Replace BlocksRingBuffer::EntryReader/Writer with ProfileBufferEntryReader/Writer - r=canaltinova
The new ProfileBufferEntryReader/Writer are now used everywhere, including in
the profilers and tests.
The old EntryReader/Writer have been removed.

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

--HG--
extra : moz-landing-system : lando
2020-03-11 21:59:19 +00:00
Gerald Squelart
7803bc357b Bug 1620515 - ProfileBufferEntryReader and ProfileBufferEntryWriter - r=canaltinova
Actual implementation of the entry reader and writer.
They expose a very similar API as the original BlocksRingBuffer entry reader&
writer.

(No tests here; In the next patch they will get used instead of the old reader&
writer, and will hence inherit all relevant tests.)

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

--HG--
extra : moz-landing-system : lando
2020-03-11 21:57:31 +00:00
Gerald Squelart
119ca02f31 Bug 1620515 - ProfileBufferEntrySerialization.h with (de)serializers - r=canaltinova
ProfileBufferEntrySerialization.h will contain the entry reader and writer.

This patch creates the file with renamed copies of the (de)serializers from
BlocksRingBuffer; there shouldn't be significant code changes, this `hg cp` will
help keep their history. See next patch for how they will actually be used.

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

--HG--
rename : mozglue/baseprofiler/public/BlocksRingBuffer.h => mozglue/baseprofiler/public/ProfileBufferEntrySerialization.h
extra : moz-landing-system : lando
2020-03-11 21:56:50 +00:00
Gerald Squelart
d156810f51 Bug 1620515 - Revert order of BlocksRingBuffer (de)serializer declarations - r=canaltinova
Only reordering declarations, to make the next patch easier to read.

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

--HG--
extra : moz-landing-system : lando
2020-03-11 21:56:17 +00:00
shindli
b02b3a6e1a Backed out changeset a08637fb30c8 (bug 1143478) for causing bustages in /builds/worker/checkouts/gecko/ipc/mscom/Registration.cpp CLOSED TREE
--HG--
rename : mfbt/CompactPair.h => mfbt/Pair.h
2020-03-11 14:30:54 +02:00
Chris Fronk
a27e438c2d Bug 1143478 - Rename mozilla::Pair to CompactPair. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D64511

--HG--
rename : mfbt/Pair.h => mfbt/CompactPair.h
extra : moz-landing-system : lando
2020-03-11 12:18:13 +00:00
Simon Giesecke
a763c5c535 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in mozglue. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D65495

--HG--
extra : moz-landing-system : lando
2020-03-10 08:47:24 +00:00
Mike Hommey
1a58a0ff4f Bug 1619865 - Support pdb paths with forward slashes. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D65286

--HG--
extra : moz-landing-system : lando
2020-03-04 08:02:42 +00:00
Cameron Kaiser
ca26f712dd Bug 1619495 - fix compilation error with ModuloBuffer.h. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D65225

--HG--
extra : moz-landing-system : lando
2020-03-04 01:49:18 +00:00
Gerald Squelart
6a8de0643e Bug 1618406 - Replace BlocksRingBuffer::BlockIndex with ProfileBufferBlockIndex - r=gregtatum,canaltinova
To facilitate the upcoming transition to a new Fission-friendly storage, all
uses of `BlocksRingBuffer::{,Block}Index` are replaced with
`ProfileBuffer{,Block}Index`.

`BlocksRingBuffer::{,Block}Index` are not needed anymore.

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

--HG--
extra : moz-landing-system : lando
2020-03-02 05:34:26 +00:00
Gerald Squelart
6ee54a61e0 Bug 1618406 - Add ProfileBuffer{,Block}Index - r=canaltinova
ProfileBufferIndex.h contains:
- `ProfileBufferIndex`, a generic index into a Profiler buffer.
- `ProfileBufferBlockIndex`, an almost-opaque index that should only point at
  valid (or expired) blocks.

These will soon be used instead of `BlocksRingBuffer::{,Block}Index`, to make
the transition away from `BlocksRingBuffer` easier.

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

--HG--
extra : moz-landing-system : lando
2020-03-02 05:33:25 +00:00
Andrew McCreight
4babb2b5ab Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

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

--HG--
extra : moz-landing-system : lando
2020-02-27 17:39:15 +00:00
Ciure Andrei
00dd87f6f4 Backed out changeset d407a28318e6 (bug 1609815) for causing windows ming bustages CLOSED TREE
--HG--
extra : histedit_source : b2c748e31e0f6ba8fcf9960a336e0bbd361b07e6
2020-02-27 07:05:19 +02:00
Andrew McCreight
b197e1f783 Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

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

--HG--
extra : moz-landing-system : lando
2020-02-27 04:43:48 +00:00
Gerald Squelart
2e862dd93e Bug 1616298 - ULEB128Reader - r=canaltinova
Unsigned LEB128 parser class that can be fed bytes one by one.

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

--HG--
extra : moz-landing-system : lando
2020-02-26 01:40:33 +00:00
Gerald Squelart
29ff6c0fbd Bug 1616298 - Run BaseProfiler-independent tests even when BaseProfiler is not built - r=gregtatum,canaltinova
Some of the BaseProfile headers are always available, even when BaseProfiler
itself is not built, so we should test these in all cases.

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

--HG--
extra : moz-landing-system : lando
2020-02-26 01:39:58 +00:00