Bug 1332577 (part 6) - Move some function definitions in GeckoProfiler.h. r=mstange.
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 20 Jan 2017 14:29:20 +1100
changeset 375515 6f893e5c9e874300e4bc5523e821e8b3948bb80d
parent 375514 03d2b4964c1604f1331733f79b78ef532afc452d
child 375516 1e467949bdad0839aca0ec6b51a6d1b8f8e25226
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1332577
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1332577 (part 6) - Move some function definitions in GeckoProfiler.h. r=mstange. This patch moves the definitions of profiler_call_{entry,exit}() up so that forward declarations aren't necessary. It also removes an unnecessary second declaration of mozilla_sampler_add_marker().
tools/profiler/public/GeckoProfiler.h
--- a/tools/profiler/public/GeckoProfiler.h
+++ b/tools/profiler/public/GeckoProfiler.h
@@ -286,23 +286,55 @@ extern bool stack_key_initialized;
 #  define SAMPLE_FUNCTION_NAME __FUNCTION__
 # else
 #  define SAMPLE_FUNCTION_NAME __func__  // defined in C99, supported in various C++ compilers. Just raw function name.
 # endif
 #endif
 
 // Returns a handle to pass on exit. This can check that we are popping the
 // correct callstack.
-inline void* mozilla_sampler_call_enter(const char *aInfo, js::ProfileEntry::Category aCategory,
-                                        void *aFrameAddress = nullptr, bool aCopy = false,
-                                        uint32_t line = 0);
+inline void*
+mozilla_sampler_call_enter(const char *aInfo,
+                           js::ProfileEntry::Category aCategory,
+                           void *aFrameAddress, bool aCopy, uint32_t line)
+{
+  // check if we've been initialized to avoid calling pthread_getspecific
+  // with a null tlsStack which will return undefined results.
+  if (!stack_key_initialized)
+    return nullptr;
+
+  PseudoStack *stack = tlsPseudoStack.get();
+  // we can't infer whether 'stack' has been initialized
+  // based on the value of stack_key_intiailized because
+  // 'stack' is only intialized when a thread is being
+  // profiled.
+  if (!stack) {
+    return stack;
+  }
+  stack->push(aInfo, aCategory, aFrameAddress, aCopy, line);
 
-inline void mozilla_sampler_call_exit(void* handle);
+  // The handle is meant to support future changes
+  // but for now it is simply use to save a call to
+  // pthread_getspecific on exit. It also supports the
+  // case where the sampler is initialized between
+  // enter and exit.
+  return stack;
+}
 
-void mozilla_sampler_add_marker(const char *aInfo,
+inline void
+mozilla_sampler_call_exit(void *aHandle)
+{
+  if (!aHandle)
+    return;
+
+  PseudoStack *stack = (PseudoStack*)aHandle;
+  stack->popAndMaybeDelete();
+}
+
+void mozilla_sampler_add_marker(const char *aMarker,
                                 ProfilerMarkerPayload *aPayload = nullptr);
 
 void mozilla_sampler_start(int aEntries, double aInterval,
                            const char** aFeatures, uint32_t aFeatureCount,
                            const char** aThreadNameFilters, uint32_t aFilterCount);
 
 void mozilla_sampler_stop();
 
@@ -757,53 +789,16 @@ private:
 
 inline PseudoStack* mozilla_get_pseudo_stack(void)
 {
   if (!stack_key_initialized)
     return nullptr;
   return tlsPseudoStack.get();
 }
 
-inline void* mozilla_sampler_call_enter(const char *aInfo,
-  js::ProfileEntry::Category aCategory, void *aFrameAddress, bool aCopy, uint32_t line)
-{
-  // check if we've been initialized to avoid calling pthread_getspecific
-  // with a null tlsStack which will return undefined results.
-  if (!stack_key_initialized)
-    return nullptr;
-
-  PseudoStack *stack = tlsPseudoStack.get();
-  // we can't infer whether 'stack' has been initialized
-  // based on the value of stack_key_intiailized because
-  // 'stack' is only intialized when a thread is being
-  // profiled.
-  if (!stack) {
-    return stack;
-  }
-  stack->push(aInfo, aCategory, aFrameAddress, aCopy, line);
-
-  // The handle is meant to support future changes
-  // but for now it is simply use to save a call to
-  // pthread_getspecific on exit. It also supports the
-  // case where the sampler is initialized between
-  // enter and exit.
-  return stack;
-}
-
-inline void mozilla_sampler_call_exit(void *aHandle)
-{
-  if (!aHandle)
-    return;
-
-  PseudoStack *stack = (PseudoStack*)aHandle;
-  stack->popAndMaybeDelete();
-}
-
-void mozilla_sampler_add_marker(const char *aMarker, ProfilerMarkerPayload *aPayload);
-
 static inline
 void profiler_log(const char *str)
 {
   profiler_tracing("log", str, TRACING_EVENT);
 }
 
 static inline
 void profiler_log(const char *fmt, va_list args)