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

2676 Коммитов

Автор SHA1 Сообщение Дата
Andi-Bogdan Postelnicu f07c975367 Bug 1519636 - Reformat recent changes to the Google coding style. r=necko-reviewers,emilio
Updated with clang-format version 12.0.0 (taskcluster-FZRqPXamQIOU_i4hF0cAcg)

Differential Revision: https://phabricator.services.mozilla.com/D117905
2021-06-17 11:00:22 +00:00
Florian Quèze dfeb53e219 Bug 1715257 - Remove Task Tracer code from the profiler, r=gerald,necko-reviewers.
Differential Revision: https://phabricator.services.mozilla.com/D117996
2021-06-17 09:33:00 +00:00
Iulian Moraru b02492de66 Backed out changeset 617a466d0cce (bug 1715257) for causing build bustages. CLOSED TREE 2021-06-17 10:58:16 +03:00
Florian Quèze 7b4906a6bd Bug 1715257 - Remove Task Tracer code from the profiler, r=gerald,necko-reviewers.
Differential Revision: https://phabricator.services.mozilla.com/D117996
2021-06-17 06:12:10 +00:00
Gerald Squelart c953f2a74f Bug 1715844 - Fixed non-MOZ_GECKO_PROFILER build of MicroGeckoProfiler - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D117493
2021-06-11 08:43:42 +00:00
Paul Adenot d3bcddf02f Bug 1714577 - Part 8 - Modify GeckoTraceEvent.h to use the micro gecko profiler API. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D116845
2021-06-09 15:43:40 +00:00
Paul Adenot 34cc5a6b14 Bug 1714577 - Part 7 - Add a function to insert a very simple profiler marker in the micro gecko profiler. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D116844
2021-06-09 15:43:39 +00:00
Paul Adenot 3a215ce0dc Bug 1714577 - Part 6 - Copy WebRTC's trace_event.h to Gecko, verbatim, and redirect the original trace_event.h to it. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D116843
2021-06-09 15:43:39 +00:00
Paul Adenot 2c501af5db Bug 1714577 - Part 2 - Introduction of the micro gecko profiler API. r=gerald
This allows using the Gecko Profiler without pulling in half of Gecko (nsTArray,
nsString, etc.). This is for use in third party code, that we lightly patch to
register the threads.

Differential Revision: https://phabricator.services.mozilla.com/D116839
2021-06-09 15:43:37 +00:00
Nazım Can Altınova 5bcc4d95af Bug 1690624 - Add profiler rust API for thread registration/unregistration r=gerald,emilio
Differential Revision: https://phabricator.services.mozilla.com/D116515
2021-06-09 11:22:55 +00:00
Nazım Can Altınova f409532d55 Bug 1690624 - Create empty ProfilerBindings header and cpp files r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D116514
2021-06-09 11:22:55 +00:00
Nazım Can Altınova 98489bb8f2 Bug 1690624 - Create an empty rust crate for profiler API r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D116513
2021-06-09 11:22:54 +00:00
Gerald Squelart 9d69a80d84 Bug 1713971 - Allow ~ProfilerParentTracker() off-main-thread if no parents are registered - r=canaltinova
Crashes reported in bug 1713971 all happen after `main()` has ended, during the destruction of static objects. On Windows, `NS_IsMainThread()` returns `false` in this case.

It is suspected that this situation happens when `KillClearOnShutdown` has not been invoked, probably because XPCOM didn't even start, so the `ProfilerParentTracker` singleton has not been reset as expected before the end of XPCOM. Bug 1710620 will be looking into this scenario.

In the meantime:
At this point in time after `main()`, there should be no `ProfilerParent`s still active, so the tracking list should be empty, and the destructor would not do anything anyway. This patch allows that.

If crashes still happen then (i.e., there are still `ProfilerParent`s registered after `main()` ends), their frequency should not be worse than before, but they could give a further clue in what may be happening. And if crashes do get worse, it would be easy to revert this patch.

Differential Revision: https://phabricator.services.mozilla.com/D117125
2021-06-09 00:03:46 +00:00
Julien Wajsberg 2f05690e64 Bug 1712324 - [Profiler] Filter out markers for the service worker file from the captured markers to avoid intermittents r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D116720
2021-06-04 20:36:01 +00:00
Gerald Squelart 144c953d0c Bug 1707489 - Use StackWalkControl in Profiler's DoMozStackWalkBacktrace - r=canaltinova
When mozglue's MozStackWalkThread ends, the last found SP can be checked to see if it was called by JIT code, in which case we can restart the native stack walk from the known caller of the JIT code.

