mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
dd07e2a56b
This patch performs a refactoring to the internals of the profiler in order to expose a function, profiler_suspend_and_sample_thread, which can be called from a background thread to suspend, sample the native stack, and then resume the target passed-in thread. The interface was designed to expose as few internals of the profiler as possible, exposing only a single callback which accepts the list of program counters and stack pointers collected during the backtrace. A method `profiler_current_thread_id` was also added to get the thread_id of the current thread, which can then be passed by another thread into profiler_suspend_sample_thread to sample the stack of that thread. This is implemented in two parts: 1) Splitting SamplerThread into two classes: Sampler, and SamplerThread. Sampler was created to extract the core logic from SamplerThread which manages unix signals on android and linux, as well as suspends the target thread on all platforms. SamplerThread was then modified to subclass this type, adding the extra methods and fields required for the creation and management of the actual Sampler Thread. Some work was done to ensure that the methods on Sampler would not require ActivePS to be present, as we intend to sample threads when the profiler is not active for the Background Hang Reporter. 2) Moving the Tick() logic into the TickController interface. A TickController interface was added to platform which has 2 methods: Tick and Backtrace. The Tick method replaces the previous Tick() static method, allowing it to be overridden by a different consumer of SuspendAndSampleAndResumeThread, while the Backtrace() method replaces the previous MergeStacksIntoProfile method, allowing it to be overridden by different consumers of DoNativeBacktrace. This interface object is then used to wrap implementation specific data, such as the ProfilerBuffer, and is threaded through the SuspendAndSampleAndResumeThread and DoNativeBacktrace methods. This change added 2 virtual calls to the SamplerThread's critical section, which I believe should be a small enough overhead that it will not affect profiling performance. These virtual calls could be avoided using templating, but I decided that doing so would be unnecessary. MozReview-Commit-ID: AT48xb2asgV |
||
---|---|---|
.cargo | ||
.vscode | ||
accessible | ||
addon-sdk | ||
browser | ||
build | ||
caps | ||
chrome | ||
config | ||
db | ||
devtools | ||
docshell | ||
dom | ||
editor | ||
embedding | ||
extensions | ||
gfx | ||
gradle/wrapper | ||
hal | ||
image | ||
intl | ||
ipc | ||
js | ||
layout | ||
media | ||
memory | ||
mfbt | ||
mobile | ||
modules | ||
mozglue | ||
netwerk | ||
nsprpub | ||
other-licenses | ||
parser | ||
probes | ||
python | ||
rdf | ||
security | ||
services | ||
servo | ||
startupcache | ||
storage | ||
taskcluster | ||
testing | ||
third_party | ||
toolkit | ||
tools | ||
uriloader | ||
view | ||
widget | ||
xpcom | ||
xpfe | ||
.clang-format | ||
.clang-format-ignore | ||
.clang-tidy | ||
.cron.yml | ||
.eslintignore | ||
.eslintrc.js | ||
.flake8 | ||
.gdbinit | ||
.gdbinit_python | ||
.gitignore | ||
.hgignore | ||
.hgtags | ||
.inferconfig | ||
.lldbinit | ||
.taskcluster.yml | ||
.ycm_extra_conf.py | ||
aclocal.m4 | ||
Android.mk | ||
AUTHORS | ||
build.gradle | ||
client.mk | ||
client.py | ||
CLOBBER | ||
configure.in | ||
configure.py | ||
GNUmakefile | ||
gradle.properties | ||
gradlew | ||
LEGAL | ||
LICENSE | ||
mach | ||
Makefile.in | ||
moz.build | ||
moz.configure | ||
mozilla-config.h.in | ||
npm-shrinkwrap.json | ||
old-configure.in | ||
package.json | ||
README.txt | ||
settings.gradle | ||
test.mozbuild |
An explanation of the Mozilla Source Code Directory Structure and links to project pages with documentation can be found at: https://developer.mozilla.org/en/Mozilla_Source_Code_Directory_Structure For information on how to build Mozilla from the source code, see: https://developer.mozilla.org/en/docs/Build_Documentation To have your bug fix / feature added to Mozilla, you should create a patch and submit it to Bugzilla (https://bugzilla.mozilla.org). Instructions are at: https://developer.mozilla.org/en/docs/Creating_a_patch https://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree If you have a question about developing Mozilla, and can't find the solution on https://developer.mozilla.org, you can try asking your question in a mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups are accessible on Google Groups, or news.mozilla.org with a NNTP reader.] You can download nightly development builds from the Mozilla FTP server. Keep in mind that nightly builds, which are used by Mozilla developers for testing, may be buggy. Firefox nightlies, for example, can be found at: https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/ - or - https://nightly.mozilla.org/