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

278 Коммитов

Автор SHA1 Сообщение Дата
Gerald Squelart 36b452b4ba Bug 1654128 - Added missing #includes in baseprofiler/lul - r=canaltinova
The build would fail in non-unified mode and/or when adding/removing other files.

Differential Revision: https://phabricator.services.mozilla.com/D84272
2020-07-21 08:20:20 +00:00
Gerald Squelart 126afc3ab4 Bug 1653181 - Profiler feature 'audiocallbacktracing' controls Start/StopAudioCallbackTracing(), off by default - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D83749
2020-07-17 11:22:23 +00:00
Randell Jesup fa153eb95d Bug 1642772: name processes in the profiler with eTLD+1 r=gerald,dveditz
Differential Revision: https://phabricator.services.mozilla.com/D77926
2020-07-15 18:00:54 +00:00
Gerald Squelart 8049dc9c3e Bug 1651086 - Allow profiler_register_thread from thread with already-registered id - r=canaltinova
It is possible that some threads fail/forget to unregister themselves, in which case a registered thread id could get recycled by a later thread, which was not allowed before this patch.

Note: The thread name cannot currently be changed. We record a special marker with the new name, so the frontend could process it to split the thread track at that point.

We also record a marker when profiler_unregister_thread is called from an already-unregistered thread, this could help find reg/unreg mismatches or nesting in Firefox threads.

Differential Revision: https://phabricator.services.mozilla.com/D83293
2020-07-13 13:18:29 +00:00
Gerald Squelart 7610ff4326 Bug 1651086 - Handle tgkill failure - r=canaltinova
On Linux (including Android), it was assumed that a registered thread could always be suspended through `tgkill`.
However in some cases a thread may not be correctly unregistered, in which case this would trigger `MOZ_ASSERT` or wait forever in the following loop.

This will especially be needed when `profiler_{,un}register_thread()` are made less strict in the following patch.

Windows and Mac already handle suspension failures.

Differential Revision: https://phabricator.services.mozilla.com/D83292
2020-07-13 13:14:32 +00:00
Gerald Squelart f9612141f1 Bug 1649776 - Use a separate mutex to access ProfileBufferChunkManagerWithLocalLimit::mUpdateCallback - r=canaltinova
To avoid deadlocks between the buffer main mutex and the externally-provided update callback code, the callback storage is now using a separate mutex, and both mutexes are never held at the same time.

Differential Revision: https://phabricator.services.mozilla.com/D82141
2020-07-06 12:38:06 +00:00
Gerald Squelart 56736f31c3 Bug 1648507 - Distinguish pausing sampling only from pausing the whole profiler - r=canaltinova,perftest-reviewers,geckoview-reviewers,agi
The profiler can be "paused", which stops sampling, and since bug 1578329 stops markers as well.

Some test suites use pausing between tests (to better differentiate the tests, to keep the profiler ready to run, and to lower the amount of recorded data). But this causes problems with some tracing markers, as their matching ends have not been recorded (e.g., an end marker is missing), which show up as very loooong markers.
To solve this, we need to be able to pause sampling only, but keep recording markers.
But we still need to be able to pause the whole profiler, in particular before capturing, to avoid recording anything around that time.

This big patch is mostly mechanical changes: Wherever there are "Pause" and "Unpause/Resume" profiler functions, we add matching "PauseSampling" and "UnpauseSampling/ResumeSampling" functions that only impact the periodic sampling loop; And existing "Pause/Unpause/Resume" imply pausing sampling as well.
Exceptions and extra work:
- nsIProfiler (the JS API) already had `Pause/ResumeSampling()`, which misleadingly paused everything! Now they do the right thing, and we have `Pause/Resume()` as well.
- All tests using `Pause/ResumeSampling()` now use `Pause/Resume()`, except for Talos tests that only pause sampling between tests; Added some extra `Pause()` calls to pause everything before capturing profiles.
- GeckoJavaSampler doesn't handle pausing/resuming everything, this should be done in a follow-up bug.
- Sampling-only pauses are not streamed into JSON. If needed, we should follow-up, with potential work on the front-end to deal with these.

Differential Revision: https://phabricator.services.mozilla.com/D81492
2020-07-02 01:36:27 +00:00
Mike Hommey 77976c2cc1 Bug 1463035 - Remove MOZ_SIGNAL_TRAMPOLINE. r=gerald
This was previously r=jchen and landed, but was backed out because some
Android tests were running on an unrealistically old Linux kernel. These
tests have been retired, so this can reland.

