MozStackWalk() is different on Windows to the other platforms. It has two extra
arguments, which can be used to walk the stack of a different thread.
This patch makes those differences clearer. Instead of having a single function
and forbidding those two arguments on non-Windows, it removes those arguments
from MozStackWalk, and splits off MozStackWalkThread() which retains them. This
also allows those arguments to have more appropriate types (HANDLE instead of
uintptr_t; CONTEXT* instead of than void*) and names (aContext instead of
aPlatformData).
The patch also removes unnecessary reinterpret_casts for the aClosure argument
at a couple of MozStackWalk() callsites.
When set to true, the resulting profile will have a non-null meta.shutdownTime
field which is set to current time.
Non-shutdown profiles also get that field, but it's null for them.
MozReview-Commit-ID: 1vpmhBR8rC6
When set to true, the resulting profile will have a non-null meta.shutdownTime
field which is set to current time.
Non-shutdown profiles also get that field, but it's null for them.
MozReview-Commit-ID: 1vpmhBR8rC6
On Win32, stack frames are now always present, so we can always use
FramePointerStackWalk(). On Win64, stack frames are never present, so we always
use MozStackWalk().
In both cases, we can get stack traces no matter the value of MOZ_PROFILING. So
this patch removes MOZ_PROFILING from the relevant conditions. It also
restructures the conditions and adds some helpful comments.
This also fixes the bug where we would always profile child processes if the
parent process had been launched with MOZ_PROFILER_STARTUP=1, regardless of
whether the profiler was still running in the parent process.
MozReview-Commit-ID: LkIpYmKJOJ1
This is what prenv.h suggests:
When manipulating the environment there is no way to un-set
an environment variable across all platforms. We suggest
you interpret the return of a pointer to null-string to
mean the same as a return of NULL from PR_GetEnv().
I interpret "null-string" to mean "empty string".
MozReview-Commit-ID: 2mfVD1zULXL
If set, MOZ_PROFILER_STARTUP_FEATURES_BITFIELD overrides the value set by
MOZ_PROFILER_STARTUP_FEATURES.
This means that we won't need to go through an intermediate string
representation when propagating profiler settings to a child process through
environment variables.
MozReview-Commit-ID: 49eTVMI21GJ
This patch changes ProfileBuffer arguments from pointers to references. For
functions that modify the ProfileBuffer, it also moves the argument to the end.
When a sample with a label and a dynamic string is written to the
ProfileBuffer, the profiler currently joins them together (up to a max length
of 512, omitting any that exceed this) and then writes a CodeLocation entry
with an empty string followed by a sequence of EmbeddedString entries. When
parsing those entries, we allow a length up to 8192, but that limit is never
reached due to the prior limit of 512.
This patch makes the following changes.
- Removes the joining at write time. Labels and dynamic strings are now written
separately into the ProfileBuffer. The 512 limit still applies, but just for
dynamic strings; dynamic strings longer than that are replaced with "(too
long)". (Labels also always take up one entry, because they only require a
single pointer, because they are always static strings.) The joining is
now done when the ProfileBuffer is parsed, and the max length for the joined
string is still 512; any strings exceeding 512 at that point are truncated,
rather than omitted. (This also happens to be outside the profier's critical
section.)
- Renames CodeLocation as Label and EmbeddedString as DynamicStringFragment.
This makes the ProfileBuffer entry names better match the names used in
GeckoProfiler.h.
- Moves AddDynamicCodeLocation(), now called addDynamicStringEntry(), into
ProfileBuffer.
- Adds some testing of long and overly-long dynamic strings to the GTest.