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
`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
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
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
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
SprintfLiteral doesn't support "%#llx" anymore.
So this patch switches to an explicit "0x%llx" to output addresses as the symbolicator expects.
Differential Revision: https://phabricator.services.mozilla.com/D114914
When the linker defaults to --as-needed, libmozgtk ends up not linked
to libxul because libxul doesn't use anything from it.
We solve the problem by adding a symbol to mozgtk and have libxul use
it.
In bug 1377445, we moved XShmQueryExtension to mozglue. While libxul
currently doesn't use the symbol (it's a workaround for system
libraries), we can move the function back to mozgtk and add a dummy
call.
Differential Revision: https://phabricator.services.mozilla.com/D113487
Instead of lots of #ifdef's inside WalkStackMain64 to access CONTEXT registers with their platform-specific names, these registers are now accessible through generic accessors in the wrapper class.
This also helps with avoiding CONTEXT pointers (and the worry they could be null).
Differential Revision: https://phabricator.services.mozilla.com/D112168
Bug 1620118 added a new field `isDependent` in the third-party-module ping
which is calculated in `UntrustedModulesProcessor`. However, bug 1684532
revealed it was not accurate because some third-party applications revert
the import table to the original state immediately after their module was
loaded.
Now that we have a logic to determine `isDependent` in `NtMapViewOfSection`
to automatically block a module injected through the import table, we can
pass that value to the ping and remove the original logic in `UntrustedModulesProcessor`.
Differential Revision: https://phabricator.services.mozilla.com/D112227
This is a little more than we need to disable it, but I figure we'll want to
support different UI densities in the skeleton UI long term.
Differential Revision: https://phabricator.services.mozilla.com/D111906
This is a little more than we need to disable it, but I figure we'll want to
support different UI densities in the skeleton UI long term.
Differential Revision: https://phabricator.services.mozilla.com/D111906
When restarting, we set the XRE_PROFILE_PATH env var. This normally would
prevent us from showing the skeleton UI. This patch just adds another env
var to indicate that we are restarting so the skeleton UI can know it's
safe to display.
Differential Revision: https://phabricator.services.mozilla.com/D111884
We specify our colors like 0xrrggbb, but CreateSolidBrush expects a
color created with the RGB macro, which actually arranges it as
0xbbggrr. This change has us use the RGB macro to give a color when
creating the brush.
Differential Revision: https://phabricator.services.mozilla.com/D107945