Differential Revision: https://phabricator.services.mozilla.com/D81278
2020-06-26 03:48:49 +00:00
Mike Hommey 219d10e7ce Bug 1648654 - Remove AutoObjectMapperFaultyLib. r=gerald
Bug 1486524 disabled the features from the custom linker that required
AutoObjectMapperFaultyLib. We can now rely on AutoObjectMapperPOSIX
instead.

Differential Revision: https://phabricator.services.mozilla.com/D81264
2020-06-26 01:26:56 +00:00
Mike Hommey a1386ca439 Bug 1648340 - Set LOCAL_INCLUDES properly for AutoObjectMapper.h. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81023
2020-06-25 10:59:32 +00:00
Gerald Squelart 665b0d71d2 Bug 1630448 - MOZ_PROFILER_STARTUP_NO_BASE=1 prevents Base Profiler from running when MOZ_PROFILER_STARTUP is set - r=canaltinova
The Base Profiler is still recent and barely used, so it may contain some bugs.
With bug 1586939, the Base Profiler is now used more often because it is controlled the same way as the Gecko Profiler.
This has surfaced some intermittent issues, which pollute existing tests.

Until the root cause is found (see bug 1648325), setting `MOZ_PROFILER_STARTUP_NO_BASE=1` prevents the Base Profiler from running. This may be used where problems are visible, to diagnostic them and/or reduce them where needed.

Differential Revision: https://phabricator.services.mozilla.com/D81018
2020-06-25 07:13:43 +00:00
Gerald Squelart 8c64fc6990 Bug 1642726 - maybelocked_profiler_add_marker_for_thread - r=gregtatum
This function can be called whether the profiler mutex is locked or not. If locked, the provided pointer to the profiler mutex is used internally, otherwise the mutex will be locked as needed.

Differential Revision: https://phabricator.services.mozilla.com/D79412
2020-06-22 14:36:18 +00:00
Gerald Squelart b834db3337 Bug 1642726 - locked_profiler_get_backtrace - r=gregtatum
`locked_profiler_get_backtrace` can be used internally from places that already hold the profiler lock.

Differential Revision: https://phabricator.services.mozilla.com/D79411
2020-06-22 14:36:16 +00:00
Gerald Squelart ddbeeb188c Bug 1642726 - PSAutoTryLock - r=gregtatum
PSAutoTryLock attempts to lock the mutex, but gives up immediately if it's already locked.
This can be used in profiler functions that may be called from unknown code, to avoid deadlocks involving the profiler mutex and another mutex that could be indirectly used by the profiler itself.

Differential Revision: https://phabricator.services.mozilla.com/D79410
2020-06-22 21:30:06 +00:00
Ted Campbell 5f98fae13b Bug 1645469 - Add profiler subcategories for SpiderMonkey JITs. r=jandem,gerald
In the JIT frame sampler, we apply the appropriate category in addition to
the "implementation" field. For JS frames (IS_JS_FRAME), we identify as
either BaselineInterpreter or Interpreter. Note that JS_Other still applies
to various places we enter SpiderMonkey outside of RunScript.

Differential Revision: https://phabricator.services.mozilla.com/D79524
2020-06-15 14:56:50 +00:00
Ted Campbell 6aa5132146 Bug 1645464 - Use a shared ProfilingCategoryList.h r=gerald,froydnj
Replace the duplicate lists in mozglue/baseprofiler/public and js/public with
a shared list. Add this list to both moz.build files so it is published twice
which simplifies supporting different standalone configurations.

Differential Revision: https://phabricator.services.mozilla.com/D79520
2020-06-15 13:59:55 +00:00
Paul Adenot bdfef650d8 Bug 1626918 - Add categories for real-time media tracing. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D78509
2020-06-12 13:13:53 +00:00
Ted Campbell b3e185db5d Bug 1644218 - Add blinterp implementation tracking to profiler r=jandem,gerald
Introduce an IS_BLINTERP_FRAME flag to ProfilingStackFrame to distinguish C++
and Baseline interpreter frames. In the profile data this sets the
"implementation" to "blinterp".

Differential Revision: https://phabricator.services.mozilla.com/D78725
2020-06-09 12:27:15 +00:00
Ted Campbell 393ca29b50 Bug 1644218 - Cleanup ProfilingStackFrame flags r=gerald
Round the number of reserved flag bits up to 16. This leaves 16-bits for the
category (so 64k subcategories). Also make the baseprofiler consistent.

