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

3184 Коммитов

Автор SHA1 Сообщение Дата
Gerald Squelart 1bc597cb95 Bug 1692934 - Record meta.profilingStartTime in each process - r=canaltinova
This profilingStartTime is the time (relative to the process absolute start
time) when the profiling session started.

Differential Revision: https://phabricator.services.mozilla.com/D151354
2022-07-08 14:23:36 +00:00
Julian Seward f79d07a0fb Bug 1777949 - LUL initialisation: don't use `std::map` in `class CallFrameInfo::RuleMap`. r=mstange.
When reading Dwarf unwind info, `CallFrameInfo::RuleMap::registers_` is a
`std::map<int, Rule>` used to map (Dwarf) register numbers to the current
unwind rule for each number.  These mappings are very small (typically <= 7
elems) and very short lived.  Result is that `std::map` creates a lot of
overhead because it is implemented as a Red-Black tree, and hence does a lot
of malloc/freeing of nodes.

This patch replaces it with a simple vector, wrapped up in a new `class
CallFrameInfo::RuleMapLowLevel`.  Comments have also been improved.  The
resulting performance changes are as follows:

                user time    insns     #malloc       #megabytes
                seconds      million   calls         allocated

x86_64 before   0.42         5609      5,891,857     560.8
x86_64 after    0.27         3906        894,188     323.1

arm64  before   0.46         7697      8,469,659     680.8
arm64  after    0.24         4922      1,043,154     427.1

x86_64: Intel Core i5 1135G7, 4.2GHz, Fedora 35
arm64:  Apple M1, ??? MHz, Fedora 33 running on Parallels Workstation

Differential Revision: https://phabricator.services.mozilla.com/D151261
2022-07-08 13:22:22 +00:00
Florian Quèze d936ea3ff8 Bug 1778315 - Make power counter names more user friendly, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D151128
2022-07-06 23:36:46 +00:00
Nika Layzell 7ced96212e Bug 1778211 - Reject xpidl CDATA containing 'virtual', r=xpcom-reviewers,necko-reviewers,mccr8,dragana
We'll probably want to do something more accurate in the future with a
custom clang static analysis pass which validates that XPIDL interfaces
have the expected vtable and struct layout, however doing so would be
more involved than the string matching done in this patch.

In addition to checking for extra virtual methods, we'll likely also
want to check for data members on interfaces, and reject them unless the
class is marked as `[builtinclass]` in addition to some other attribute
which we'll need to add to prevent them from being implemented in Rust
(as c++ data members will not be reflected by the rust macro).

There were 2 instances of a comment which contained the word 'virtual'
within a CDATA block. These comments were moved out of the CDATA block
to avoid triggering the error.

Differential Revision: https://phabricator.services.mozilla.com/D151068
2022-07-06 14:53:06 +00:00
Julian Seward 6e5e16164d Bug 1777540 - LUL initialisation: inline `CmpExtentsByOffsetLE` so as to speed up sorting of `SecMap::mExtents`. r=mstange.
After parsing Dwarf unwind info, the resulting mExtents array must be sorted
by start address. This forms a significant part of the overall unwind-info
reading cost.

This is done by calling std::sort. Unfortunately the way it is coded, the
comparison function is not inlined, which results in 91 million calls to it
when reading info up to and including for libxul.so.

This small patch turns it into a closure, which is inlined. For (performance)
safety, Extent::offset() is marked inline too.

On an Intel Core i5 1135G7 at circa 4 GHz, this reduces the Dwarf read time
from 0.42 seconds (after bug 1754932 has landed) to 0.35 seconds. Insn count
falls from 5630 million to 4775 million.

Differential Revision: https://phabricator.services.mozilla.com/D150943
2022-07-06 14:03:34 +00:00
Gerald Squelart 7618d829e2 Bug 1777890 - Re-enable the chunk manager logic to limit the global profile buffer memory usage - r=canaltinova
Fix for a regression in bug 1668867, which removed this important line.
Without it, the logic that handles chunk manager updates doesn't run, and the
overall buffer size limit across processes is not enforced anymore.

To catch future regressions, the ProfileBufferGlobalController now adds its
creation timestamp to the profiling log, which can be tested.