Differential Revision: https://phabricator.services.mozilla.com/D116379
2021-06-03 22:11:06 +00:00
Gerald Squelart f6a4d6b7a0 Bug 1707489 - Retrieve entry registers and stop areas from JIT - r=canaltinova
ExtractJsFrames fills the provided StackWalkControl with C++-to-JIT entry registers, if any.

Differential Revision: https://phabricator.services.mozilla.com/D113273
2021-06-03 22:11:05 +00:00
Gerald Squelart 9f1b967d52 Bug 1707489 - Implement StackWalkControl struct on Windows/x86-64 - r=canaltinova
This structure manages a list of known "ResumePoint", which contains the registers needed to restart stack walks from JIT C++ entry points.

Differential Revision: https://phabricator.services.mozilla.com/D116378
2021-06-03 22:11:05 +00:00
Gerald Squelart f6716e4e08 Bug 1707489 - Pass StackWalkControl to ExtractJsFrames and then forward it to stack walkers - r=canaltinova
This is almost code-free: A StackWalkControl (skeleton for now) is constructed when the platform supports it, and then passed to ExtractJsFrames and the stack walker; but is not actively used yet.

Differential Revision: https://phabricator.services.mozilla.com/D113272
2021-06-03 22:11:04 +00:00
Iulian Moraru c36c9502aa Backed out 4 changesets (bug 1707489) for causing build bustages. CLOSED TREE
Backed out changeset 92276cf98902 (bug 1707489)
Backed out changeset a5c3c4a00acc (bug 1707489)
Backed out changeset e582c06a7323 (bug 1707489)
Backed out changeset 5fb8ebb1a365 (bug 1707489)
2021-06-03 11:45:29 +03:00
Gerald Squelart 6cf2808be9 Bug 1707489 - Use StackWalkControl in Profiler's DoMozStackWalkBacktrace - r=canaltinova
When mozglue's MozStackWalkThread ends, the last found SP can be checked to see if it was called by JIT code, in which case we can restart the native stack walk from the known caller of the JIT code.

Differential Revision: https://phabricator.services.mozilla.com/D116379
2021-06-03 02:39:38 +00:00
Gerald Squelart cceb627cbc Bug 1707489 - Retrieve entry registers and stop areas from JIT - r=canaltinova
ExtractJsFrames fills the provided StackWalkControl with C++-to-JIT entry registers, if any.

Differential Revision: https://phabricator.services.mozilla.com/D113273
2021-06-03 02:39:38 +00:00
Gerald Squelart b8eb026132 Bug 1707489 - Implement StackWalkControl struct on Windows/x86-64 - r=canaltinova
This structure manages a list of known "ResumePoint", which contains the registers needed to restart stack walks from JIT C++ entry points.

Differential Revision: https://phabricator.services.mozilla.com/D116378
2021-06-03 02:39:37 +00:00
Gerald Squelart a5367adde9 Bug 1707489 - Pass StackWalkControl to ExtractJsFrames and then forward it to stack walkers - r=canaltinova
This is almost code-free: A StackWalkControl (skeleton for now) is constructed when the platform supports it, and then passed to ExtractJsFrames and the stack walker; but is not actively used yet.

