Bug 1362598 - Always define ProfilerFeature as there's no stub. r?mstange draft
authorJan Beich <jbeich@FreeBSD.org>
Fri, 05 May 2017 23:29:58 +0000
changeset 573570 adf7d8fa4171e84a3e90354d84ad2dc6c3d37442
parent 573556 37a5b7f6f101df2eb292b1b6baaf1540c9920e20
child 627339 1bc8a057164216451610875c0908d790470d75f1
push id57434
push userbmo:jbeich@FreeBSD.org
push dateFri, 05 May 2017 23:47:04 +0000
reviewersmstange
bugs1362598
milestone55.0a1
Bug 1362598 - Always define ProfilerFeature as there's no stub. r?mstange MozReview-Commit-ID: Bsj6dFwF1h0
tools/profiler/public/GeckoProfiler.h
--- a/tools/profiler/public/GeckoProfiler.h
+++ b/tools/profiler/public/GeckoProfiler.h
@@ -105,16 +105,53 @@ using UniqueProfilerBacktrace =
 #define PROFILER_MARKER(info) do {} while (0)
 #define PROFILER_MARKER_PAYLOAD(info, payload) \
   do { \
     mozilla::UniquePtr<ProfilerMarkerPayload> payloadDeletor(payload); \
   } while (0)
 
 #else   // defined(MOZ_GECKO_PROFILER)
 
+#if defined(__GNUC__) || defined(_MSC_VER)
+# define PROFILER_FUNCTION_NAME __FUNCTION__
+#else
+  // From C99, supported by some C++ compilers. Just the raw function name.
+# define PROFILER_FUNCTION_NAME __func__
+#endif
+
+#define PROFILER_FUNC(decl, rv)  decl;
+#define PROFILER_FUNC_VOID(decl) void decl;
+
+// we want the class and function name but can't easily get that using preprocessor macros
+// __func__ doesn't have the class name and __PRETTY_FUNCTION__ has the parameters
+
+#define PROFILER_LABEL(name_space, info, category) \
+  PROFILER_PLATFORM_TRACING(name_space "::" info) \
+  mozilla::SamplerStackFrameRAII \
+  PROFILER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, category, \
+                                            __LINE__)
+
+#define PROFILER_LABEL_FUNC(category) \
+  PROFILER_PLATFORM_TRACING(PROFILER_FUNCTION_NAME) \
+  mozilla::SamplerStackFrameRAII \
+  PROFILER_APPEND_LINE_NUMBER(sampler_raii)(PROFILER_FUNCTION_NAME, category, \
+                                            __LINE__)
+
+#define PROFILER_LABEL_DYNAMIC(name_space, info, category, str) \
+  PROFILER_PLATFORM_TRACING(name_space "::" info) \
+  mozilla::SamplerStackFrameDynamicRAII \
+  PROFILER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, category, \
+                                            __LINE__, str)
+
+#define PROFILER_MARKER(info) profiler_add_marker(info)
+#define PROFILER_MARKER_PAYLOAD(info, payload) \
+  profiler_add_marker(info, payload)
+
+#endif  // defined(MOZ_GECKO_PROFILER)
+
 // Higher-order macro containing all the feature info in one place. Define
 // |macro| appropriately to extract the relevant parts. Note that the number
 // values are used internally only and so can be changed without consequence.
 #define PROFILER_FOR_EACH_FEATURE(macro) \
   /* Dump the display list with the textures. */ \
   macro(0, "displaylistdump", DisplayListDump) \
   \
   /* GPU Profiling (may not be supported by the GL). */ \
@@ -163,53 +200,16 @@ struct ProfilerFeature
     static void Clear##Name_(uint32_t& aFeatures) { aFeatures &= ~Name_; }
 
   // Define a bitfield constant, a getter, and two setters for each feature.
   PROFILER_FOR_EACH_FEATURE(DECLARE)
 
   #undef DECLARE
 };
 
-#if defined(__GNUC__) || defined(_MSC_VER)
-# define PROFILER_FUNCTION_NAME __FUNCTION__
-#else
-  // From C99, supported by some C++ compilers. Just the raw function name.
-# define PROFILER_FUNCTION_NAME __func__
-#endif
-
-#define PROFILER_FUNC(decl, rv)  decl;
-#define PROFILER_FUNC_VOID(decl) void decl;
-
-// we want the class and function name but can't easily get that using preprocessor macros
-// __func__ doesn't have the class name and __PRETTY_FUNCTION__ has the parameters
-
-#define PROFILER_LABEL(name_space, info, category) \
-  PROFILER_PLATFORM_TRACING(name_space "::" info) \
-  mozilla::SamplerStackFrameRAII \
-  PROFILER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, category, \
-                                            __LINE__)
-
-#define PROFILER_LABEL_FUNC(category) \
-  PROFILER_PLATFORM_TRACING(PROFILER_FUNCTION_NAME) \
-  mozilla::SamplerStackFrameRAII \
-  PROFILER_APPEND_LINE_NUMBER(sampler_raii)(PROFILER_FUNCTION_NAME, category, \
-                                            __LINE__)
-
-#define PROFILER_LABEL_DYNAMIC(name_space, info, category, str) \
-  PROFILER_PLATFORM_TRACING(name_space "::" info) \
-  mozilla::SamplerStackFrameDynamicRAII \
-  PROFILER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, category, \
-                                            __LINE__, str)
-
-#define PROFILER_MARKER(info) profiler_add_marker(info)
-#define PROFILER_MARKER_PAYLOAD(info, payload) \
-  profiler_add_marker(info, payload)
-
-#endif  // defined(MOZ_GECKO_PROFILER)
-
 // These functions are defined whether the profiler is enabled or not.
 
 // Adds a tracing marker to the PseudoStack. A no-op if the profiler is
 // inactive or in privacy mode.
 PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, const char* aInfo,
                                     TracingKind aKind = TRACING_EVENT))
 PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, const char* aInfo,
                                     UniqueProfilerBacktrace aCause,