Differential Revision: https://phabricator.services.mozilla.com/D78724
2020-06-08 23:46:16 +00:00
Gerald Squelart 315b834a0e Bug 1586939 - Remove "_BASE" from most Base Profiler env-vars - r=gregtatum a=reland CLOSED TREE
Now both profilers are controlled by the same environment variables, e.g.
"MOZ_PROFILER_STARTUP" to run both profilers at startup.

The only remaining Base Profiler-specific commands are:
- MOZ_BASE_PROFILER_HELP, because the Base Profiler doesn't have the same
  capabilities as Gecko, so it may display different available features.
- MOZ_BASE_PROFILER_LOGGING, because the Base Profiler doesn't have access to
  MOZ_LOG (both the env-var and the C++ macros).

Differential Revision: https://phabricator.services.mozilla.com/D54449
2020-05-28 03:39:32 +00:00
Gerald Squelart 26045e2d2c Bug 1586939 - Skip LoadLibraryEx if we're likely to hit the crash in nvd3d9wrap{,x}.dll - r=gregtatum a=reland CLOSED TREE
This is a port of bugs 1607574, 1617188, 1635823 to the Base Profiler.

Differential Revision: https://phabricator.services.mozilla.com/D77014
2020-05-28 03:39:07 +00:00
Razvan Maries cfc05656e9 Backed out 2 changesets (bug 1586939) for build bustages on ProtocolFuzzer.h. CLOSED TREE
Backed out changeset 1f66a6a498e5 (bug 1586939)
Backed out changeset 6e1337767992 (bug 1586939)
2020-05-28 07:38:04 +03:00
Gerald Squelart 3f2fbaa757 Bug 1586939 - Remove "_BASE" from most Base Profiler env-vars - r=gregtatum
Now both profilers are controlled by the same environment variables, e.g.
"MOZ_PROFILER_STARTUP" to run both profilers at startup.

The only remaining Base Profiler-specific commands are:
- MOZ_BASE_PROFILER_HELP, because the Base Profiler doesn't have the same
  capabilities as Gecko, so it may display different available features.
- MOZ_BASE_PROFILER_LOGGING, because the Base Profiler doesn't have access to
  MOZ_LOG (both the env-var and the C++ macros).

Differential Revision: https://phabricator.services.mozilla.com/D54449
2020-05-28 03:39:32 +00:00
Gerald Squelart ff560ee2fd Bug 1586939 - Skip LoadLibraryEx if we're likely to hit the crash in nvd3d9wrap{,x}.dll - r=gregtatum
This is a port of bugs 1607574, 1617188, 1635823 to the Base Profiler.

Differential Revision: https://phabricator.services.mozilla.com/D77014
2020-05-28 03:39:07 +00:00
Greg Tatum 3802fc82a4 Bug 1640274 - Remove the unused TrackOptimizations profiler; r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D76854
2020-05-27 22:08:49 +00:00
Greg Tatum ca8ec92461 Bug 1571086 - Remove privacy feature from the profiler; r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D76853
2020-05-27 22:07:57 +00:00
Gerald Squelart cf61fd1e10 Bug 1641122 - Fix 32-bit Android profiler buffer size default - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D77016
2020-05-27 19:41:46 +00:00
Markus Stange d069f4cc74 Bug 1635567 - Remove HAVE_UNSORTED_EXIDX code, which worked around a bug in Android ICS which is no longer supported. r=jld
This code was not being built any more.
GeckoView requires Android OS version 4.3 (API Level 18). I'm not sure what the
corresponding ANDROID_VERSION macro constant for API Level 18 is, but it's
definitely higher than 16.

Differential Revision: https://phabricator.services.mozilla.com/D73940
2020-05-23 00:57:58 +00:00
Gerald Squelart f2401ecda3 Bug 1464506 - Record FileIO markers on all threads - r=canaltinova
In addition to the existing "mainthreadio" feature, we now have:
- "fileio" to also capture file I/O from other profiled threads.
- "fileioall" to also capture file I/O from all threads (even unregistered threads).
- "noiostacks" to prevent capturing stack traces for "io" markers.
These are all off by default, except for `MOZ_PROFILER_STARTUP=1`.

