This patch adds logging to some important functions that currently lack it.
Thread registration/unregistration is done with DEBUG_LOG because it's
more verbose than the other profiler logging, but less verbose than LUL's
logging.
The patch also scraps the BEGIN/END logging pairs because they bloat the output
for little gain. Now it just logs on function entry.
--HG--
extra : rebase_source : 3ef3d263c19cda03198e8b3a9ab89866f74ed1cd
The profiler will use level 3 (Info) and 4 (Debug) logging, though this patch
only uses level 3. LUL will use level 5 (Verbose) debugging.
The patch also tweaks parts of the the usage message, including adding
MOZ_PROFILER_{STARTUP,SHUTDOWN} to it.
--HG--
extra : rebase_source : f43a023912fbce993ed367cdd26b8f25f25381de
It's a very general mechanism for replacing the implementation of
printf_stderr().
It's primarily used by the profiler, sparingly, and not in an important way.
Worse, it prevents us from using MOZ_LOG in the profiler, which is something I
want. Because if any code that locks gPSMutex also calls MOZ_LOG, that then
calls printf_stderr(), which calls profiler_log(), which locks gPSMutex, which
deadlocks.
The only other use of set_stderr_callback() is for the ultra-hacky,
for-local-use-only copy_stderr_to_file() function, which was added for B2G
debugging and is no longer necessary.
This patch removes set_stderr_callback() altogether.
--HG--
extra : rebase_source : d31ecb482fe5899f62dc56a38e87d91f9271bab0
All three platform-*.cpp files have similar structure, most especially for
SamplerThread::Run(), with considerable duplication. This patch factors out
the common parts into a single implementation in platform.cpp.
* The top level structure of class SamplerThread has been moved to
platform.cpp.
* The class has some target-dependent fields, relating to signal handling and
thread identity.
* There's a single implementation of Run() in platform.cpp.
* AllocPlatformData() and PlatformDataDestructor::operator() have also been
commoned up and moved into platform.cpp.
* Time units in SamplerThread have been tidied up. We now use microseconds
throughout, except in the constructor. All time interval field and variable
names incorporate the unit (microseconds/milliseconds) for clarity. The
Windows uses of such values are scaled up/down by 1000 accordingly.
* The pre-existing MacOS Run() implementation contained logic that attempted
to keep "to schedule" in the presence of inaccuracy in the actual sleep
intervals. This now applies to all targets. A couple of comments on this
code have been added.
* platform-{win32,macos,linux-android}.cpp have had their Run() methods
removed, and all other methods placed in the same sequences, to the extent
that is possible.
* In the Win32 and MacOS implementations, Thread::SampleContext has been
renamed to Thread::SuspendSampleAndResumeThread as that better describes
what it does. In the Linux/Android implementation there was no such
separate method, so one has been created.
* The three Thread::SuspendSampleAndResumeThread methods have been commented
in such a way as to emphasise their identical top level structure.
* The point in platform.cpp where platform-{win32,macos,linux-android}.cpp are
#included has been moved slightly earlier in the file, into the
SamplerThread encampment, as that seems like a better place for it.
--HG--
extra : rebase_source : 0f93e15967b810c09e645fa593dbf85f94b53a9b
ProfileBuffer::FindLastSampleOfThread currently involves a linear search
backwards through the sample buffer. Profiling showed that to be the largest
profiler cost by far, at least on Linux. Bugs 1344118 and 1344258
significantly improve the situation, collectively reducing the cost by a
factor of at least 5 and often much more. But the linear search is still
present and still dominant. The worst of it is that it's unnecessary: we
could achieve the same by recording the start point of the most recent sample
for each thread in that thread's ThreadInfo record.
This patch does exactly that, adding the type ProfileBuffer::LastSample to
store the start points. LastSample also includes the ID of the thread it
pertains to as a read-only field, as that is needed in various places.
addTag doesn't check whether we're overwriting buffer entries containing start
points. Instead, FindLastSample checks whether the entry pointed to the
LastSample it is given still contains a marker.
--HG--
extra : rebase_source : 2987ec744a5c16e8b6814abe7efb507fc7280605
Replace it with profiler_is_active() in one place, and simply remove it in the
other places. These other places are:
- Around the call to profiler_OOP_exit_profile: profiler_OOP_exit_profile
itself already checks whether the profiler is running and does nothing if
it's not.
- When handling the 'profiler-subprocess-gather' notification. This
notification is sent by the profiler because it's interested in the
profile, so there's little reason to reject it.
- In RecvProfile: If the child process sent us a profile, it did so in
response to a GatherProfile request, so chances are that we're still
interested in that response.
These changes may get us a little closer to a state where you can call
getProfileDataAsync, stop the profiler before the content process profiles
have all come in, and then still receive a response with all the profiles.
At the moment, stopping the profiler will abort the profile gathering process,
but that seems more like an accident and less like the behavior you'd want.
MozReview-Commit-ID: 2tRXC70BztJ
--HG--
extra : rebase_source : 3b2f6f51d75d5f0d439e1a815d84164a5a763603
Instead of copying and concatenating strings into an mDest buffer in
SamplerStackFramePrintfRAII, require callers to keep the string buffer alive
for the duration of the current scope, and store the pointer to the annotation
string in the ProfileEntry. During stackwalking, concatenate the label and the
annotation (separated by a space) and store the resulting string in the
profile buffer.
MozReview-Commit-ID: GEjcLrhhdvb
--HG--
extra : rebase_source : 683749421ee2122805a249cf413e882ee5f33331
sutagent is no longer built or used; devicemanagerSUT is completely
unused. After this change, devicemanagerADB is the only implementation of
devicemanager, and test harness options like --dm_trans are eliminated.
It's not necessary and causes hangs.
The patch also inlines setup_atfork() and moves the Linux-only code closer to
the Linux-only PlatformInit(), and tweaks the comments a bit.
--HG--
extra : rebase_source : 0db23d649d9468b9308b881c0bbf5ea25a95ea13
This patch forks the breakpad files used for GUID generation and replaces them
with copies living together with the rest of the forked sources. Since other
files in the breakpad sources rely on the original files being present they
haven't been removed but we deliberately define their inclusion definitions in
the build system to prevent them from contributing to the build. This ensures
that we always use our own version of the GUID generator while not touching
the non-forked sources.
MozReview-Commit-ID: 5kW74yAPUDW
--HG--
rename : toolkit/crashreporter/google-breakpad/src/common/linux/guid_creator.cc => toolkit/crashreporter/breakpad-client/linux/handler/guid_generator.cc
rename : toolkit/crashreporter/google-breakpad/src/common/linux/guid_creator.h => toolkit/crashreporter/breakpad-client/linux/handler/guid_generator.h
extra : rebase_source : 60eb027258833996777469d2a13142077486bee9
This doesn't allow --fix to run on the whole tree in one go, but does allow it to be run on individual directories. This
is due to an ESLint issue, where once the processor is loaded, it applies to the rest of the files.
MozReview-Commit-ID: Fqg5yK22Dhu
--HG--
rename : tools/lint/eslint/eslint-plugin-mozilla/.eslintrc.js => tools/lint/eslint/.eslintrc.js
rename : tools/lint/eslint/eslint-plugin-mozilla/lib/processors/self-hosted.js => tools/lint/eslint/eslint-plugin-spidermonkey-js/lib/processors/self-hosted.js
extra : rebase_source : 9913f929985016f4a22ff78641051dc025df14f2
Currently the mach clang-format command is formating '-r tip^', which is
everything in the tip revision, plus changes. Often this does what you want,
but if you're using changeset evolution or history rewriting this doesn't work
so well. If you `hg up $rev` to some other revision with the intention of
clang-formating that revision, you don't get that revision formated when you
run clang-format. You get the lines touched by the changeset with the "tip"
bookmark formatted. We really want to have clang-format format '-r .^' which
means "the current revision in the working dir, plus any uncommited changes".
This results in the expected behaviour, and means clang-format can be used to
re-format commits which are work-in-progress and/or being evolved.
MozReview-Commit-ID: iv82HENxiA
--HG--
extra : rebase_source : a1d05472f499f5a68bcaab9ce260d60ecbca067d
sutagent is no longer built or usedr; devicemanagerSUT is completely
unused. After this change, devicemanagerADB is the only implementation of
devicemanager, and the --dmTrans and similar options have been removed
from test harnesses and mach commands.
Specifically:
- Improve the documentation on all the profiler_*() functions, esp. about what
they do when the profiler is inactive.
- Fix numerous spelling mistakes.
- Wrap all comment lines at 80 chars.
- Change /**/ comments to // comments throughout.
--HG--
extra : rebase_source : 17f766301416806764413cea7f949c42e7721ab9
Specifically:
- Renames kGeckoThreadName as kMainThreadName, and RegisterCurrentThread() as
locked_register_thread().
- Removes the aIsMainThread parameter from locked_register_thread(). It can be
computed via NS_IsMainThread().
- Moves the PseudoStack initialization within locked_register_thread(), so it's
done in a single place. Also calls init() at that place; previously the
non-main threads didn't have init() called on their tlsPseudoStack! According
to ThreadLocal.h this shouldn't have worked...
- Adds some !NS_IsMainThread() assertions to
profiler_{register,unregister}_thread().
--HG--
extra : rebase_source : c44836dddc988c1f49ec91eccd35f088e0d30ed1
It took me some time to understand this snippet of code, so I wrote a comment
about it.
--HG--
extra : rebase_source : b25fc8384a4fe00df7d8a0585e7a1944226fa212
ProfilerBacktrace.h doesn't need to be visible outside the profiler because
the ProfilerBacktrace type is only used in pointers outside the profiler and
the existing forward declaration in GeckoProfiler.h suffices for that.
--HG--
rename : tools/profiler/public/ProfilerBacktrace.h => tools/profiler/core/ProfilerBacktrace.h
extra : rebase_source : 50752626fbd6948de26e193956ed7b82b41b1830
API before this change:
- nsIProfiler::getSharedLibraryInformation() returns a string containing a
JSON array of libraries.
- The profile format is at version 3.
- Every profile has a "libs" field that contains the same JSON string as the
return value of nsIProfiler::getSharedLibraryInformation.
- The array of libraries is not sorted.
- Each library has a "name" field that contains:
- The module's debug name on Windows
- The full path to the binary on Mac + Linux
API after this change:
- nsIProfiler::getSharedLibraryInformation() is removed.
- nsIProfiler has a readonly property called sharedLibraries.
- The profile format is at version 4.
- Every profile has a "libs" field that contains the same array as
nsIProfiler.sharedLibraries, no longer as a JSON string but as a regular
array.
- The array of libraries is sorted by start address.
- Each library has a "name" field that contains the binary file's basename,
on all platforms.
- Each library has a "path" field that contains the full path to the binary,
on all platforms.
- Each library has a "debugName" field that contains the library's debug
name, on all platforms. On Windows, the debug name is the filename
(basename) of the pdb file for that binary. On other platforms, debugName
is the same as |name|.
- Each library has a "debugPath" field that contains the absolute path
library's pdb file on Windows; on non-Windows, debugPath and path are the
same.
- Each library has an "arch" field that is either an empty string (Linux +
Windows) or the library's architecture; it'll differentiate between the
architectures "x86_64" and "x86_64h". (x86_64h is used for binaries that
contain instructions that are specific to the Intel Haswell
microarchitecture.)
MozReview-Commit-ID: 8Nrs4dyHhDS
--HG--
extra : rebase_source : 4039926ae4d776bf53ea71df5fe3f8200d3e2784
extra : source : 4e282aa03422de5b8d51e1aaeb3e53ee547293dd
This is interesting information on Mac because some system libraries come in
two 64 bit versions: a regular one, and one that contains Haswell-specific
instructions. The former 'architecture' is called x86_64 and the latter is
called x86_64h (h for Haswell).
We set arch to the empty string on non-Mac platforms. It's not all that
interesting on those platforms because there will be only one architecture
in the binary at the given path, unlike on Mac where you can have fat
binaries with multiple architectures.
MozReview-Commit-ID: Dgnslv0D3Ug
--HG--
extra : rebase_source : cf1fcfc1635d373eaeea35aad2f73b235097c748
API before this change:
- nsIProfiler::getSharedLibraryInformation() returns a string containing a
JSON array of libraries.
- The profile format is at version 3.
- Every profile has a "libs" field that contains the same JSON string as the
return value of nsIProfiler::getSharedLibraryInformation.
- The array of libraries is not sorted.
- Each library has a "name" field that contains:
- The module's debug name on Windows
- The full path to the binary on Mac + Linux
API after this change:
- nsIProfiler::getSharedLibraryInformation() is removed.
- nsIProfiler has a readonly property called sharedLibraries.
- The profile format is at version 4.
- Every profile has a "libs" field that contains the same array as
nsIProfiler.sharedLibraries, no longer as a JSON string but as a regular
array.
- The array of libraries is sorted by start address.
- Each library has a "name" field that contains the binary file's basename,
on all platforms.
- Each library has a "path" field that contains the full path to the binary,
on all platforms.
- Each library has a "debugName" field that contains the library's debug
name, on all platforms. On Windows, the debug name is the filename
(basename) of the pdb file for that binary. On other platforms, debugName
is the same as |name|.
- Each library has a "debugPath" field that contains the absolute path
library's pdb file on Windows; on non-Windows, debugPath and path are the
same.
- Each library has an "arch" field that is either an empty string (Linux +
Windows) or the library's architecture; it'll differentiate between the
architectures "x86_64" and "x86_64h". (x86_64h is used for binaries that
contain instructions that are specific to the Intel Haswell
microarchitecture.)
MozReview-Commit-ID: 8Nrs4dyHhDS
--HG--
extra : rebase_source : 4039926ae4d776bf53ea71df5fe3f8200d3e2784
extra : source : 4e282aa03422de5b8d51e1aaeb3e53ee547293dd
This is interesting information on Mac because some system libraries come in
two 64 bit versions: a regular one, and one that contains Haswell-specific
instructions. The former 'architecture' is called x86_64 and the latter is
called x86_64h (h for Haswell).
We set arch to the empty string on non-Mac platforms. It's not all that
interesting on those platforms because there will be only one architecture
in the binary at the given path, unlike on Mac where you can have fat
binaries with multiple architectures.
MozReview-Commit-ID: Dgnslv0D3Ug
--HG--
extra : rebase_source : cf1fcfc1635d373eaeea35aad2f73b235097c748
I also tweaked the int type of the JSON writer to match the IntProperty
method.
MozReview-Commit-ID: rtxLDKtJQZ
--HG--
extra : rebase_source : fa924479926cad6e07755d10c049a40ad896c3cd
Running eslint with --fix didn't fix many of the issues. The majority here had to be fixed by hand but a significant majority of the issues were related to a few files that I was able to use find-and-replace with. I regret not making this in to separate commits of the hand-fixes and the fixes from --fix but I don't recall --fix fixing any of the issues.
MozReview-Commit-ID: ANyg2qfo3Qx
--HG--
extra : rebase_source : 61d2aa91bf9474af3d72a5dea41b25dca442c1b7