Differential Revision: https://phabricator.services.mozilla.com/D113272
2021-06-03 02:39:37 +00:00
Gerald Squelart 5bafbe8d3a Bug 1710015 - Prevent re-instantiation of ProfilerParentTracker past XPCOMShutdownThreads - r=canaltinova
Note that we can still use an existing ProfilerParentTracker instance after XPCOMShutdownThreads started (it's necessary, so that e.g., its list can be properly updated when ProfilerParents get destroyed), we just refuse to create a new one past that point.

Differential Revision: https://phabricator.services.mozilla.com/D114709
2021-06-01 01:01:05 +00:00
Gerald Squelart 7ce2cb9583 Bug 1712733 - Output empty stacks if there are CPU usage numbers - r=florian
In particular, this is useful to show CPU usage graphs in no-periodic-sampling mode.

The GeckoProfiler::CPUUsage gtest was expanded to make sure that we have the same stack in this mode, and different stacks in normal sampling mode.

Differential Revision: https://phabricator.services.mozilla.com/D115892
2021-05-27 11:44:45 +00:00
Alexandru Michis 42a1b9d860 Backed out changeset 2b813a59026a (bug 1710015) for causing crashes. 2021-05-24 01:28:47 +03:00
Julien Wajsberg 037bce57a7 Bug 1567222 - [profiler] Add a test to check network markers for synthetized responses from a service worker r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D112217
2021-05-21 09:40:30 +00:00
Julien Wajsberg 93131a67c8 Bug 1567222 - [profiler] Add redirect markers when respondWith isn't called in the service worker's fetch handler r=canaltinova,asuth,necko-reviewers
When `respondWith` isn't called, then we run the "reset interception"
steps, which sets up a new channel and does an internal redirect. We
need a profiler network marker with the "REDIRECT" status to properly
track this.

Differential Revision: https://phabricator.services.mozilla.com/D112216
2021-05-21 09:40:30 +00:00
Julien Wajsberg 030582337b Bug 1567222 - [profiler] Add a test with a serviceworker that has no fetch handlers r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D112214
2021-05-21 09:40:30 +00:00
Julien Wajsberg 8e022cdb47 Bug 1567222 - [profiler] Change the test utility to find the service worker thread, using a profiler marker r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D112211
2021-05-21 09:40:29 +00:00
Julien Wajsberg db45325052 Bug 1567222 - [profiler] In tests, make the network markers filter more generic r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D112210
2021-05-21 09:40:28 +00:00
Julien Wajsberg 32d5576a22 Bug 1567222 - [profiler] Improve the reporting of objectContainsOnly in case of failures r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D112209
2021-05-21 09:40:28 +00:00
Julien Wajsberg e3661cbd2a Bug 1567222 - [profiler] Report service worker install errors, so that tests don't timeout r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D112208
2021-05-21 09:40:28 +00:00
Julien Wajsberg 8f1a757929 Bug 1567222 - [profiler] Small changes to the caching serviceworker profiler marker test r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D112207
2021-05-21 09:40:27 +00:00
Julien Wajsberg cd011872b8 Bug 1567222 - [profiler] Improve the profiler's serviceworker tool to make it easier to install different serviceworker implementations r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D112206
2021-05-21 09:40:27 +00:00
Gerald Squelart 9bb504564a Bug 1710015 - Prevent re-instantiation of ProfilerParentTracker past XPCOMShutdownThreads - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D114709
2021-05-20 11:47:46 +00:00
Butkovits Atila 5aecf96709 Backed out changeset 922238fa3da0 (bug 1710015) for causing crashes on android. CLOSED TREE 2021-05-20 16:25:00 +03:00
Gerald Squelart 563a053a97 Bug 1689325 - Also use CPU to determine if a thread is asleep - r=canaltinova
In cases where a thread is not doing anything, but hasn't been marked as asleep with `AUTO_PROFILER_THREAD_SLEEP`, we can still duplicate the previous sample if we know that zero CPU activity happened.

Differential Revision: https://phabricator.services.mozilla.com/D115454
2021-05-20 12:09:58 +00:00
Gerald Squelart f00df4603f Bug 1710015 - Prevent re-instantiation of ProfilerParentTracker past XPCOMShutdownThreads - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D114709
2021-05-20 11:47:46 +00:00
Gerald Squelart 098790a8eb Bug 1703410 - Only change Windows timer resolution if PROFILER_ADJUST_TIMER_RESOLUTION is set - r=florian
On Windows, the profiler changes the timer resolution when the sampling interval is less than 10ms.
However this change affects all of Firefox, which can change other behaviors, sometimes causing confusion when refresh-rate issues magically disappear when the profiler is running.

So now by default the profiler will not change the timer resolution. This should rarely affect the profiler's effective sampling rate, unless all threads in a process are in a waiting state, in which case there is nothing new to sample anyway! The front-end is investigating ways to make sampling gaps more obvious, see https://github.com/firefox-devtools/profiler/issues/2962

If some power users really need the added sampling precision in some profiling sessions, the timer resolution change may be requested before running Firefox, by setting the environment variable "PROFILER_ADJUST_TIMER_RESOLUTION" to any value.

Differential Revision: https://phabricator.services.mozilla.com/D115451
2021-05-19 22:29:17 +00:00
Toshihito Kikuchi d8fe2ac176 Bug 1702086 - Part4: Use PEHeaders::GetBounds instead of GetModuleInformation. r=gerald
`SharedLibraryInfo::GetInfoForSelf()` can use `PEHeaders::GetBounds` instead of
`GetModuleInformation` to get the start/end address of a module's mapped region
in the local process.  It's roughly 100x faster because `GetModuleInformation`
invokes two system calls `NtQueryInformationProcess` and `NtReadVirtualMemory`
while `nt::PEHeaders` does not.

Depends on D115254

Differential Revision: https://phabricator.services.mozilla.com/D115255
2021-05-19 18:01:49 +00:00
Toshihito Kikuchi 2755a48956 Bug 1702086 - Part3: Use PEHeaders::GetVersionInfo. r=gerald
This patch replaces two versions of `GetVersion` in Gecko profiler and
baseprofiler with `PEHeaders::GetVersionInfo`.

Depends on D115253

Differential Revision: https://phabricator.services.mozilla.com/D115254
2021-05-19 18:01:48 +00:00
Toshihito Kikuchi 4e1b4037be Bug 1702086 - Part2: Get PDB information from the new handle. r=gerald
This patch is the actual fix for Bug 1702086.  The problem of Bug 1702086 is that
`LoadLibraryExW` loaded the module onto an address different from the original
mapped addresss because it was unloaded after we started enumeration.  Calling
`GetPdbInfo` with the original address `module.lpBaseOfDll` caused a crash.

The proposed fix consists of three parts.

The first part is to get PDB information from `handleLock`, which is always valid
even if the original address was unloaded.  With this, we don't need a check
of `VirtualQuery`.

The second part is to add `LOAD_LIBRARY_AS_IMAGE_RESOURCE` along with
`LOAD_LIBRARY_AS_DATAFILE` to the call to `LoadLibraryEx`.  This is needed
to read information from the sections outside the PE headers because
RVA (= relative virtual address) is an address after relocation.
Without `LOAD_LIBRARY_AS_IMAGE_RESOURCE`, a module is mapped without relocation,
so `GetPdbInfo()` accesses wrong memory resulting in a crash.

The third part is to introduce `PEHeaders::GetPdbInfo`, replacing two versions
of `GetPdbInfo` in Gecko profiler and baseprofiler.

Depends on D115252

Differential Revision: https://phabricator.services.mozilla.com/D115253
2021-05-19 18:01:48 +00:00
Toshihito Kikuchi d64610fed5 Bug 1702086 - Part1: Introduce EnumerateProcessModules. r=gerald
This patch introduces `EnumerateProcessModules` to enumerate all loaded modules
in the local process so that Gecko profiler and baseprofiler can use it.

Differential Revision: https://phabricator.services.mozilla.com/D115252
2021-05-19 18:01:47 +00:00
Gerald Squelart 93fc93adba Bug 1710607 - If not profiling, make ShutdownProfilerChild dispatch SYNC - r=canaltinova
When not profiling, ShutdownProfilerChild should be quick, so it's safe to run synchronously.
In this case, we don't need to manually shutdown the thread (to wait for the previously-async task).
This removes the risky thread-shutdown with its inner event-handling loop, where all crashes in bug 1613798 happen.

Differential Revision: https://phabricator.services.mozilla.com/D114845
2021-05-12 10:44:33 +00:00
Florian Quèze 7a8983cc88 Bug 1705318 - substract the memory used by the profiler buffer when sampling the memory counter, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D114397
2021-05-07 09:32:11 +00:00
Gerald Squelart e2d8ae5a08 Bug 1708350 - profiler_suspend_and_sample_thread can now sample the current thread - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D114115
2021-05-06 23:23:40 +00:00
Florian Quèze 3e63d9143b Bug 1635442 - Only initialize LUL when the StackWalk feature is requested on Linux, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D113693
2021-04-29 15:27:26 +00:00
Alexandru Michis 335b6f5f96 Backed out changeset 6bd7baadb78c (bug 1702086) for causing Bug 1607574.
CLOSED TREE
2021-04-28 23:23:01 +03:00
Gerald Squelart a354af1934 Bug 1707537 - Make ChildProfilerController::mThread thread-safe, and reset it before final dispatch and shutdown, to prevent re-entrancy - r=florian
Bug 1613798 (shutdown crashes during ChildProfilerController::ShutdownAndMaybeGrabShutdownProfileFirst's nsThread::Shutdown) could be explained by another nested shutdown destroying the same thread first, so when coming back to the first inner loop, there's a UAF on the already-destroyed thread!

Now we first reset the `mThread` pointer so it cannot be used by later/nested function calls, but keep a local reference (which should be the last one) to dispatch the shutdown operations and then shutdown the thread itself.

Also the thread pointer is now encapsulated in a DataMutex, in case it is accessed from different threads (e.g., the main thread and the IPC reception thread.)

Differential Revision: https://phabricator.services.mozilla.com/D113304
2021-04-26 23:17:02 +00:00