Differential Revision: https://phabricator.services.mozilla.com/D75764
2020-05-25 08:58:47 +00:00
Gerald Squelart 271f2b32ae Bug 1464506 - Statically check profiler feature numbers - r=canaltinova
This is a simple compile-time check that the feature numbers go from 0 to N-1, to prevent some mistakes when updating feature lists.

Differential Revision: https://phabricator.services.mozilla.com/D75763
2020-05-25 08:57:44 +00:00
Gerald Squelart 3147b9d1d6 Bug 1464506 - profiler_add_marker_for_mainthread records markers from any thread into the main thread track - r=canaltinova
Some markers may be more useful when gathered into a single track, and the main thread is ideal because it's almost always present.

Differential Revision: https://phabricator.services.mozilla.com/D75760
2020-05-25 08:57:31 +00:00
Gerald Squelart 2502f01aa8 Bug 1464506 - CorePS records the main thread id - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D75759
2020-05-25 08:57:29 +00:00
Gerald Squelart 7f21bc7ade Bug 1464506 - Improved StaticBaseProfilerStats, added max duration - r=canaltinova
Made StaticBaseProfilerStats a proper class, with more explicit types for measurements and printfs.
Also added the maximum duration in a set, which can be useful to see what the worst case of some code may be.

(Reminder: This code is not built by default, uncomment `#  define PROFILER_RUNTIME_STATS` above to enable it.)

Differential Revision: https://phabricator.services.mozilla.com/D75758
2020-05-25 08:55:55 +00:00
Gerald Squelart a88e6ae204 Bug 1594268 - profiler_add_marker_for_thread takes payload by const& - r=canaltinova
Instead of accepting a `UniquePtr<ProfilerMarkerPayload>`, `profiler_add_marker_for_thread` now takes it by `const ProfilerMarkerPayload&`.
All callers can now create the payload on the stack, or as a temporary object. This saves a memory alloc+free for each call.

Differential Revision: https://phabricator.services.mozilla.com/D75912
2020-05-19 23:07:54 +00:00
alwu fd606724bc Bug 1612557 - part4 : use `Media` category for markers r=bryce,gerald,canaltinova
This patch will do :
- add `Media` markers in related codes
- implement `MediaSampleMarkerPayload` to record the media sample

The advantage of doing so :
- using markers can help us know what happens on the media by a glance without expanding the call stack
- adding sample markers allows us compare the speed of decoding sample in `MediaDecoderStataMachine` and rendering sample in `VideoSink`

Differential Revision: https://phabricator.services.mozilla.com/D74174
2020-05-16 19:58:25 +00:00
alwu 0bccc7a4cf Bug 1612557 - part2 : create a sub-category 'Cubeb'. r=padenot
This patch will do :
- create a sub-category `Cubeb`
- add  `Cubeb` profiling labels in related codes

The advantage of doing so :
- allow us to know the percentage of time respectively we spend on cubeb and non-cubeb codes

More details :
The profiling code would include `<atomic>` which is C++ only, so I can't use the label in `cubeb.c` directly. Instead, I add labels on the `AudioStream` and `AudioCallbackDriver` where we would call cubeb related methods.

Differential Revision: https://phabricator.services.mozilla.com/D74172
2020-05-11 14:08:10 +00:00
alwu 8dda6be6ef Bug 1612557 - part1 : create a profiling category `Media`. r=bryce,gerald
This patch will do :
- create a profiling category `Media`
- add  `Media` profiling labels in related codes

The advantage of doing so :
- allow us to easily see what operations are related to media playback from the profiled report

More details :
According to the description in the `ProfilingCategory.h`, `topmost profiler label frame in the label stack determines the category pair of that stack`. Therefore, most labels I added are the first task would run on the thread, in order to ensure all its following tasks can be marked as the media playback label as well.

Differential Revision: https://phabricator.services.mozilla.com/D74171
2020-05-12 17:35:19 +00:00
Gerald Squelart e1d51db19a Bug 1635570 - Cut too-long label dynamic strings and add ellipsis - r=canaltinova
If a label contains a dynamic string that's too long (512 characters or more), instead of just replacing it with "(too long)", we now cut it down to the maximum size, with an ellipsis at the end.

Added test for that in gtest. Also added nearby test for empty strings.

Differential Revision: https://phabricator.services.mozilla.com/D74378
2020-05-12 01:13:17 +00:00
Chris Fronk af8a02cc9d Bug 1512991 - Add JsonWriteFunc::Write to take string length. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D72560
2020-05-08 16:24:31 +00:00
Gerald Squelart 668492b4ef Bug 1632750 - Recycle chunks that are destroyed through DestroyChunksAtOrBefore or the local limit - r=canaltinova
Whenever chunks are about to be destroyed, we try to keep one or two alive, to hopefully fulfill the next request, thereby avoiding a deallocation+allocation pair.

