Bug 761277 - Part 1: Provide the macro definition, fall back to use TLS. r=ehsan
authorBenoit Girard <b56girard@gmail.com>
Fri, 18 Jan 2013 18:47:31 -0500
changeset 119317 c01ed477136cec51992fc6decbfa66bf89da1f76
parent 119316 127e397704f5a4c73773db2b2afaf60e76ccef4d
child 119318 3bf0fc40df43a48e7053e1853c70ed3fef94ec93
push id24195
push userMs2ger@gmail.com
push dateSat, 19 Jan 2013 16:10:11 +0000
treeherdermozilla-central@02e12a80aef9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs761277
milestone21.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 761277 - Part 1: Provide the macro definition, fall back to use TLS. r=ehsan
tools/profiler/sampler.h
tools/profiler/sps_sampler.h
--- a/tools/profiler/sampler.h
+++ b/tools/profiler/sampler.h
@@ -74,15 +74,18 @@
 #define SAMPLE_LABEL(name_space, info)
 // Provide a default literal string to use if profiling is disabled
 // and a printf argument to be computed if profiling is enabled.
 // NOTE: This will store the formated string on the stack and consume
 //       over 128 bytes on the stack.
 #define SAMPLE_LABEL_PRINTF(name_space, info, format, ...)
 #define SAMPLE_LABEL_FN(name_space, info)
 #define SAMPLE_MARKER(info)
+#define SAMPLE_MAIN_THREAD_LABEL_PRINTF(name_space, info, format, ...)
+#define SAMPLE_MAIN_THREAD_LABEL_FN(name_space, info)
+#define SAMPLE_MAIN_THREAD_MARKER(info)
 
 // Tracing features
 #define SAMPLER_PRINT_LOCATION()
 
 #endif
 
 #endif // ifndef SAMPLER_H
--- a/tools/profiler/sps_sampler.h
+++ b/tools/profiler/sps_sampler.h
@@ -3,16 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <stdlib.h>
 #include <signal.h>
 #include <stdarg.h>
 #include "mozilla/ThreadLocal.h"
 #include "nscore.h"
+#include "mozilla/Assertions.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Util.h"
 #include "nsAlgorithm.h"
 #include <algorithm>
 
 
 /* QT has a #define for the word "slots" and jsfriendapi.h has a struct with
  * this variable name, causing compilation problems. Alleviate this for now by
@@ -60,16 +61,19 @@ extern bool stack_key_initialized;
 
 #define SAMPLER_APPEND_LINE_NUMBER_PASTE(id, line) id ## line
 #define SAMPLER_APPEND_LINE_NUMBER_EXPAND(id, line) SAMPLER_APPEND_LINE_NUMBER_PASTE(id, line)
 #define SAMPLER_APPEND_LINE_NUMBER(id) SAMPLER_APPEND_LINE_NUMBER_EXPAND(id, __LINE__)
 
 #define SAMPLE_LABEL(name_space, info) mozilla::SamplerStackFrameRAII SAMPLER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, __LINE__)
 #define SAMPLE_LABEL_PRINTF(name_space, info, ...) mozilla::SamplerStackFramePrintfRAII SAMPLER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, __LINE__, __VA_ARGS__)
 #define SAMPLE_MARKER(info) mozilla_sampler_add_marker(info)
+#define SAMPLE_MAIN_THREAD_LABEL(name_space, info)  MOZ_ASSERT(NS_IsMainThread(), "This can only be called on the main thread"); mozilla::SamplerStackFrameRAII SAMPLER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, __LINE__)
+#define SAMPLE_MAIN_THREAD_LABEL_PRINTF(name_space, info, ...)  MOZ_ASSERT(NS_IsMainThread(), "This can only be called on the main thread"); mozilla::SamplerStackFramePrintfRAII SAMPLER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, __LINE__, __VA_ARGS__)
+#define SAMPLE_MAIN_THREAD_MARKER(info)  MOZ_ASSERT(NS_IsMainThread(), "This can only be called on the main thread"); mozilla_sampler_add_marker(info)
 
 #define SAMPLER_PRINT_LOCATION() mozilla_sampler_print_location()
 
 /* we duplicate this code here to avoid header dependencies
  * which make it more difficult to include in other places */
 #if defined(_M_X64) || defined(__x86_64__)
 #define V8_HOST_ARCH_X64 1
 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)