Differential Revision: https://phabricator.services.mozilla.com/D150995
2022-07-06 10:01:46 +00:00
Jim Blandy 2f5eb12516 Bug 1777656: Delete mozilla::ipc::SharedMemory::SharedMemorytype. r=nika,media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D150852
2022-07-05 20:08:31 +00:00
Gerald Squelart 6eab60e869 Bug 1676271 - Profile-gathering log - r=canaltinova
This is a special log that's collected while the parent is gathering all the
JSON profiles (its own, and its children's).
This separate log is necessary, because the gathered logs have already
completed and closed their own `profilingLog` object, and it would be much more
difficult to add to them now.

Differential Revision: https://phabricator.services.mozilla.com/D150562
2022-07-05 10:07:03 +00:00
Gerald Squelart 51ff009005 Bug 1676271 - Per-process profiling log - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D150560
2022-07-05 10:07:03 +00:00
Julian Seward 65b11168e8 Bug 1754932 - LUL initialisation: replace `CallFrameInfo::Rule` and 7 children with a fixed-sized structure. r=mstange.
At profiler startup, LUL reads and preprocesses Dwarf unwind info for all
shared objects mapped into the process. That includes libxul.so and around 90
other shared objects on an x86_64-linux build. This takes too long.

Profiling just this reading phase shows a huge number of mallocs and frees
resulting from LulDwarf.cpp. The largest cause of these is the implementation
of a sum-of-products type with 7 variants (CallFrameInfo::*Rule) using C++
inheritance. The variants have different sizes and so have to be boxed (stored
on the heap and referred to by pointers). They are very short lived and this
causes a lot of heap turnover.

For an m-c build on x86_64-linux on Fedora 35 using clang-13.0.0 -g -O2, when
measuring a MOZ_PROFILER_STARTUP=1 run that is hacked so as to exit
immediately after the unwind info for libxul.so has been read, this patch has
the following perf effects:

* run time reduced from 0.50user to 0.41user (Core i5 1135G7, circa 4 GHz)

* heap allocation reduced from 8,087,404 allocs/397,177,435 bytes to
  3,176,936 allocs, 328,204,042 bytes.

* instruction count reduced from 6,848,730,307 to 5,572,028,393.

Main changes are:

* `class CallFrameInfo::Rule` has been completely rewritten, so as to merge
  its 7 children into it, and those children have been removed.  The new
  representation uses just 3 machine words to represent all 7 alternatives.
  The various virtual methods of `class CallFrameInfo::Rule` (`Handle`,
  `operator==`, etc) have been rewritten to use a simple switch-based scheme.

* The code that uses `class CallFrameInfo::Rule` has been changed (but not
  majorly rewritten) so as to pass around instances of it by value, rather
  than pointers to it.  This removes the need to allocate them on the heap.
  To simulate the previous use case where a NULL value had a meaning, the
  revised class in fact has an 8th alternative, `INVALID`, and a routine
  `isVALID`.  INVALID rules are now used in place of NULL pointers to rules as
  previously.

* Accessors and constructors for the revised `class CallFrameInfo::Rule` hide
  the underlying 3-word representation, ensure that the correct
  representational invariants are maintained, and make it impossible to access
  fields that are meaningless for the given variant.  So it's not any less
  safe than the original.

* Additionally, Dwarf expression strings are no longer represented using
  `std::string`.  Instead a new two-word type `ImageSlice` has been provided.
  This avoids all unnecessary (and unknown) overheads with `std::string` and
  provides a significant part of the measured speedup.

Differential Revision: https://phabricator.services.mozilla.com/D139288
2022-07-04 09:19:25 +00:00
Florian Quèze 546587141b Bug 1774844 - Record per process power use on Apple Silicon, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D150511
2022-06-29 21:24:12 +00:00
Florian Queze 73d24d0b31 Bug 1774844 - record EMI data as profiler counters, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D149653
2022-06-29 21:24:12 +00:00
Florian Queze e21c8845f3 Bug 1774844 - Add a new 'Power Use' (ie. 'power') profiler feature, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D150059
2022-06-29 21:24:11 +00:00
Andreea Pavel 488ec4bffd Backed out 3 changesets (bug 1774844) for failing condprof at test_ext_geckoProfiler_schema.js on a CLOSED TREE
Backed out changeset f33bef1f7d56 (bug 1774844)
Backed out changeset b4b82b6892b3 (bug 1774844)
Backed out changeset d98352922a5c (bug 1774844)
2022-06-29 18:29:18 +03:00
Florian Quèze 89aec958ac Bug 1774844 - Record per process power use on Apple Silicon, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D150511
2022-06-29 13:29:45 +00:00
Florian Queze 70377e672b Bug 1774844 - record EMI data as profiler counters, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D149653
2022-06-29 13:29:44 +00:00
Florian Queze 07bd81efcd Bug 1774844 - Add a new 'Power Use' (ie. 'power') profiler feature, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D150059
2022-06-29 13:29:44 +00:00
Florian Queze 48b13164be Bug 1775285 - Counters should output a 0 sample at the beginning of a time without change, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D149890
2022-06-29 13:29:43 +00:00
Mike Hommey 504fed29a9 Bug 1774512 - Update memmap2 to 0.5. r=emilio,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D149463
2022-06-16 20:59:07 +00:00
Jed Davis 46b3c38fe4 Bug 1770905 - Add a validity check to the profiler's use of IPC Shmem. r=gerald
If the child process failed to allocate Shmem (and this isn't a debug
build, where that would cause an assertion failure) when sending
profiling data back to the parent process, it will send an invalid Shmem
and the parent process should not try to use it.

Currently it does do that, and tries to construct an nsACString with
length `(size_t)-1`, which fails a release assertion in the XPCOM string
library and crashes the browser.  With this patch, we'll simply fail to
profile the affected process.

Differential Revision: https://phabricator.services.mozilla.com/D148468
2022-06-15 20:55:23 +00:00
Gerald Squelart 48364b519f Bug 1768722 - Use std::ofstream in nsProfiler::DumpProfileToFileAsync, and reject promise in case of failure - r=florian,mixedpuppy
The geckoProfiler.dumpProfileToFile (extension API) needed to be updated, to create the target directory if necessary. Some xpcshell tests would fail otherwise.

Also improved nsIProfiler.idl docs of dumpProfileToFile{,Async}.

***
Use ofstream, fixed xpcshell tests.

Differential Revision: https://phabricator.services.mozilla.com/D148610
2022-06-15 06:12:08 +00:00
Sylvestre Ledru b848a697dc Bug 1617369 - Reformat recent rust changes with rustfmt r=emilio,extension-reviewers,willdurand
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D148376
2022-06-10 09:21:45 +00:00
Gerald Squelart c8a7fc1427 Bug 1770544 - Avoid AUTO_PROFILER_THREAD_WAKE re-#define in non-MOZ_GECKO_PROFILER builds - r=gaston
This should remove the redefinition warning.
@gaston could you please test it on your system? I've tried simulating a non-MOZ_GECKO_PROFILER build locally, but I'm hitting other build errors -- but maybe I'm doing it wrong. Thanks!

Differential Revision: https://phabricator.services.mozilla.com/D148582
2022-06-08 22:24:24 +00:00
Mike Hommey 2b227894ee Bug 1771993 - Fix warnings about whitelist/blocklist functions being deprecated in bindgen 0.59. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D147695
2022-05-31 21:40:29 +00:00
Mike Hommey 1b60385e51 Bug 1770894 - Update profiler-helper to object 0.28. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D147256
2022-05-30 21:37:36 +00:00
Mike Hommey 7b06b12d90 Bug 1770894 - Update in-tree crates to bindgen 0.59. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D147221
2022-05-30 21:37:31 +00:00
Florian Quèze 2c19c7b396 Bug 1767497 - record debug build messages from NS_DebugBreak as profiler markers, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D145357
2022-05-04 07:28:37 +00:00
Mike Hommey 08edf30a1b Bug 1766561 - Add missing l modifier for long formatting. r=Jamie,media-playback-reviewers,gfx-reviewers,nika,necko-reviewers,mhowell,rkraesig,gerald,application-update-reviewers,bytesized,alwu,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D144917
2022-05-03 20:49:08 +00:00
Gerald Squelart 8f08153522 Bug 1763176 - Don't move to the next entry after streaming a counter, as it would skip an immediately-adjacent counter - r=canaltinova
If the sampler records more than one counter (e.g.: memory and per-process CPU), both counters could appear right next to each other in the buffer.
But then the current streaming code goes something like this:
1. Read entry
2. If entry is a counter, go to the next entry (which should be a timestamp) and output the full counter.
3. Go to the next entry.
4: Return to step 1 (until there are no more entries).

The problem is this unconditional 3rd step:
If we've just read a counter at step 2, we're located at the entry *past* that counter's data, which could be the start of the next counter, that the 3rd step now effectively skips!

Also:
- After reading the time, we can do e.Next() to skip it before testing if it's too old, this may save one loop.
- After reading the optional "number", we can also do e.Next() to skip it, which will save one loop as well.

Differential Revision: https://phabricator.services.mozilla.com/D145056
2022-04-29 12:30:50 +00:00
Florian Quèze 03db74e131 Bug 1766210 - Avoid using GetCpuTimeSinceThreadStartInNs when MOZ_GECKO_PROFILER is not defined (tier 3 platforms), r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D144541
2022-04-27 07:21:59 +00:00
Florian Quèze 34c0c5a32a Bug 1763474 - Report thread wake-ups and CPU time per thread through glean, r=gerald,chutten
Differential Revision: https://phabricator.services.mozilla.com/D141147
2022-04-23 11:38:19 +00:00
Gerald Squelart c0482a75ea Bug 1765922 - Ensure/ReleaseBufferForMainThreadAddMarker from main thread in profiler_start/stop - r=florian
In child processes, Gecko Profiler's profiler_start/stop are running OFF the main thread, so the calls to Ensure/ReleaseBufferForMainThreadAddMarker should be dispatched to the main thread for them to actually create/destroy the main-thread buffer.

Note that this is not done in the Base Profiler, because it should always run on the main thread, and if it wasn't there would be no way to dispatch a task to the main thread -- and it wouldn't be too much of an issue anyway, there are few markers running outside of Gecko Profiler sessions.

Differential Revision: https://phabricator.services.mozilla.com/D144387
2022-04-22 09:26:11 +00:00
Marian-Vasile Laza 87994c06ad Backed out changeset 700318695e2b (bug 1763474) for causing GTest failures and mochitest failures on ProfilerThreadRegistrationData.cpp. CLOSED TREE 2022-04-22 12:57:22 +03:00
Florian Quèze 257c2cbade Bug 1763474 - Report thread wake-ups and CPU time per thread through glean, r=gerald,chutten
Differential Revision: https://phabricator.services.mozilla.com/D141147
2022-04-22 06:20:51 +00:00
Gerald Squelart c1b8cfb651 Bug 1765226 - Make ProfilerIOInterposeObserver a static object - r=florian
This removes some memory operations, and extends the observer's life.

Differential Revision: https://phabricator.services.mozilla.com/D144176
2022-04-20 23:39:21 +00:00
Narcis Beleuzu c5c85a1120 Backed out 1 changesets (bug 1763474) for assertion failures. CLOSED TREE
Backed out changeset 576565c650a1 (bug 1763474)
2022-04-15 02:26:13 +03:00
Florian Quèze 8f5736dae0 Bug 1763474 - Report thread wake-ups and CPU time per thread through glean, r=gerald,chutten
Differential Revision: https://phabricator.services.mozilla.com/D141147
2022-04-14 22:08:53 +00:00
Alexandre Lissy cd822fce9c Bug 1761054 - Add Utility Processes with proper classification in about:processes r=nika,fluent-reviewers,flod,florian
Differential Revision: https://phabricator.services.mozilla.com/D141881
2022-04-14 16:22:21 +00:00
Florian Quèze a62a18fff6 Bug 1764113 - avoid incrementing thread wakeup glean counters by 0, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D143580
2022-04-14 16:01:15 +00:00
mleclair 8bec7c2846 Bug 1763269 - changed append method to make sure it appends to vector. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D143001
2022-04-13 23:26:45 +00:00
Florian Quèze df3309e9a4 Bug 1761957 - Declare profiler_record_wakeup_count when MOZ_GECKO_PROFILER is not defined to avoid tier3 build failures, r=gerald. DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D142354
2022-03-30 09:02:39 +00:00
Florian Quèze 394a5bf056 Bug 1759535 - Report thread wake-ups through glean, r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D141050
2022-03-28 22:13:09 +00:00
Gerald Squelart 9967775631 Bug 1757528 - Don't run nativeallocations TV test on Android - r=canaltinova
The regular xpcshell test don't appear to fail, so this additional patch ensures that only the TV (test verify) runs of test_feature_nativeallocations.js are skipped.

Differential Revision: https://phabricator.services.mozilla.com/D141814
2022-03-23 22:41:07 +00:00
mleclair cb0a86aae4 Bug 1666226 - Add GeckoView APIs for starting and stopping the Gecko profiler r=geckoview-reviewers,mstange,agi
***

Differential Revision: https://phabricator.services.mozilla.com/D133404
2022-03-23 20:05:07 +00:00
Butkovits Atila 2c7e868cb3 Backed out changeset bec32662266a (bug 1666226) for causing Android bustages. CLOSED TREE 2022-03-23 21:14:51 +02:00
mleclair 90e32d0fb4 Bug 1666226 - Add GeckoView APIs for starting and stopping the Gecko profiler r=geckoview-reviewers,mstange,agi
***

Differential Revision: https://phabricator.services.mozilla.com/D133404
2022-03-23 18:53:32 +00:00
Michael Comella d4867d4ecf Bug 1618560 - support markers from multiple JVM threads in profiler. r=canaltinova,geckoview-reviewers,agi
Here is a sample profile taken with the combined patches:
  https://share.firefox.dev/3pEcSi0

I added a "sample marker" in the `dispatchToThreads` method called from the
Gecko thread to demonstrate markers taken off the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D140435
2022-03-22 18:50:49 +00:00
Michael Comella e07a09ab87 Bug 1618560 - support samples from multiple JVM threads in profiler. r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D140434
2022-03-22 18:50:48 +00:00
Gerald Squelart b7e1985cd5 Bug 1757528 - Don't run nativeallocations tests on Android - r=canaltinova
The native allocations feature is crashing tests on Android in the watchdog thread, possibly due to its CPU overhead.
This feature is rarely used, and mostly by Firefox developers, so it's okay to keep it available without tests.

Differential Revision: https://phabricator.services.mozilla.com/D141568
2022-03-22 12:52:15 +00:00
Randell Jesup fcaf70841e Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 18:47:08 +00:00
Cristian Tuns e8224e0ed6 Backed out changeset 416c97246140 (bug 1618560) for causing xpcshell failures in test_feature_java.js CLOSED TREE 2022-03-16 14:52:13 -04:00
Michael Comella 9507d3ff3c Bug 1618560 - support samples from multiple JVM threads in profiler. r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D140434
2022-03-16 18:14:17 +00:00
Noemi Erli 2390d257e6 Backed out changeset 12a59e5a50bf (bug 1207753) for causing build bustage CLOSED TREE 2022-03-16 18:32:51 +02:00
Randell Jesup 4b033a5256 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 16:16:14 +00:00
Butkovits Atila 927ad62c6a Backed out changeset a68ee4b09f92 (bug 1207753) for causing Hazard bustages. CLOSED TREE 2022-03-16 14:38:14 +02:00
Randell Jesup 7d4b5fae04 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 12:01:14 +00:00
Julien Wajsberg 94fa561963 Bug 1752861 - [profiler] Add a few new macros to add frame labels that will show up in javascript stacks r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D140388
2022-03-11 09:18:30 +00:00
Florian Quèze 9fbf6f9b14 Bug 1757202 - Add the browser window inner id to the SetDisplayList, CompositeToTarget and SkippedComposite profiler markers, r=mstange.
Depends on D139733

Differential Revision: https://phabricator.services.mozilla.com/D140748
2022-03-11 07:49:06 +00:00
Gerald Squelart 8ae629ad26 Bug 1757596 - Move profiler sleep/wake APIs to mozilla/ProfilerThread{Sleep,State}.h - r=florian
Profiler sleep/wake functions/macros/classes are used in a small number of files.
By placing most of them in mozilla/ProfilerThread{Sleep,State}.h, the dependence on GeckoProfiler.h is greatly reduced.
The remaining AUTO_PROFILER_THREAD_WAKE and AutoProfilerThreadWake depend on profiler_is_sleeping() in mozilla/ProfilerThreadState.h (but are rarely used), so it makes sense to move them there instead.

Depends on D140169

Differential Revision: https://phabricator.services.mozilla.com/D140172
2022-03-08 10:32:44 +00:00
Gerald Squelart 111d3090e1 Bug 1757596 - De-duplicate PROFILER_RAII macros - r=florian
The next patch would have added yet another PROFILERxx_RAII macro, so it makes sense to gather them all into a single header file, to be #included where needed.

Differential Revision: https://phabricator.services.mozilla.com/D140169
2022-03-08 10:32:43 +00:00
Gerald Squelart 2258868d1b Bug 1755823 - Lock the ThreadRegistry non-exclusively when only reading the thread list, exclusively when adding/removing threads - r=canaltinova
This allows multiple threads to access ThreadRegistrations through the thread registry, as long as the registry itself is not modified. So in particular, ThreadRegistrations are guaranteed to stay alive as long as a non-exclusive lock is held.
This ensures cross-thread markers are not blocked while the sampler is running.

Differential Revision: https://phabricator.services.mozilla.com/D139917
2022-03-04 06:48:11 +00:00
Butkovits Atila 78f77536c7 Backed out 2 changesets (bug 1755823) for causing cpp failures at TestBaseProfiler.cpp. CLOSED TREE
Backed out changeset d758cab0d5cf (bug 1755823)
Backed out changeset 169754a1f337 (bug 1755823)
2022-03-04 05:36:41 +02:00
Gerald Squelart ae676b6b1b Bug 1755823 - Lock the ThreadRegistry non-exclusively when only reading the thread list, exclusively when adding/removing threads - r=canaltinova
This allows multiple threads to access ThreadRegistrations through the thread registry, as long as the registry itself is not modified. So in particular, ThreadRegistrations are guaranteed to stay alive as long as a non-exclusive lock is held.
This ensures cross-thread markers are not blocked while the sampler is running.

Differential Revision: https://phabricator.services.mozilla.com/D139917
2022-03-03 23:03:06 +00:00
Gerald Squelart f6d53c50dd Bug 1668867 - nsProfiler::WaitOnePeriodicSampling also waits for children to run their sampling loop - r=canaltinova
This can help some tests get the data they expect from child processes.

Differential Revision: https://phabricator.services.mozilla.com/D139337
2022-03-01 06:56:03 +00:00
Gerald Squelart 51c86cc4b9 Bug 1668867 - Await Services.profiler.{Start,Stop,Pause,Resume}Profiler in most async profiler tests - r=canaltinova
In async profiler tests, it's best to await profiler-controlling functions, to ensure that they took full effect in all processes.
It's especially important with StopProfiler, so that the profiler doesn't run anywhere when the following test starts.

Differential Revision: https://phabricator.services.mozilla.com/D139336
2022-03-01 06:56:02 +00:00
Gerald Squelart 47d3dbd992 Bug 1668867 - nsProfiler::{Start,Stop,etc.}Profiler await profiler_... and then resolve their JS promise - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D139335
2022-03-01 06:56:02 +00:00
Gerald Squelart 875656f23f Bug 1668867 - profiler_{start,stop,etc.} return the ProfilerParent::Profiler...ed GenericPromise - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D139334
2022-03-01 06:56:01 +00:00
Gerald Squelart f2d47478d0 Bug 1668867 - ProfilerParent::Profiler{Start,Stop,etc.}ed await the corresponding PProfiler function and then resolve their GenericPromise - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D139333
2022-03-01 06:56:01 +00:00
Gerald Squelart 4d50543faa Bug 1668867 - PProfiler control functions return a completion promise - r=canaltinova
The returned promise is resolved when the child has completed its operation.

Differential Revision: https://phabricator.services.mozilla.com/D139332
2022-03-01 06:56:01 +00:00
Gerald Squelart 2fa78ca017 Bug 1668867 - Move parts of GeckoProfiler.h into ProfilerControl.h - r=canaltinova
This profiler-controlling functions are used in very few places, so it's good to have them in a separate header to reduce dependencies.

On top of making GeckoProfiler.h lighter, this is actually needed for this bug, because a later patch adds MozPromise to profiler_start and others, which would have created a header loop (GeckoProfiler -> MozPromise -> Monitor -> CondVar -> GeckoProfiler) that makes the build fail.

Differential Revision: https://phabricator.services.mozilla.com/D139331
2022-03-01 06:56:00 +00:00
Florian Quèze 9d570614e8 Bug 1756634 - avoid declaring ThreadBasicInformation on mingw where the winternl.h header already declares it, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D139409
2022-02-22 21:52:17 +00:00
Florian Queze 764f0a8223 Bug 1756538 - Include the dynamic thread priority in 'Awake' markers on Windows, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D139354
2022-02-22 11:21:56 +00:00
Florian Quèze 2fbf16fbca Bug 1755450 - implement empty stub profiler_thread_sleep and profiler_thread_wake functions for tier3 platforms not building MOZ_GECKO_PROFILER, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D138957
2022-02-17 18:47:48 +00:00
Cristian Tuns ae4781ebff Backed out changeset 72752c43d243 (bug 1755450) for causing build bustages on ProfilerThreadRegistration.cpp CLOSED TREE 2022-02-17 11:48:11 -05:00
Florian Quèze bdfd03ecf3 Bug 1755450 - implement empty stub profiler_thread_sleep and profiler_thread_wake functions for tier3 platforms not building MOZ_GECKO_PROFILER, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D138957
2022-02-17 13:55:21 +00:00
Florian Quèze f710cae9cd Bug 1755055 - Record CPU time inside Awake profiler markers, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D138568
2022-02-17 09:38:28 +00:00
Emilio Cobos Álvarez 74d0665b85 Bug 1755737 - Make layout.css.dpi a static pref. r=jfkthame,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D138921
2022-02-16 21:13:58 +00:00
Butkovits Atila 20e27a3364 Backed out 2 changesets (bug 1755737) for causing failures at browser_test_feature_preferencereads.js. CLOSED TREE
Backed out changeset c2609661965d (bug 1755737)
Backed out changeset 34596510350a (bug 1755737)
2022-02-16 21:53:03 +02:00
Butkovits Atila fc3f1cef99 Bug 1755737 - Lint fix. 2022-02-16 21:08:22 +02:00
Emilio Cobos Álvarez 47d1f077af Bug 1755737 - Make layout.css.dpi a static pref. r=jfkthame,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D138921
2022-02-16 17:39:57 +00:00
Nazım Can Altınova 873311238e Bug 1755488 - Enable the profiler xpcshell tests for Android r=gerald
Depends on D138862

Differential Revision: https://phabricator.services.mozilla.com/D138863
2022-02-16 10:27:45 +00:00
Nazım Can Altınova cb28c57d98 Bug 1755488 - Fix the Android regexp issues inside the xpcshell tests r=gerald
On an Android device, the stacks looks different during testing. It doesn't
include object directory before the test file since the tests are packaged
with the binary on Android.

Depends on D138769

Differential Revision: https://phabricator.services.mozilla.com/D138862
2022-02-16 10:27:44 +00:00
Nazım Can Altınova 22f86b74fe Bug 1754781 - Change the Android JVM thread id to 1 r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D138769
2022-02-16 10:27:44 +00:00
Nazım Can Altınova 9c0c0c1f16 Bug 1754781 - Remove the xpcshell global skip for Android and move that into tests instead r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D138768
2022-02-16 10:27:44 +00:00
Gerald Squelart 145d60ef59 Bug 1754358 - Revert bug 1749978 that leaked non-empty profiling stacks on destruction - r=canaltinova
Now that the main cause of broken stacks (LoaderObserver) has been removed, we reinstate the path to this assertion, which should trigger much less or not at all.

Differential Revision: https://phabricator.services.mozilla.com/D138241
2022-02-16 00:25:27 +00:00
Gerald Squelart 91645977e5 Bug 1745281 - Record base markers whenever the core buffer is in session - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D137810
2022-02-14 04:17:12 +00:00
Gerald Squelart 5dff64f39d Bug 1745281 - Test base/gecko markers before/during/after base/gecko profiler - r=canaltinova
This adds tests about what's already happening with current Base and Gecko Profiler markers.

Differential Revision: https://phabricator.services.mozilla.com/D137808
2022-02-14 04:17:11 +00:00
Gerald Squelart c2785cc79a Bug 1753192 - Add handover marker - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D137805
2022-02-13 06:18:29 +00:00
Gerald Squelart e73913b166 Bug 1753192 - Use combined core buffer, and transfer ownership of chunk manager from base to gecko profiler - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D137804
2022-02-13 06:18:29 +00:00
Gerald Squelart 459979eacb Bug 1753192 - ThreadRegistrationInfo reuses the Base Profiler thread registration time if any - r=canaltinova
Once the buffers are combined, some data could be stored in a thread before its registration with the Gecko Profiler.
Without this fix, the front-end would think the thread had not started yet, which could prevent interacting with that early data.

Differential Revision: https://phabricator.services.mozilla.com/D138239
2022-02-13 06:18:29 +00:00
Gerald Squelart a9eb4e36d5 Bug 1753192 - Make ActivePS::mProfileBufferChunkManager a UniquePtr, to allow transferring it between profilers - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D137803
2022-02-13 06:18:28 +00:00
Gerald Squelart 56704e0465 Bug 1753192 - Move core ProfileChunkedBuffers to static singletons in profiler_get_core_buffer() - r=canaltinova
Note that they are still separate buffers for now.

Differential Revision: https://phabricator.services.mozilla.com/D137802
2022-02-13 06:18:28 +00:00
Florian Quèze 7e1f0527c2 Bug 1753305 - Add 'Awake' profiler markers whenever a thread is awake, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D137695
2022-02-11 15:19:47 +00:00
Marian-Vasile Laza bb43a35448 Backed out 8 changesets (bug 1753192) for causing Gtest failures on GeckoProfiler.cpp. CLOSED TREE
Backed out changeset 2f0c24b1f049 (bug 1753192)
Backed out changeset 1a71d954b83f (bug 1753192)
Backed out changeset 07a8ffa8d12f (bug 1753192)
Backed out changeset f79cd543e537 (bug 1753192)
Backed out changeset c2f22d8a8fc8 (bug 1753192)
Backed out changeset c8a0d3c41d2f (bug 1753192)
Backed out changeset 1d5d69d92db9 (bug 1753192)
Backed out changeset 5bc8bd033453 (bug 1753192)
2022-02-11 09:39:38 +02:00
Gerald Squelart 194a013384 Bug 1753192 - Add handover marker - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D137805
2022-02-11 03:13:53 +00:00
Gerald Squelart 9f19f2143b Bug 1753192 - Use combined core buffer, and transfer ownership of chunk manager from base to gecko profiler - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D137804
2022-02-11 03:13:52 +00:00
Gerald Squelart f811caf3b2 Bug 1753192 - ThreadRegistrationInfo reuses the Base Profiler thread registration time if any - r=canaltinova
Once the buffers are combined, some data could be stored in a thread before its registration with the Gecko Profiler.
Without this fix, the front-end would think the thread had not started yet, which could prevent interacting with that early data.

Differential Revision: https://phabricator.services.mozilla.com/D138239
2022-02-11 03:13:52 +00:00
Gerald Squelart adf6de3385 Bug 1753192 - Make ActivePS::mProfileBufferChunkManager a UniquePtr, to allow transferring it between profilers - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D137803
2022-02-11 03:13:51 +00:00
Gerald Squelart f3c4f65d02 Bug 1753192 - Move core ProfileChunkedBuffers to static singletons in profiler_get_core_buffer() - r=canaltinova
Note that they are still separate buffers for now.

Differential Revision: https://phabricator.services.mozilla.com/D137802
2022-02-11 03:13:51 +00:00
Nika Layzell dabb46c84d Bug 1736371 - Default new actors to be refcounted, r=alwu,media-playback-reviewers,mccr8
The changes to ipdl actors were mechanical, and largely automated using
a script.

Differential Revision: https://phabricator.services.mozilla.com/D137237
2022-02-09 17:29:47 +00:00
Nika Layzell 91ec85c593 Bug 1752444 - Part 2: Rewrite direct_call.py protocols to use {Parent,Child}Impl attributes, r=ipc-reviewers,media-playback-reviewers,alwu,mccr8
This is a mechanical change which was performed by a script based on the
contents of direct_call.py, and then manually checked over to fix
various rewriting bugs caused by my glorified sed script. See the
previous part for more context on the change.

Differential Revision: https://phabricator.services.mozilla.com/D137227
2022-02-09 17:29:46 +00:00
Gerald Squelart 13dff337ad Bug 1735397 - Add tests for pid-filtering - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D137392
2022-02-08 12:47:53 +00:00
Gerald Squelart c5b8ff3ca4 Bug 1735397 - Don't start profiler in processes excluded by pid - r=florian
When trying to profile only one process, the profiler should not even start in those processes excluded by the filter, so that they don't use any resources (memory and CPU).
To do that, the filter is checked for "pid:" at the multiple locations it may appear:
- In the parent process, when starting the overall profiler, don't send the "Start" IPC to excluded processes.
- When a new process starts and initializes the profiler, don't start the profiler if the filter excludes this process.
- When a new process then registers itself with the parent, don't (re)start the profiler in excluded processes.

Child processes that don't run the profiler may still be asked for a JSON profile at the end of the profiling session. This is handled by sending an empty string, so that the parent process will correctly remove them from the pending-profile list.

Differential Revision: https://phabricator.services.mozilla.com/D135854
2022-02-08 12:47:53 +00:00
Iulian Moraru 62917bb0d3 Backed out 4 changesets (bug 1735397) for causing spidermonkey build bustages on check_vanilla_allocations.py. CLOSED TREE
Backed out changeset 724e44c19665 (bug 1735397)
Backed out changeset 64546b56bac0 (bug 1735397)
Backed out changeset d55f04c0a444 (bug 1735397)
Backed out changeset 19762488b965 (bug 1735397)
2022-02-08 07:49:20 +02:00
Gerald Squelart 820821f476 Bug 1735397 - Add tests for pid-filtering - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D137392
2022-02-08 02:40:50 +00:00
Gerald Squelart 6dca3dab69 Bug 1735397 - Don't start profiler in processes excluded by pid - r=florian
When trying to profile only one process, the profiler should not even start in those processes excluded by the filter, so that they don't use any resources (memory and CPU).
To do that, the filter is checked for "pid:" at the multiple locations it may appear:
- In the parent process, when starting the overall profiler, don't send the "Start" IPC to excluded processes.
- When a new process starts and initializes the profiler, don't start the profiler if the filter excludes this process.
- When a new process then registers itself with the parent, don't (re)start the profiler in excluded processes.

Child processes that don't run the profiler may still be asked for a JSON profile at the end of the profiling session. This is handled by sending an empty string, so that the parent process will correctly remove them from the pending-profile list.

Differential Revision: https://phabricator.services.mozilla.com/D135854
2022-02-08 02:40:50 +00:00
Emilio Cobos Álvarez c2003bb3e7 Bug 1753402 - Disable untagged union in Gecko profiler bindings. r=canaltinova
We don't use unions in the bindings, and rust is very picky with what
you can put on untagged unions, so disable them for now.

Differential Revision: https://phabricator.services.mozilla.com/D137837
2022-02-04 13:53:28 +00:00
Markus Stange 740759c4ef Bug 1753272 - On macOS, always enable frame pointer stack walking, even in builds which may not have frame pointers. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D137677
2022-02-03 16:31:05 +00:00
Gerald Squelart 10a1425332 Bug 1673513 - Add tests for slow and too-slow child processes - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D136877
2022-01-31 02:22:30 +00:00
Gerald Squelart 833ccac51b Bug 1673513 - Use ProfilerParent::RequestGatherProfileProgress to wait for slow but responsive processes - r=florian
Instead of waiting a set time guessed from how long the parent process took to do its work, after a short time the parent process requests progress updates from all still-pending child processes, and restarts the timer if any progress was made.
If processes become unresponsive, they will be the last ones pending, and after one timer cycle without any progress anywhere, the parent process won't wait for children anymore, and will output all profiles successfully gathered so far.

Added `MOZ_LOG=prof` logging in nsProfiler.cpp, to monitor profile-gathering. (And removed a spurious 'd' character in the `LOG` macro.)

Differential Revision: https://phabricator.services.mozilla.com/D135488
2022-01-31 02:22:30 +00:00
Gerald Squelart e230bf232e Bug 1673513 - Factor out and improve nsProfiler::RestartGatheringTimer - r=florian
This code will be used again in the following patch.
Instead of destroying and re-creating a new timer, we can re-initialize the existing one.

Also add the timer name "nsProfilerGatheringTimer" when first creating it.

Differential Revision: https://phabricator.services.mozilla.com/D135487
2022-01-31 02:22:30 +00:00
Gerald Squelart 75fffbdebe Bug 1673513 - ProfilerParent::RequestGatherProfileProgress(aChildPid) - r=florian
This helper function in ProfilerParent sends a progress request to a child process. If successfully sent, the response will resolve the returned promise.

Differential Revision: https://phabricator.services.mozilla.com/D135486
2022-01-31 02:22:29 +00:00
Gerald Squelart 9ffde9c15b Bug 1673513 - GetGatherProfileProgress() IPC - r=florian
A new IPC function allows the parent process to request a progress update from any child process.
If a profile generation is in progress, the shared `ProportionValue` can be atomically read and sent back in response.

Differential Revision: https://phabricator.services.mozilla.com/D135485
2022-01-31 02:22:29 +00:00
Gerald Squelart c2390f1ea1 Bug 1673513 - Generate profile in new worker thread, and log its progress - r=florian,KrisWright
In order to keep the child process responsive to profile IPCs, the heavy work of generating the profile JSON is now done in a separate thread.
A `ProgressLogger` is used to keep track of the progress of this work, and the progress value is stored in a shared atomic `ProportionValue`.
When the JSON profile is ready, the final shmem allocation (used to send the profile to the parent process) is done on the original "ProfilerChild" IPC thread.

Differential Revision: https://phabricator.services.mozilla.com/D135484
2022-01-31 02:22:29 +00:00
Gerald Squelart 32ed5cbb65 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
2022-01-31 02:22:28 +00:00
Gerald Squelart bd01dc8480 Bug 1673513 - Maintain list of pending profiles, each with child pid - r=florian
Instead of just waiting for a certain number of profiles, the parent process now waits for profiles from a predetermined list of child process ids.
When receiving a profile, or when something goes wrong with a child process, the corresponding listed id can be removed, until the list is empty.
In a later patch, this list will be used to request progress updates from slow processes.

Differential Revision: https://phabricator.services.mozilla.com/D135482
2022-01-31 02:22:28 +00:00
Gerald Squelart 35257b17ef Bug 1673513 - ProfilerParent::GatherProfiles() also returns the child pid - r=florian
This will be useful to tie profiles to the child process id that generated them. (At the moment, the parent waits for a number of profiles, but doesn't check where received profiles actually come from.)

Differential Revision: https://phabricator.services.mozilla.com/D135481
2022-01-31 02:22:28 +00:00
Gerald Squelart 6c3f739b6e Bug 1673513 - Reserve the array space in advance in ProfilerParent::GatherProfiles - r=florian
A small optimization while working on nearby code, so avoid multiple allocations when we already know how much memory we really need.

Differential Revision: https://phabricator.services.mozilla.com/D135480
2022-01-31 02:22:27 +00:00
Gerald Squelart 50995cc271 Bug 1673513 - Use ProgressLogger in Gecko Profiler - r=florian
Add `ProgressLogger` parameter to most JSON-generating functions.
Each function can update the given `ProgressLogger` between 0% and 100%, and create sub-loggers when calling functions.

The main goal of this instrumentation is to notice when any progress is made by child processes (when the parent process is gathering profiles), so it needs to go deep enough so that it is not stuck on a progress value for "too long" -- During development, that meant progress was always happening when observed every 10ms; In later patches, the overall timeout for no-progress-made will be at least 1 second.

Differential Revision: https://phabricator.services.mozilla.com/D135479
2022-01-31 02:22:27 +00:00
Julien Wajsberg cc5e07062d Bug 1639716 - [profiler] Bump the format version to ensure our users get the latest version of the frontend when capturing private browsing data r=gerald
Depends on D129819

Differential Revision: https://phabricator.services.mozilla.com/D136756
2022-01-26 17:26:24 +00:00
Julien Wajsberg e1f9445a89 Bug 1639716 - [profiler, network markers] Add information about private browsing in network markers r=valentin,gerald,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D129819
2022-01-26 17:26:24 +00:00
Julien Wajsberg b037b450bc Bug 1639716 - [profiler] Extract origin attributes out of the eTLD+1 and output them as thread properties r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D129818
2022-01-26 17:26:23 +00:00
Julien Wajsberg ff988ebecd Bug 1639716 - [profiler] Remove the profiler disabling by private browsing r=jdescottes,gerald,devtools-backward-compat-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D129417
2022-01-26 17:26:21 +00:00
Julien Wajsberg c52080ea1a Bug 1639716 - [profiler] Record the private browsing information in registered pages r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D129416
2022-01-26 17:26:20 +00:00
Mike Hommey b82810b455 Bug 1751331 - Use the mozbuild crate in gecko-profiler. r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D136566
2022-01-25 21:29:53 +00:00
Mike Hommey e7c54fc571 Bug 1751331 - Remove MOZ_DIST. r=firefox-build-system-reviewers,mhentges
As mentioned in bug 1747354, the location of the dist directory is
relied to be $topobjdir/dist, so just use that consistently rather
than getting it from a separate variable for rust build scripts.

Differential Revision: https://phabricator.services.mozilla.com/D136556
2022-01-25 21:29:49 +00:00
criss 592389ca2d Backed out 10 changesets (bug 1751331) for causing bustages. CLOSED TREE
Backed out changeset 5ce212465a26 (bug 1751331)
Backed out changeset 14d62b8ffa5a (bug 1751331)
Backed out changeset 76f46bd9afa1 (bug 1751331)
Backed out changeset 147faaad046f (bug 1751331)
Backed out changeset f85b049d12f9 (bug 1751331)
Backed out changeset 16d8d3f8378b (bug 1751331)
Backed out changeset 1cd9386a3927 (bug 1751331)
Backed out changeset 20faacba6db6 (bug 1751331)
Backed out changeset 7d17f75bcb38 (bug 1751331)
Backed out changeset 28b9aab1f174 (bug 1751331)
2022-01-25 13:00:25 +02:00
Mike Hommey 4db4c572b5 Bug 1751331 - Use the mozbuild crate in gecko-profiler. r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D136566
2022-01-25 09:03:05 +00:00
Mike Hommey 5999e70213 Bug 1751331 - Remove MOZ_DIST. r=firefox-build-system-reviewers,mhentges
As mentioned in bug 1747354, the location of the dist directory is
relied to be $topobjdir/dist, so just use that consistently rather
than getting it from a separate variable for rust build scripts.

Differential Revision: https://phabricator.services.mozilla.com/D136556
2022-01-25 09:03:01 +00:00
Gerald Squelart c94231024d Bug 1749978 - Instead of crashing, leak ThreadRegistration if profiling stack is not empty on destruction - r=florian
In rare cases, a label may be left dangling, or would be removed too late (after the thread unregisters itself).
The most common cause is from Windows DLL load labels, which contain important information that we want to keep, so it's worth letting the registration data leak in this case.
Later bugs will soon fix the issue in a better way, and remove this leak.

Differential Revision: https://phabricator.services.mozilla.com/D136700
2022-01-24 12:11:26 +00:00
Gerald Squelart 6ad9abfa16 Bug 1750452 - Replace mutex-locked sampling pause during exec() with atomic variable - r=emilio,mstange
Note: The atomic variable is named `gSkipSampling`, not mentioning forks because it could later be used in other situations, so it's best to describe it by the effect it has.

Differential Revision: https://phabricator.services.mozilla.com/D136205
2022-01-19 03:05:44 +00:00
Gerald Squelart 8b4d852418 Bug 1744670 - Collect process CPU utilization - r=canaltinova
Process running times are stored in a new counter that only exists while the profiler is running.

Differential Revision: https://phabricator.services.mozilla.com/D133173
2022-01-17 23:01:30 +00:00
Gerald Squelart 18d4946ed0 Bug 1744670 - New feature: "Process CPU Utilization" aka "processcpu" - r=florian,canaltinova
The actual implementation is in the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D133599
2022-01-17 23:01:29 +00:00
Gerald Squelart ebfafdcf18 Bug 1744670 - ProfiledThreadData can take a ThreadRegistrationInfo by rvalue reference - r=canaltinova
This helps when dealing with threads that are not registered, e.g.: the Java thread, and the upcoming whole-process thread. And it removes some object copies.

Differential Revision: https://phabricator.services.mozilla.com/D133172
2022-01-17 23:01:29 +00:00
Gerald Squelart 374831dc94 Bug 1744670 - ProfiledThreadData doesn't need nsIEventTarget - r=canaltinova
The nsIEventTarget* parameter was not actually used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D133171
2022-01-17 23:01:29 +00:00
Gerald Squelart 67edebb322 Bug 1749498 - PrintUsage doesn't exit anymore, exits are done explicitly - r=canaltinova
`PrintUsageThenExit(code)` was supposed to exit when `code` was not zero, but:
- The name didn't reflect that, so it was confusing that `PrintUsageThenExit(0)` would *not* exit.
- The implementation in the Base Profiler exited anyway! This caused issues with some legacy code that still used the now-removed "threads" feature.

This patch renames the function to just `PrintUsage()` and never exits, leaving the caller to invoke `exit(code)` as needed -- with the added benefit that it's possible to exit with a zero code, useful in cases where an exit is not actually an error.

Differential Revision: https://phabricator.services.mozilla.com/D135666
2022-01-12 12:16:59 +00:00
Kershaw Chang f159addb13 Bug 1741425 - Enable more xpcshell tests with socket process, r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D134484
2022-01-11 09:50:14 +00:00
Andreas Pehrson dda53ce32f Bug 1748280 - Add TraceMarker and friends to support GeckoTraceEvent with args in the profiler. r=gerald,padenot
Many revisions later... this is my best shoehorning attempt of webrtc's trace
events into the profiler.

It is not an optimal fit as the profiler wants a static schema, and the trace
event framework provides labels and values for the args dynamically.

But it allows displaying all args in the profiler which is a big step for
low-maintenance webrtc trace event integration into the profiler.

Differential Revision: https://phabricator.services.mozilla.com/D135031
2022-01-05 15:26:26 +00:00
Andreas Pehrson 0ea25dd011 Bug 1748280 - Update GeckoTraceEvent to plumb through trace args. r=padenot
This patch changes where we hook into GeckoTraceEvent.h and lets us capture
args.

Differential Revision: https://phabricator.services.mozilla.com/D135030
2022-01-05 15:26:25 +00:00
Andreas Pehrson 8fd80792ea Bug 1748280 - Add trace_event_internal section verbatim to GeckoTraceEvent. r=padenot
This patch adds a part of TraceEvent.h that we had previously skipped. It
handles the conversion from the arg-ful TRACE_EVENTn forms to the internal
representation which carries around a dynamic number of args (num_args and
friends).

This allows us to hook into GeckoTraceEvent.h at a higher level, where all trace
events end up, with or without args.

Differential Revision: https://phabricator.services.mozilla.com/D135029
2022-01-05 15:26:25 +00:00
Butkovits Atila 64c8533f75 Backed out 7 changesets (bug 1746361, bug 1748280, bug 1746347) for causing failures at browser_interaction-between-interfaces.js. CLOSED TREE
Backed out changeset eccba94506f0 (bug 1748280)
Backed out changeset baf39ae53772 (bug 1748280)
Backed out changeset 775843562f7e (bug 1748280)
Backed out changeset 0987c68e9683 (bug 1748280)
Backed out changeset 58dd008520da (bug 1746361)
Backed out changeset 6f9e800877a6 (bug 1746347)
Backed out changeset f78e794a9c2f (bug 1746347)
2022-01-05 13:53:57 +02:00
Andreas Pehrson 85d7b8b995 Bug 1748280 - Add TraceMarker and friends to support GeckoTraceEvent with args in the profiler. r=gerald,padenot
Many revisions later... this is my best shoehorning attempt of webrtc's trace
events into the profiler.

It is not an optimal fit as the profiler wants a static schema, and the trace
event framework provides labels and values for the args dynamically.

But it allows displaying all args in the profiler which is a big step for
low-maintenance webrtc trace event integration into the profiler.

Differential Revision: https://phabricator.services.mozilla.com/D135031
2022-01-05 10:54:22 +00:00
Andreas Pehrson 2b53926682 Bug 1748280 - Update GeckoTraceEvent to plumb through trace args. r=padenot
This patch changes where we hook into GeckoTraceEvent.h and lets us capture
args.

Differential Revision: https://phabricator.services.mozilla.com/D135030
2022-01-05 10:54:21 +00:00
Andreas Pehrson 098f6a41dd Bug 1748280 - Add trace_event_internal section verbatim to GeckoTraceEvent. r=padenot
This patch adds a part of TraceEvent.h that we had previously skipped. It
handles the conversion from the arg-ful TRACE_EVENTn forms to the internal
representation which carries around a dynamic number of args (num_args and
friends).

This allows us to hook into GeckoTraceEvent.h at a higher level, where all trace
events end up, with or without args.

Differential Revision: https://phabricator.services.mozilla.com/D135029
2022-01-05 10:54:21 +00:00
Gerald Squelart 990e9d9558 Bug 1742606 - Don't set the name of the main thread from the profiler - r=florian
The name of the main thread outside the profiler should not be set by the profiler (to "GeckoMain"), as this may affect the name of the application itself on some systems like Linux.

Added tests to ensure that the profiler doesn't set that main thread public name to "GeckoMain", and also that other threads are publicly named when first registered with the profiler.

Differential Revision: https://phabricator.services.mozilla.com/D134847
2022-01-03 13:19:04 +00:00
Gerald Squelart 1144535227 Bug 1729815 - Remove unnecessary profiler feature "threads" - r=julienw,perftest-reviewers,AlexandruIonescu
This feature doesn't have any effect anymore.

Differential Revision: https://phabricator.services.mozilla.com/D133860
2021-12-20 21:03:09 +00:00
Gerald Squelart 7b40fa572e Bug 1729815 - Allow empty feature list, or bitset=0 - r=julienw
This is necessary, because the next patch will remove the "threads" feature, and some tests only add that one feature so now they will have an empty feature list, equivalent to a feature bitset of 0 (zero).

Differential Revision: https://phabricator.services.mozilla.com/D134136
2021-12-20 21:03:09 +00:00
Gerald Squelart 16ce2f0dcc Bug 1726861 - Loosen expected marker start time - r=canaltinova
On macOS, we get intermittent failures when comparing a marker start time with the start of the test, with a difference of 0.00004166666666094443, which is very close to 24kHZ! I'm not too sure of the significance of this time difference (OS time slice resolution), but an easy fix for this intermittent is to loosen the expected time from 1e-6 to 5e-5.

Differential Revision: https://phabricator.services.mozilla.com/D134258
2021-12-20 19:42:39 +00:00
Markus Stange 875a34857d Bug 1362277 - Add an entry for dyld to the shared library list on macOS. r=gerald
This patch was r+ed before by Ted, but it never landed because I initially intended
to address Ted's review comment (about making it work on 10.11 and below), and
because it needed to be rebased around bug 1374888.
The rebase turned out to be really simple, and Ted's review comment no longer applies
because Firefox no longer runs on 10.11 and below.

Profile with fix: https://share.firefox.dev/3oYzvO6

Differential Revision: https://phabricator.services.mozilla.com/D134008
2021-12-17 11:54:28 +00:00
Gerald Squelart 4199f5065e Bug 1734867 - Use single static buffer when capturing stacks for main-thread markers - r=florian
The main thread is the busiest, so it benefits the most from having its own chunked buffer. This removes one allocation when capturing a marker stack on the main thread of each process.
That buffer is allocated when the first profiler starts, and is destroyed when the last profiler stops.

Note: Further improvements are possible (e.g.: Pool of pre-allocated buffers, attempting to use a stack-based buffer, etc.), but they are more complex and will require more work in future bugs.

Differential Revision: https://phabricator.services.mozilla.com/D133725
2021-12-17 05:27:06 +00:00