Differential Revision: https://phabricator.services.mozilla.com/D72370
2020-05-08 03:35:57 +00:00
Gerald Squelart 3292ac76d9 Bug 1632750 - Make ProfileBufferChunkManagerWithLocalLimit a ProfileBufferControlledChunkManager - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D72363
2020-05-08 03:34:28 +00:00
Gerald Squelart 2cf1bef331 Bug 1632750 - ProfileBufferChunkManagerWithLocalLimit doesn't need to track chunk metadata sizes - r=canaltinova
The chunk metadata size is tiny (less than 100 bytes) compared to the buffer size (1MB by default), so it's fine to ignore it while dealing with cross-Firefox limits.

Differential Revision: https://phabricator.services.mozilla.com/D72558
2020-05-08 03:33:29 +00:00
Gerald Squelart a09a699a12 Bug 1632750 - ProfileBufferControlledChunkManager - r=canaltinova
Interface class for a chunk manager that can be controlled: It will provide updates about chunks, and release chunks on command.

Differential Revision: https://phabricator.services.mozilla.com/D72362
2020-05-08 03:44:34 +00:00
Markus Stange fcfda28406 Bug 1635803 - Make sure <cstdlib> is included before mozalloc.h, to work around bug 1635968. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D74154
2020-05-06 22:57:05 +00:00
Gerald Squelart 9eb780f5ef Bug 1635338 - profiler_is_locked_on_current_thread() now also checks for the buffer lock - r=gregtatum,canaltinova
profiler_is_locked_on_current_thread() is used to help users avoid calling `profiler_...` functions when the profiler may already have a lock in place, which would prevent a 2nd recursive lock (resulting in a crash or a never-ending wait).
So we must return `true` for any of:
- The main profiler mutex, used by most functions, and/or
- The buffer mutex, used directly in some functions without locking the main mutex, e.g., marker-related functions.

Differential Revision: https://phabricator.services.mozilla.com/D73789
2020-05-06 12:45:40 +00:00
Gerald Squelart a58e3ee5a8 Bug 1635338 - ProfileChunkedBuffer::IsThreadSafeAndLockedOnCurrentThread - r=gregtatum,canaltinova
Expose `ProfileChunkedBuffer`'s mutex (if present), so that potential callers can avoid recursive calls that would lock or crash.

Differential Revision: https://phabricator.services.mozilla.com/D73788
2020-05-06 12:44:44 +00:00
Gerald Squelart f504b757de Bug 1635338 - baseprofiler::profiler_is_locked_on_current_thread - r=gregtatum,canaltinova
Mimic Gecko Profiler's `profiler_is_locked_on_current_thread()` in Base Profiler.

Differential Revision: https://phabricator.services.mozilla.com/D73787
2020-05-06 12:44:22 +00:00
Gerald Squelart 368c811625 Bug 1635338 - BaseProfilerMutex::IsLockedOnCurrentThread - r=gregtatum,canaltinova
Make `BaseProfilerMutex::mOwningThreadId` non-optional, and use it in `IsLockedOnCurrentThread()`, which is similar to the one in Gecko Profiler.
Add related `BaseProfilerMaybeMutex::IsActivatedAndLockedOnCurrentThread()`.

Differential Revision: https://phabricator.services.mozilla.com/D73786
2020-05-06 12:42:37 +00:00
Greg V e65e9412b0 Bug 1634205 - Support Gecko Profiler and Base Profiler on FreeBSD r=mstange
- supports amd64 and arm64 (aarch64)
- uses LUL for stack walking

Differential Revision: https://phabricator.services.mozilla.com/D73162
2020-05-06 17:44:19 +00:00
Markus Stange 16fc9519a1 Bug 1578726 - Stop looking for non-existent EnterJIT frames. r=gerald
At the time this code was written, JavaScript JIT entry trampolines were
emitting EnterJIT label frames that carried a stack address. From this stack
address, register values could be recovered that would allow native stack
unwinding to resume after getting lost in JIT code.

The EnterJIT label frame was removed in bug 1057082.

Differential Revision: https://phabricator.services.mozilla.com/D73939
2020-05-05 22:53:45 +00:00