author Nicholas Nethercote <nnethercote@mozilla.com>
Fri, 20 Jan 2017 15:05:16 +1100
changeset 330598 5267191b229f
parent 287116 070e28f591b6
permissions -rw-r--r--
Bug 1332577 (part 9) - Remove all mozilla_sampler_*() functions. r=mstange.

There are lots of profiler_*() functions that simply call onto equivalent or
nearly-equivalent mozilla_sampler_*() functions. This patch removes the
unnecessary indirection by removing the mozilla_sampler_*() functions.

The most important changes:

- In platform.cpp, all the mozilla_sampler_*() definitions are renamed as

- In GeckoProfiler.h, the new PROFILER_FUNC{,_VOID} macros provide a neat way
to declare the functions that must be present whether the profiler is enabled
or not.

- In GeckoProfiler.h, all the mozilla_sampler_*() declarations are removed, as
are all the profiler_*() definitions that corresponded to a
mozilla_sampler_*() function.

Other things of note:

- profiler_log(const char* str) is now defined in platform.cpp, instead of in
GeckoProfiler.h, for consistency with all the other profiler_*() functions.
Likewise with profiler_js_operation_callback() and

- ProfilerBacktraceDestructor::operator() is treated slightly different to all
the profiler_*() functions.

- Both variants of profiler_tracing() got some early-return conditions moved
into them from GeckoProfiler.h.

- There were some cases where the profiler_*() and mozilla_sampler_*() name
didn't quite match. Specifically:

* mozilla_sampler_get_profile_data() and profiler_get_profiler_jsobject():
name mismatch. Kept the latter.

* mozilla_sampler_get_profile_data_async() and
profiler_get_profile_jsobject_async(): name mismatch. Kept the latter.

* mozilla_sampler_register_thread() and profiler_register_thread(): return
type mismatch. Changed to void.

* mozilla_sampler_frame_number() and profiler_set_frame_number(): name
mismatch. Kept the latter.

* mozilla_sampler_save_profile_to_file() and
profile_sampler_save_profile_to_file(): the former was 'extern "C"' so it
could be called from a debugger easily. The latter now is 'extern "C"'.

- profiler_get_buffer_info() didn't fit the patterns handled by
PROFILER_FUNC{,VOID}, so the patch makes it call onto the new function
profiler_get_buffer_info_helper(), which does fit the pattern.
# .lldbinit file for debugging Mozilla

# -----------------------------------------------------------------------------
# For documentation on all of the commands and type summaries defined here
# and in the accompanying Python scripts, see python/lldbutils/README.txt.
# -----------------------------------------------------------------------------

# Import the module that defines complex Gecko debugging commands.  This assumes
# you are either running lldb from the top level source directory, the objdir,
# or the dist/bin directory.  (.lldbinit files in the objdir and dist/bin set
# topsrcdir appropriately.)
script topsrcdir = topsrcdir if locals().has_key("topsrcdir") else os.getcwd(); sys.path.append(os.path.join(topsrcdir, "python/lldbutils")); import lldbutils; lldbutils.init()

# Mozilla's use of UNIFIED_SOURCES to include multiple source files into a
# single compiled file breaks lldb breakpoint setting. This works around that.
# See http://lldb.llvm.org/troubleshooting.html for more info.
settings set target.inline-breakpoint-strategy always

# Show the dynamic type of an object when using "expr".  This, for example,
# will show a variable declared as "nsIFrame *" that points to an nsBlockFrame
# object as being of type "nsBlockFrame *" rather than "nsIFrame *".
settings set target.prefer-dynamic-value run-target

# Show the string value in atoms.
type summary add nsIAtom --summary-string "${var.mString}"

# Show the value of text nodes.
type summary add nsTextNode --summary-string "${var.mText}"

# Dump the current JS stack.
command alias js expr DumpJSStack()