Bug 1492121 - Added "BASE" to all public macros - r=njn

E.g., AUTO_PROFILER_INIT -> AUTO_BASE_PROFILER_INIT.
This will allow #including BaseProfiler.h anywhere as needed, without clashing
with Gecko Profiler macros.

Differential Revision: https://phabricator.services.mozilla.com/D31929

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gerald Squelart 2019-06-05 23:41:01 +00:00
Родитель bf5eeb02e8
Коммит bdd55c576d
7 изменённых файлов: 238 добавлений и 228 удалений

Просмотреть файл

@ -27,9 +27,9 @@ namespace JS {
name,
#define SUBCATEGORY_ENUMS_END_CATEGORY \
};
PROFILING_CATEGORY_LIST(SUBCATEGORY_ENUMS_BEGIN_CATEGORY,
SUBCATEGORY_ENUMS_SUBCATEGORY,
SUBCATEGORY_ENUMS_END_CATEGORY)
BASE_PROFILING_CATEGORY_LIST(SUBCATEGORY_ENUMS_BEGIN_CATEGORY,
SUBCATEGORY_ENUMS_SUBCATEGORY,
SUBCATEGORY_ENUMS_END_CATEGORY)
#undef SUBCATEGORY_ENUMS_BEGIN_CATEGORY
#undef SUBCATEGORY_ENUMS_SUBCATEGORY
#undef SUBCATEGORY_ENUMS_END_CATEGORY
@ -44,9 +44,9 @@ PROFILING_CATEGORY_LIST(SUBCATEGORY_ENUMS_BEGIN_CATEGORY,
uint32_t(ProfilingSubcategory_##category::name), labelAsString},
#define CATEGORY_INFO_END_CATEGORY
const ProfilingCategoryPairInfo sProfilingCategoryPairInfo[] = {
PROFILING_CATEGORY_LIST(CATEGORY_INFO_BEGIN_CATEGORY,
CATEGORY_INFO_SUBCATEGORY,
CATEGORY_INFO_END_CATEGORY)
BASE_PROFILING_CATEGORY_LIST(CATEGORY_INFO_BEGIN_CATEGORY,
CATEGORY_INFO_SUBCATEGORY,
CATEGORY_INFO_END_CATEGORY)
};
#undef CATEGORY_INFO_BEGIN_CATEGORY
#undef CATEGORY_INFO_SUBCATEGORY

Просмотреть файл

@ -162,7 +162,7 @@ static uint32_t AvailableFeatures() {
ProfilerFeature::Set##Name_(features);
// Add all the possible features.
PROFILER_FOR_EACH_FEATURE(ADD_FEATURE)
BASE_PROFILER_FOR_EACH_FEATURE(ADD_FEATURE)
# undef ADD_FEATURE
@ -593,7 +593,7 @@ class ActivePS {
return ProfilerFeature::Has##Name_(sInstance->mFeatures); \
}
PROFILER_FOR_EACH_FEATURE(PS_GET_FEATURE)
BASE_PROFILER_FOR_EACH_FEATURE(PS_GET_FEATURE)
# undef PS_GET_FEATURE
@ -1504,8 +1504,9 @@ static void StreamCategories(SpliceableJSONWriter& aWriter) {
# define CATEGORY_JSON_SUBCATEGORY(category, name, labelAsString)
# define CATEGORY_JSON_END_CATEGORY aWriter.EndObject();
PROFILING_CATEGORY_LIST(CATEGORY_JSON_BEGIN_CATEGORY,
CATEGORY_JSON_SUBCATEGORY, CATEGORY_JSON_END_CATEGORY)
BASE_PROFILING_CATEGORY_LIST(CATEGORY_JSON_BEGIN_CATEGORY,
CATEGORY_JSON_SUBCATEGORY,
CATEGORY_JSON_END_CATEGORY)
# undef CATEGORY_JSON_BEGIN_CATEGORY
# undef CATEGORY_JSON_SUBCATEGORY
@ -1731,17 +1732,18 @@ static void PrintUsageThenExit(int aExitCode) {
" Features: (x=unavailable, D/d=default/unavailable,\n"
" S/s=MOZ_BASE_PROFILER_STARTUP extra "
"default/unavailable)\n",
unsigned(PROFILER_DEFAULT_ENTRIES),
unsigned(PROFILER_DEFAULT_STARTUP_ENTRIES), sizeof(ProfileBufferEntry),
sizeof(ProfileBufferEntry) * PROFILER_DEFAULT_ENTRIES,
sizeof(ProfileBufferEntry) * PROFILER_DEFAULT_STARTUP_ENTRIES);
unsigned(BASE_PROFILER_DEFAULT_ENTRIES),
unsigned(BASE_PROFILER_DEFAULT_STARTUP_ENTRIES),
sizeof(ProfileBufferEntry),
sizeof(ProfileBufferEntry) * BASE_PROFILER_DEFAULT_ENTRIES,
sizeof(ProfileBufferEntry) * BASE_PROFILER_DEFAULT_STARTUP_ENTRIES);
# define PRINT_FEATURE(n_, str_, Name_, desc_) \
printf(" %c %5u: \"%s\" (%s)\n", \
FeatureCategory(ProfilerFeature::Name_), ProfilerFeature::Name_, \
str_, desc_);
PROFILER_FOR_EACH_FEATURE(PRINT_FEATURE)
BASE_PROFILER_FOR_EACH_FEATURE(PRINT_FEATURE)
# undef PRINT_FEATURE
@ -2067,7 +2069,7 @@ static uint32_t ParseFeature(const char* aFeature, bool aIsStartup) {
return ProfilerFeature::Name_; \
}
PROFILER_FOR_EACH_FEATURE(PARSE_FEATURE_BIT)
BASE_PROFILER_FOR_EACH_FEATURE(PARSE_FEATURE_BIT)
# undef PARSE_FEATURE_BIT
@ -2182,9 +2184,9 @@ void profiler_init(void* aStackTop) {
Vector<const char*> filters;
MOZ_RELEASE_ASSERT(filters.append(kMainThreadName));
uint32_t capacity = PROFILER_DEFAULT_ENTRIES;
uint32_t capacity = BASE_PROFILER_DEFAULT_ENTRIES;
Maybe<double> duration = Nothing();
double interval = PROFILER_DEFAULT_INTERVAL;
double interval = BASE_PROFILER_DEFAULT_INTERVAL;
{
PSAutoLock lock;
@ -2212,7 +2214,7 @@ void profiler_init(void* aStackTop) {
LOG("- MOZ_BASE_PROFILER_STARTUP is set");
// Startup default capacity may be different.
capacity = PROFILER_DEFAULT_STARTUP_ENTRIES;
capacity = BASE_PROFILER_DEFAULT_STARTUP_ENTRIES;
const char* startupCapacity = getenv("MOZ_BASE_PROFILER_STARTUP_ENTRIES");
if (startupCapacity && startupCapacity[0] != '\0') {
@ -2585,7 +2587,7 @@ static void locked_profiler_start(PSLockRef aLock, uint32_t aCapacity,
LOG("- feature = %s", str_); \
}
PROFILER_FOR_EACH_FEATURE(LOG_FEATURE)
BASE_PROFILER_FOR_EACH_FEATURE(LOG_FEATURE)
# undef LOG_FEATURE
@ -2601,13 +2603,13 @@ static void locked_profiler_start(PSLockRef aLock, uint32_t aCapacity,
# endif
// Fall back to the default values if the passed-in values are unreasonable.
uint32_t capacity = aCapacity > 0 ? aCapacity : PROFILER_DEFAULT_ENTRIES;
uint32_t capacity = aCapacity > 0 ? aCapacity : BASE_PROFILER_DEFAULT_ENTRIES;
Maybe<double> duration = aDuration;
if (aDuration && *aDuration <= 0) {
duration = Nothing();
}
double interval = aInterval > 0 ? aInterval : PROFILER_DEFAULT_INTERVAL;
double interval = aInterval > 0 ? aInterval : BASE_PROFILER_DEFAULT_INTERVAL;
ActivePS::Create(aLock, capacity, interval, aFeatures, aFilters, aFilterCount,
duration);

Просмотреть файл

@ -45,36 +45,37 @@
// following macros, which encapsulate the most common operations and thus
// avoid the need for many #ifdefs.
# define AUTO_PROFILER_INIT
# define AUTO_BASE_PROFILER_INIT
# define PROFILER_REGISTER_THREAD(name)
# define PROFILER_UNREGISTER_THREAD()
# define AUTO_PROFILER_REGISTER_THREAD(name)
# define BASE_PROFILER_REGISTER_THREAD(name)
# define BASE_PROFILER_UNREGISTER_THREAD()
# define AUTO_BASE_PROFILER_REGISTER_THREAD(name)
# define AUTO_PROFILER_THREAD_SLEEP
# define AUTO_PROFILER_THREAD_WAKE
# define AUTO_BASE_PROFILER_THREAD_SLEEP
# define AUTO_BASE_PROFILER_THREAD_WAKE
# define AUTO_PROFILER_LABEL(label, categoryPair)
# define AUTO_PROFILER_LABEL_CATEGORY_PAIR(categoryPair)
# define AUTO_PROFILER_LABEL_DYNAMIC_CSTR(label, categoryPair, cStr)
# define AUTO_PROFILER_LABEL_DYNAMIC_STRING(label, categoryPair, str)
# define AUTO_PROFILER_LABEL_FAST(label, categoryPair, ctx)
# define AUTO_PROFILER_LABEL_DYNAMIC_FAST(label, dynamicString, categoryPair, \
ctx, flags)
# define AUTO_BASE_PROFILER_LABEL(label, categoryPair)
# define AUTO_BASE_PROFILER_LABEL_CATEGORY_PAIR(categoryPair)
# define AUTO_BASE_PROFILER_LABEL_DYNAMIC_CSTR(label, categoryPair, cStr)
# define AUTO_BASE_PROFILER_LABEL_DYNAMIC_STRING(label, categoryPair, str)
# define AUTO_BASE_PROFILER_LABEL_FAST(label, categoryPair, ctx)
# define AUTO_BASE_PROFILER_LABEL_DYNAMIC_FAST(label, dynamicString, \
categoryPair, ctx, flags)
# define PROFILER_ADD_MARKER(markerName, categoryPair)
# define BASE_PROFILER_ADD_MARKER(markerName, categoryPair)
# define DECLARE_DOCSHELL_AND_HISTORY_ID(docShell)
# define PROFILER_TRACING(categoryString, markerName, categoryPair, kind)
# define PROFILER_TRACING_DOCSHELL(categoryString, markerName, categoryPair, \
kind, docshell)
# define AUTO_PROFILER_TRACING(categoryString, markerName, categoryPair)
# define AUTO_PROFILER_TRACING_DOCSHELL(categoryString, markerName, \
categoryPair, docShell)
# define AUTO_PROFILER_TEXT_MARKER_CAUSE(markerName, text, categoryPair, cause)
# define AUTO_PROFILER_TEXT_MARKER_DOCSHELL(markerName, text, categoryPair, \
docShell)
# define AUTO_PROFILER_TEXT_MARKER_DOCSHELL_CAUSE( \
# define MOZDECLARE_DOCSHELL_AND_HISTORY_ID(docShell)
# define BASE_PROFILER_TRACING(categoryString, markerName, categoryPair, kind)
# define BASE_PROFILER_TRACING_DOCSHELL(categoryString, markerName, \
categoryPair, kind, docshell)
# define AUTO_BASE_PROFILER_TRACING(categoryString, markerName, categoryPair)
# define AUTO_BASE_PROFILER_TRACING_DOCSHELL(categoryString, markerName, \
categoryPair, docShell)
# define AUTO_BASE_PROFILER_TEXT_MARKER_CAUSE(markerName, text, categoryPair, \
cause)
# define AUTO_BASE_PROFILER_TEXT_MARKER_DOCSHELL(markerName, text, \
categoryPair, docShell)
# define AUTO_BASE_PROFILER_TEXT_MARKER_DOCSHELL_CAUSE( \
markerName, text, categoryPair, docShell, cause)
#else // !MOZ_BASE_PROFILER
@ -104,10 +105,10 @@ template <class T, size_t MinInlineCapacity, class AllocPolicy>
class Vector;
} // namespace mozilla
// Macros used by the AUTO_PROFILER_* macros below.
# define PROFILER_RAII_PASTE(id, line) id##line
# define PROFILER_RAII_EXPAND(id, line) PROFILER_RAII_PASTE(id, line)
# define PROFILER_RAII PROFILER_RAII_EXPAND(raiiObject, __LINE__)
// Macros used by the AUTO_BASE_PROFILER_* macros below.
# define BASE_PROFILER_RAII_PASTE(id, line) id##line
# define BASE_PROFILER_RAII_EXPAND(id, line) BASE_PROFILER_RAII_PASTE(id, line)
# define BASE_PROFILER_RAII BASE_PROFILER_RAII_EXPAND(raiiObject, __LINE__)
//---------------------------------------------------------------------------
// Profiler features
@ -118,7 +119,7 @@ class Vector;
// values are used internally only and so can be changed without consequence.
// Any changes to this list should also be applied to the feature list in
// toolkit/components/extensions/schemas/geckoProfiler.json.
# define PROFILER_FOR_EACH_FEATURE(MACRO) \
# define BASE_PROFILER_FOR_EACH_FEATURE(MACRO) \
MACRO(0, "java", Java, "Profile Java code, Android only") \
\
MACRO(1, "js", JS, \
@ -171,7 +172,7 @@ struct ProfilerFeature {
}
// Define a bitfield constant, a getter, and two setters for each feature.
PROFILER_FOR_EACH_FEATURE(DECLARE)
BASE_PROFILER_FOR_EACH_FEATURE(DECLARE)
# undef DECLARE
};
@ -207,7 +208,7 @@ class RacyFeatures {
# define NO_OVERLAP(n_, str_, Name_, desc_) \
static_assert(ProfilerFeature::Name_ != Active, "bad Active value");
PROFILER_FOR_EACH_FEATURE(NO_OVERLAP);
BASE_PROFILER_FOR_EACH_FEATURE(NO_OVERLAP);
# undef NO_OVERLAP
@ -230,7 +231,7 @@ MFBT_API bool IsThreadBeingProfiled();
// Start and stop the profiler
//---------------------------------------------------------------------------
static constexpr uint32_t PROFILER_DEFAULT_ENTRIES =
static constexpr uint32_t BASE_PROFILER_DEFAULT_ENTRIES =
# if !defined(ARCH_ARMV6)
1u << 20; // 1'048'576
# else
@ -239,15 +240,15 @@ static constexpr uint32_t PROFILER_DEFAULT_ENTRIES =
// Startup profiling usually need to capture more data, especially on slow
// systems.
static constexpr uint32_t PROFILER_DEFAULT_STARTUP_ENTRIES =
static constexpr uint32_t BASE_PROFILER_DEFAULT_STARTUP_ENTRIES =
# if !defined(ARCH_ARMV6)
1u << 22; // 4'194'304
# else
1u << 17; // 131'072
# endif
# define PROFILER_DEFAULT_DURATION 20
# define PROFILER_DEFAULT_INTERVAL 1
# define BASE_PROFILER_DEFAULT_DURATION 20
# define BASE_PROFILER_DEFAULT_INTERVAL 1
// Initialize the profiler. If MOZ_BASE_PROFILER_STARTUP is set the profiler
// will also be started. This call must happen before any other profiler calls
@ -255,7 +256,7 @@ static constexpr uint32_t PROFILER_DEFAULT_STARTUP_ENTRIES =
// already run).
MFBT_API void profiler_init(void* stackTop);
# define AUTO_PROFILER_INIT mozilla::AutoProfilerInit PROFILER_RAII
# define AUTO_BASE_PROFILER_INIT mozilla::AutoProfilerInit BASE_PROFILER_RAII
// Clean up the profiler module, stopping it if required. This function may
// also save a shutdown profile if requested. No profiler calls should happen
@ -303,12 +304,12 @@ MFBT_API void profiler_ensure_started(
// Register/unregister threads with the profiler. Both functions operate the
// same whether the profiler is active or inactive.
# define PROFILER_REGISTER_THREAD(name) \
# define BASE_PROFILER_REGISTER_THREAD(name) \
do { \
char stackTop; \
profiler_register_thread(name, &stackTop); \
} while (0)
# define PROFILER_UNREGISTER_THREAD() profiler_unregister_thread()
# define BASE_PROFILER_UNREGISTER_THREAD() profiler_unregister_thread()
MFBT_API ProfilingStack* profiler_register_thread(const char* name,
void* guessStackTop);
MFBT_API void profiler_unregister_thread();
@ -348,8 +349,8 @@ MFBT_API void profiler_add_sampled_counter(BaseProfilerCount* aCounter);
MFBT_API void profiler_remove_sampled_counter(BaseProfilerCount* aCounter);
// Register and unregister a thread within a scope.
# define AUTO_PROFILER_REGISTER_THREAD(name) \
mozilla::AutoProfilerRegisterThread PROFILER_RAII(name)
# define AUTO_BASE_PROFILER_REGISTER_THREAD(name) \
mozilla::AutoProfilerRegisterThread BASE_PROFILER_RAII(name)
// Pause and resume the profiler. No-ops if the profiler is inactive. While
// paused the profile will not take any samples and will not record any data
@ -368,10 +369,10 @@ MFBT_API void profiler_thread_sleep();
MFBT_API void profiler_thread_wake();
// Mark a thread as asleep/awake within a scope.
# define AUTO_PROFILER_THREAD_SLEEP \
mozilla::AutoProfilerThreadSleep PROFILER_RAII
# define AUTO_PROFILER_THREAD_WAKE \
mozilla::AutoProfilerThreadWake PROFILER_RAII
# define AUTO_BASE_PROFILER_THREAD_SLEEP \
mozilla::AutoProfilerThreadSleep BASE_PROFILER_RAII
# define AUTO_BASE_PROFILER_THREAD_WAKE \
mozilla::AutoProfilerThreadWake BASE_PROFILER_RAII
//---------------------------------------------------------------------------
// Get information from the profiler
@ -514,28 +515,30 @@ MFBT_API mozilla::Maybe<ProfilerBufferInfo> profiler_get_buffer_info();
// name.) If the label applies to only part of a function, you can qualify it
// like this: "ClassName::FunctionName:PartName".
//
// Use AUTO_PROFILER_LABEL_DYNAMIC_* if you want to add additional / dynamic
// information to the label stack frame.
# define AUTO_PROFILER_LABEL(label, categoryPair) \
mozilla::AutoProfilerLabel PROFILER_RAII( \
// Use AUTO_BASE_PROFILER_LABEL_DYNAMIC_* if you want to add additional /
// dynamic information to the label stack frame.
# define AUTO_BASE_PROFILER_LABEL(label, categoryPair) \
mozilla::AutoProfilerLabel BASE_PROFILER_RAII( \
label, nullptr, JS::ProfilingCategoryPair::categoryPair)
// Similar to AUTO_PROFILER_LABEL, but with only one argument: the category
// Similar to AUTO_BASE_PROFILER_LABEL, but with only one argument: the category
// pair. The label string is taken from the category pair. This is convenient
// for labels like AUTO_PROFILER_LABEL_CATEGORY_PAIR(GRAPHICS_LayerBuilding)
// which would otherwise just repeat the string.
# define AUTO_PROFILER_LABEL_CATEGORY_PAIR(categoryPair) \
mozilla::AutoProfilerLabel PROFILER_RAII( \
"", nullptr, JS::ProfilingCategoryPair::categoryPair, \
uint32_t(js::ProfilingStackFrame::Flags:: \
// for labels like
// AUTO_BASE_PROFILER_LABEL_CATEGORY_PAIR(GRAPHICS_LayerBuilding) which would
// otherwise just repeat the string.
# define AUTO_BASE_PROFILER_LABEL_CATEGORY_PAIR(categoryPair) \
mozilla::AutoProfilerLabel BASE_PROFILER_RAII( \
"", nullptr, JS::ProfilingCategoryPair::categoryPair, \
uint32_t(js::ProfilingStackFrame::Flags:: \
LABEL_DETERMINED_BY_CATEGORY_PAIR))
// Similar to AUTO_PROFILER_LABEL, but with an additional string. The inserted
// RAII object stores the cStr pointer in a field; it does not copy the string.
// Similar to AUTO_BASE_PROFILER_LABEL, but with an additional string. The
// inserted RAII object stores the cStr pointer in a field; it does not copy the
// string.
//
// WARNING: This means that the string you pass to this macro needs to live at
// least until the end of the current scope. Be careful using this macro with
// ns[C]String; the other AUTO_PROFILER_LABEL_DYNAMIC_* macros below are
// ns[C]String; the other AUTO_BASE_PROFILER_LABEL_DYNAMIC_* macros below are
// preferred because they avoid this problem.
//
// If the profiler samples the current thread and walks the label stack while
@ -543,49 +546,48 @@ MFBT_API mozilla::Maybe<ProfilerBufferInfo> profiler_get_buffer_info();
// profile buffer. So there's one string copy operation, and it happens at
// sample time.
//
// Compare this to the plain AUTO_PROFILER_LABEL macro, which only accepts
// Compare this to the plain AUTO_BASE_PROFILER_LABEL macro, which only accepts
// literal strings: When the label stack frames generated by
// AUTO_PROFILER_LABEL are sampled, no string copy needs to be made because the
// profile buffer can just store the raw pointers to the literal strings.
// Consequently, AUTO_PROFILER_LABEL frames take up considerably less space in
// the profile buffer than AUTO_PROFILER_LABEL_DYNAMIC_* frames.
# define AUTO_PROFILER_LABEL_DYNAMIC_CSTR(label, categoryPair, cStr) \
mozilla::AutoProfilerLabel PROFILER_RAII( \
// AUTO_BASE_PROFILER_LABEL are sampled, no string copy needs to be made because
// the profile buffer can just store the raw pointers to the literal strings.
// Consequently, AUTO_BASE_PROFILER_LABEL frames take up considerably less space
// in the profile buffer than AUTO_BASE_PROFILER_LABEL_DYNAMIC_* frames.
# define AUTO_BASE_PROFILER_LABEL_DYNAMIC_CSTR(label, categoryPair, cStr) \
mozilla::AutoProfilerLabel BASE_PROFILER_RAII( \
label, cStr, JS::ProfilingCategoryPair::categoryPair)
// Similar to AUTO_PROFILER_LABEL_DYNAMIC_CSTR, but takes an std::string.
// Similar to AUTO_BASE_PROFILER_LABEL_DYNAMIC_CSTR, but takes an std::string.
//
// Note: The use of the Maybe<>s ensures the scopes for the dynamic string and
// the AutoProfilerLabel are appropriate, while also not incurring the runtime
// cost of the string assignment unless the profiler is active. Therefore,
// unlike AUTO_PROFILER_LABEL and AUTO_PROFILER_LABEL_DYNAMIC_CSTR, this macro
// doesn't push/pop a label when the profiler is inactive.
# define AUTO_PROFILER_LABEL_DYNAMIC_STRING(label, categoryPair, str) \
mozilla::Maybe<std::string> autoStr; \
mozilla::Maybe<mozilla::AutoProfilerLabel> raiiObjectString; \
if (profiler_is_active()) { \
autoStr.emplace(str); \
raiiObjectString.emplace(label, autoStr->c_str(), \
JS::ProfilingCategoryPair::categoryPair); \
// unlike AUTO_BASE_PROFILER_LABEL and AUTO_BASE_PROFILER_LABEL_DYNAMIC_CSTR,
// this macro doesn't push/pop a label when the profiler is inactive.
# define AUTO_BASE_PROFILER_LABEL_DYNAMIC_STRING(label, categoryPair, str) \
mozilla::Maybe<std::string> autoStr; \
mozilla::Maybe<mozilla::AutoProfilerLabel> raiiObjectString; \
if (profiler_is_active()) { \
autoStr.emplace(str); \
raiiObjectString.emplace(label, autoStr->c_str(), \
JS::ProfilingCategoryPair::categoryPair); \
}
// Similar to AUTO_PROFILER_LABEL, but accepting a JSContext* parameter, and a
// no-op if the profiler is disabled.
// Used to annotate functions for which overhead in the range of nanoseconds is
// noticeable. It avoids overhead from the TLS lookup because it can get the
// ProfilingStack from the JS context, and avoids almost all overhead in the
// case where the profiler is disabled.
# define AUTO_PROFILER_LABEL_FAST(label, categoryPair, ctx) \
mozilla::AutoProfilerLabel PROFILER_RAII( \
// Similar to AUTO_BASE_PROFILER_LABEL, but accepting a JSContext* parameter,
// and a no-op if the profiler is disabled. Used to annotate functions for which
// overhead in the range of nanoseconds is noticeable. It avoids overhead from
// the TLS lookup because it can get the ProfilingStack from the JS context, and
// avoids almost all overhead in the case where the profiler is disabled.
# define AUTO_BASE_PROFILER_LABEL_FAST(label, categoryPair, ctx) \
mozilla::AutoProfilerLabel BASE_PROFILER_RAII( \
ctx, label, nullptr, JS::ProfilingCategoryPair::categoryPair)
// Similar to AUTO_PROFILER_LABEL_FAST, but also takes an extra string and an
// additional set of flags. The flags parameter should carry values from the
// Similar to AUTO_BASE_PROFILER_LABEL_FAST, but also takes an extra string and
// an additional set of flags. The flags parameter should carry values from the
// js::ProfilingStackFrame::Flags enum.
# define AUTO_PROFILER_LABEL_DYNAMIC_FAST(label, dynamicString, categoryPair, \
ctx, flags) \
mozilla::AutoProfilerLabel PROFILER_RAII( \
ctx, label, dynamicString, JS::ProfilingCategoryPair::categoryPair, \
# define AUTO_BASE_PROFILER_LABEL_DYNAMIC_FAST(label, dynamicString, \
categoryPair, ctx, flags) \
mozilla::AutoProfilerLabel BASE_PROFILER_RAII( \
ctx, label, dynamicString, JS::ProfilingCategoryPair::categoryPair, \
flags)
// Insert a marker in the profile timeline. This is useful to delimit something
@ -596,7 +598,7 @@ MFBT_API mozilla::Maybe<ProfilerBufferInfo> profiler_get_buffer_info();
// certain length of time. A no-op if the profiler is inactive or in privacy
// mode.
# define PROFILER_ADD_MARKER(markerName, categoryPair) \
# define BASE_PROFILER_ADD_MARKER(markerName, categoryPair) \
profiler_add_marker(markerName, JS::ProfilingCategoryPair::categoryPair)
MFBT_API void profiler_add_marker(const char* aMarkerName,
@ -619,7 +621,7 @@ enum TracingKind {
};
// Helper macro to retrieve DocShellId and DocShellHistoryId from docShell
# define DECLARE_DOCSHELL_AND_HISTORY_ID(docShell) \
# define MOZDECLARE_DOCSHELL_AND_HISTORY_ID(docShell) \
mozilla::Maybe<std::string> docShellId; \
mozilla::Maybe<uint32_t> docShellHistoryId; \
if (docShell) { \
@ -639,14 +641,15 @@ enum TracingKind {
// Adds a tracing marker to the profile. A no-op if the profiler is inactive or
// in privacy mode.
# define PROFILER_TRACING(categoryString, markerName, categoryPair, kind) \
profiler_tracing(categoryString, markerName, \
# define BASE_PROFILER_TRACING(categoryString, markerName, categoryPair, \
kind) \
profiler_tracing(categoryString, markerName, \
JS::ProfilingCategoryPair::categoryPair, kind)
# define PROFILER_TRACING_DOCSHELL(categoryString, markerName, categoryPair, \
kind, docShell) \
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
profiler_tracing(categoryString, markerName, \
JS::ProfilingCategoryPair::categoryPair, kind, \
# define BASE_PROFILER_TRACING_DOCSHELL(categoryString, markerName, \
categoryPair, kind, docShell) \
MOZDECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
profiler_tracing(categoryString, markerName, \
JS::ProfilingCategoryPair::categoryPair, kind, \
docShellId, docShellHistoryId)
MFBT_API void profiler_tracing(
@ -662,14 +665,14 @@ MFBT_API void profiler_tracing(
const mozilla::Maybe<uint32_t>& aDocShellHistoryId = mozilla::Nothing());
// Adds a START/END pair of tracing markers.
# define AUTO_PROFILER_TRACING(categoryString, markerName, categoryPair) \
mozilla::AutoProfilerTracing PROFILER_RAII( \
categoryString, markerName, JS::ProfilingCategoryPair::categoryPair, \
# define AUTO_BASE_PROFILER_TRACING(categoryString, markerName, categoryPair) \
mozilla::AutoProfilerTracing BASE_PROFILER_RAII( \
categoryString, markerName, JS::ProfilingCategoryPair::categoryPair, \
mozilla::Nothing(), mozilla::Nothing())
# define AUTO_PROFILER_TRACING_DOCSHELL(categoryString, markerName, \
categoryPair, docShell) \
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
mozilla::AutoProfilerTracing PROFILER_RAII( \
# define AUTO_BASE_PROFILER_TRACING_DOCSHELL(categoryString, markerName, \
categoryPair, docShell) \
MOZDECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
mozilla::AutoProfilerTracing BASE_PROFILER_RAII( \
categoryString, markerName, JS::ProfilingCategoryPair::categoryPair, \
docShellId, docShellHistoryId)
@ -722,23 +725,23 @@ class MOZ_RAII AutoProfilerTextMarker {
const mozilla::Maybe<uint32_t> mDocShellHistoryId;
};
# define AUTO_PROFILER_TEXT_MARKER_CAUSE(markerName, text, categoryPair, \
cause) \
AutoProfilerTextMarker PROFILER_RAII( \
markerName, text, JS::ProfilingCategoryPair::categoryPair, \
# define AUTO_BASE_PROFILER_TEXT_MARKER_CAUSE(markerName, text, categoryPair, \
cause) \
AutoProfilerTextMarker BASE_PROFILER_RAII( \
markerName, text, JS::ProfilingCategoryPair::categoryPair, \
mozilla::Nothing(), mozilla::Nothing(), cause)
# define AUTO_PROFILER_TEXT_MARKER_DOCSHELL(markerName, text, categoryPair, \
docShell) \
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
AutoProfilerTextMarker PROFILER_RAII( \
# define AUTO_BASE_PROFILER_TEXT_MARKER_DOCSHELL(markerName, text, \
categoryPair, docShell) \
MOZDECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
AutoProfilerTextMarker BASE_PROFILER_RAII( \
markerName, text, JS::ProfilingCategoryPair::categoryPair, docShellId, \
docShellHistoryId)
# define AUTO_PROFILER_TEXT_MARKER_DOCSHELL_CAUSE( \
# define AUTO_BASE_PROFILER_TEXT_MARKER_DOCSHELL_CAUSE( \
markerName, text, categoryPair, docShell, cause) \
DECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
AutoProfilerTextMarker PROFILER_RAII( \
MOZDECLARE_DOCSHELL_AND_HISTORY_ID(docShell); \
AutoProfilerTextMarker BASE_PROFILER_RAII( \
markerName, text, JS::ProfilingCategoryPair::categoryPair, docShellId, \
docShellHistoryId, cause)
@ -847,7 +850,8 @@ class MOZ_RAII AutoProfilerThreadWake {
// be used after the ProfilingStack is destroyed.
class MOZ_RAII AutoProfilerLabel {
public:
// This is the AUTO_PROFILER_LABEL and AUTO_PROFILER_LABEL_DYNAMIC variant.
// This is the AUTO_BASE_PROFILER_LABEL and AUTO_BASE_PROFILER_LABEL_DYNAMIC
// variant.
AutoProfilerLabel(const char* aLabel, const char* aDynamicString,
JS::ProfilingCategoryPair aCategoryPair,
uint32_t aFlags = 0 MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {

Просмотреть файл

@ -9,12 +9,13 @@
#ifndef MOZ_BASE_PROFILER
# define PROFILER_DEFINE_COUNT_TOTAL(label, category, description)
# define PROFILER_DEFINE_COUNT(label, category, description)
# define PROFILER_DEFINE_STATIC_COUNT_TOTAL(label, category, description)
# define AUTO_PROFILER_TOTAL(label, count)
# define AUTO_PROFILER_COUNT(label)
# define AUTO_PROFILER_STATIC_COUNT(label, count)
# define BASE_PROFILER_DEFINE_COUNT_TOTAL(label, category, description)
# define BASE_PROFILER_DEFINE_COUNT(label, category, description)
# define BASE_PROFILER_DEFINE_STATIC_COUNT_TOTAL(label, category, description)
# define AUTO_BASE_PROFILER_COUNT_TOTAL(label, count)
# define AUTO_BASE_PROFILER_COUNT(label)
# define AUTO_BASE_PROFILER_STATIC_COUNT(label, count)
# define AUTO_BASE_PROFILER_FORCE_ALLOCATION(label)
#else
@ -189,24 +190,25 @@ class ProfilerCounterTotal final : public BaseProfilerCount {
// independent Atomics, there is a possiblity that count will not include
// the last call, but number of uses will. I think this is not worth
// worrying about
# define PROFILER_DEFINE_COUNT_TOTAL(label, category, description) \
ProfilerAtomicSigned profiler_count_##label(0); \
ProfilerAtomicUnsigned profiler_number_##label(0); \
const char profiler_category_##label[] = category; \
const char profiler_description_##label[] = description; \
# define BASE_PROFILER_DEFINE_COUNT_TOTAL(label, category, description) \
ProfilerAtomicSigned profiler_count_##label(0); \
ProfilerAtomicUnsigned profiler_number_##label(0); \
const char profiler_category_##label[] = category; \
const char profiler_description_##label[] = description; \
mozilla::UniquePtr<BaseProfilerCount> AutoCount_##label;
// This counts, but doesn't keep track of the number of calls to
// AUTO_PROFILER_COUNT()
# define PROFILER_DEFINE_COUNT(label, category, description) \
ProfilerAtomicSigned profiler_count_##label(0); \
const char profiler_category_##label[] = category; \
const char profiler_description_##label[] = description; \
# define BASE_PROFILER_DEFINE_COUNT(label, category, description) \
ProfilerAtomicSigned profiler_count_##label(0); \
const char profiler_category_##label[] = category; \
const char profiler_description_##label[] = description; \
mozilla::UniquePtr<BaseProfilerCount> AutoCount_##label;
// This will create a static initializer if used, but avoids a possible
// allocation.
# define PROFILER_DEFINE_STATIC_COUNT_TOTAL(label, category, description) \
# define BASE_PROFILER_DEFINE_STATIC_COUNT_TOTAL(label, category, \
description) \
ProfilerAtomicSigned profiler_count_##label(0); \
ProfilerAtomicUnsigned profiler_number_##label(0); \
BaseProfilerCount AutoCount_##label(#label, &profiler_count_##label, \
@ -218,7 +220,7 @@ class ProfilerCounterTotal final : public BaseProfilerCount {
// XXX It would be better to do this without the if() and without the
// theoretical race to set the UniquePtr (i.e. possible leak).
# define AUTO_PROFILER_COUNT_TOTAL(label, count) \
# define AUTO_BASE_PROFILER_COUNT_TOTAL(label, count) \
do { \
profiler_number_##label++; /* do this first*/ \
profiler_count_##label += count; \
@ -233,7 +235,7 @@ class ProfilerCounterTotal final : public BaseProfilerCount {
} \
} while (0)
# define AUTO_PROFILER_COUNT(label, count) \
# define AUTO_BASE_PROFILER_COUNT(label, count) \
do { \
profiler_count_##label += count; /* do this first*/ \
if (!AutoCount_##label) { \
@ -247,14 +249,14 @@ class ProfilerCounterTotal final : public BaseProfilerCount {
} \
} while (0)
# define AUTO_PROFILER_STATIC_COUNT(label, count) \
do { \
profiler_number_##label++; /* do this first*/ \
profiler_count_##label += count; \
# define AUTO_BASE_PROFILER_STATIC_COUNT(label, count) \
do { \
profiler_number_##label++; /* do this first*/ \
profiler_count_##label += count; \
} while (0)
// if we need to force the allocation
# define AUTO_PROFILER_FORCE_ALLOCATION(label) \
# define AUTO_BASE_PROFILER_FORCE_ALLOCATION(label) \
do { \
if (!AutoCount_##label) { \
/* Ignore that we could call this twice in theory, and that we leak \

Просмотреть файл

@ -84,7 +84,7 @@ class ProfilerMarkerPayload {
mozilla::Maybe<uint32_t> mDocShellHistoryId;
};
#define DECL_STREAM_PAYLOAD \
#define DECL_BASE_STREAM_PAYLOAD \
virtual void StreamPayload(SpliceableJSONWriter& aWriter, \
const mozilla::TimeStamp& aProcessStartTime, \
UniqueStacks& aUniqueStacks) override;
@ -106,7 +106,7 @@ class TracingMarkerPayload : public ProfilerMarkerPayload {
SetDocShellHistoryId(aDocShellHistoryId);
}
DECL_STREAM_PAYLOAD
DECL_BASE_STREAM_PAYLOAD
private:
const char* mCategory;
@ -128,7 +128,7 @@ class FileIOMarkerPayload : public ProfilerMarkerPayload {
MOZ_ASSERT(aSource);
}
DECL_STREAM_PAYLOAD
DECL_BASE_STREAM_PAYLOAD
private:
const char* mSource;
@ -161,7 +161,7 @@ class UserTimingMarkerPayload : public ProfilerMarkerPayload {
mStartMark(aStartMark),
mEndMark(aEndMark) {}
DECL_STREAM_PAYLOAD
DECL_BASE_STREAM_PAYLOAD
private:
// Either "mark" or "measure".
@ -177,7 +177,7 @@ class HangMarkerPayload : public ProfilerMarkerPayload {
const mozilla::TimeStamp& aEndTime)
: ProfilerMarkerPayload(aStartTime, aEndTime) {}
DECL_STREAM_PAYLOAD
DECL_BASE_STREAM_PAYLOAD
private:
};
@ -187,7 +187,7 @@ class LongTaskMarkerPayload : public ProfilerMarkerPayload {
const mozilla::TimeStamp& aEndTime)
: ProfilerMarkerPayload(aStartTime, aEndTime) {}
DECL_STREAM_PAYLOAD
DECL_BASE_STREAM_PAYLOAD
};
class TextMarkerPayload : public ProfilerMarkerPayload {
@ -219,7 +219,7 @@ class TextMarkerPayload : public ProfilerMarkerPayload {
aDocShellHistoryId, std::move(aCause)),
mText(aText) {}
DECL_STREAM_PAYLOAD
DECL_BASE_STREAM_PAYLOAD
private:
std::string mText;
@ -233,7 +233,7 @@ class LogMarkerPayload : public ProfilerMarkerPayload {
mModule(aModule),
mText(aText) {}
DECL_STREAM_PAYLOAD
DECL_BASE_STREAM_PAYLOAD
private:
std::string mModule; // longest known LazyLogModule name is ~24

Просмотреть файл

@ -21,7 +21,7 @@
// This higher-order macro lists all categories with their subcategories.
//
// PROFILING_CATEGORY_LIST(BEGIN_CATEGORY, SUBCATEGORY, END_CATEGORY)
// BASE_PROFILING_CATEGORY_LIST(BEGIN_CATEGORY, SUBCATEGORY, END_CATEGORY)
// BEGIN_CATEGORY(name, labelAsString, colorAsString)
// SUBCATEGORY(category, name, labelAsString)
// END_CATEGORY
@ -38,46 +38,47 @@
// chosen in such a way that every possible stack can be mapped to a single
// category unambiguously.
#define PROFILING_CATEGORY_LIST(BEGIN_CATEGORY, SUBCATEGORY, END_CATEGORY) \
BEGIN_CATEGORY(IDLE, "Idle", "transparent") \
SUBCATEGORY(IDLE, IDLE, "Other") \
END_CATEGORY \
BEGIN_CATEGORY(OTHER, "Other", "grey") \
SUBCATEGORY(OTHER, OTHER, "Other") \
END_CATEGORY \
BEGIN_CATEGORY(LAYOUT, "Layout", "purple") \
SUBCATEGORY(LAYOUT, LAYOUT, "Other") \
SUBCATEGORY(LAYOUT, LAYOUT_FrameConstruction, "Frame construction") \
SUBCATEGORY(LAYOUT, LAYOUT_Reflow, "Reflow") \
SUBCATEGORY(LAYOUT, LAYOUT_CSSParsing, "CSS parsing") \
SUBCATEGORY(LAYOUT, LAYOUT_SelectorQuery, "Selector query") \
SUBCATEGORY(LAYOUT, LAYOUT_StyleComputation, "Style computation") \
END_CATEGORY \
BEGIN_CATEGORY(JS, "JavaScript", "yellow") \
SUBCATEGORY(JS, JS, "Other") \
SUBCATEGORY(JS, JS_Parsing, "JS Parsing") \
SUBCATEGORY(JS, JS_IonCompilation, "Ion JIT Compilation") \
SUBCATEGORY(JS, JS_BaselineCompilation, "Baseline JIT Compilation") \
END_CATEGORY \
BEGIN_CATEGORY(GCCC, "GC / CC", "orange") \
SUBCATEGORY(GCCC, GCCC, "Other") \
END_CATEGORY \
BEGIN_CATEGORY(NETWORK, "Network", "lightblue") \
SUBCATEGORY(NETWORK, NETWORK, "Other") \
END_CATEGORY \
BEGIN_CATEGORY(GRAPHICS, "Graphics", "green") \
SUBCATEGORY(GRAPHICS, GRAPHICS, "Other") \
#define BASE_PROFILING_CATEGORY_LIST(BEGIN_CATEGORY, SUBCATEGORY, \
END_CATEGORY) \
BEGIN_CATEGORY(IDLE, "Idle", "transparent") \
SUBCATEGORY(IDLE, IDLE, "Other") \
END_CATEGORY \
BEGIN_CATEGORY(OTHER, "Other", "grey") \
SUBCATEGORY(OTHER, OTHER, "Other") \
END_CATEGORY \
BEGIN_CATEGORY(LAYOUT, "Layout", "purple") \
SUBCATEGORY(LAYOUT, LAYOUT, "Other") \
SUBCATEGORY(LAYOUT, LAYOUT_FrameConstruction, "Frame construction") \
SUBCATEGORY(LAYOUT, LAYOUT_Reflow, "Reflow") \
SUBCATEGORY(LAYOUT, LAYOUT_CSSParsing, "CSS parsing") \
SUBCATEGORY(LAYOUT, LAYOUT_SelectorQuery, "Selector query") \
SUBCATEGORY(LAYOUT, LAYOUT_StyleComputation, "Style computation") \
END_CATEGORY \
BEGIN_CATEGORY(JS, "JavaScript", "yellow") \
SUBCATEGORY(JS, JS, "Other") \
SUBCATEGORY(JS, JS_Parsing, "JS Parsing") \
SUBCATEGORY(JS, JS_IonCompilation, "Ion JIT Compilation") \
SUBCATEGORY(JS, JS_BaselineCompilation, "Baseline JIT Compilation") \
END_CATEGORY \
BEGIN_CATEGORY(GCCC, "GC / CC", "orange") \
SUBCATEGORY(GCCC, GCCC, "Other") \
END_CATEGORY \
BEGIN_CATEGORY(NETWORK, "Network", "lightblue") \
SUBCATEGORY(NETWORK, NETWORK, "Other") \
END_CATEGORY \
BEGIN_CATEGORY(GRAPHICS, "Graphics", "green") \
SUBCATEGORY(GRAPHICS, GRAPHICS, "Other") \
SUBCATEGORY(GRAPHICS, GRAPHICS_DisplayListBuilding, "DisplayList building") \
SUBCATEGORY(GRAPHICS, GRAPHICS_DisplayListMerging, "DisplayList merging") \
SUBCATEGORY(GRAPHICS, GRAPHICS_LayerBuilding, "Layer building") \
SUBCATEGORY(GRAPHICS, GRAPHICS_TileAllocation, "Tile allocation") \
SUBCATEGORY(GRAPHICS, GRAPHICS_WRDisplayList, "WebRender display list") \
SUBCATEGORY(GRAPHICS, GRAPHICS_Rasterization, "Rasterization") \
SUBCATEGORY(GRAPHICS, GRAPHICS_DisplayListMerging, "DisplayList merging") \
SUBCATEGORY(GRAPHICS, GRAPHICS_LayerBuilding, "Layer building") \
SUBCATEGORY(GRAPHICS, GRAPHICS_TileAllocation, "Tile allocation") \
SUBCATEGORY(GRAPHICS, GRAPHICS_WRDisplayList, "WebRender display list") \
SUBCATEGORY(GRAPHICS, GRAPHICS_Rasterization, "Rasterization") \
SUBCATEGORY(GRAPHICS, GRAPHICS_FlushingAsyncPaints, "Flushing async paints") \
SUBCATEGORY(GRAPHICS, GRAPHICS_ImageDecoding, "Image decoding") \
END_CATEGORY \
BEGIN_CATEGORY(DOM, "DOM", "blue") \
SUBCATEGORY(DOM, DOM, "Other") \
SUBCATEGORY(GRAPHICS, GRAPHICS_ImageDecoding, "Image decoding") \
END_CATEGORY \
BEGIN_CATEGORY(DOM, "DOM", "blue") \
SUBCATEGORY(DOM, DOM, "Other") \
END_CATEGORY
namespace JS {
@ -90,9 +91,9 @@ namespace JS {
#define CATEGORY_ENUM_SUBCATEGORY(supercategory, name, labelAsString) name,
#define CATEGORY_ENUM_END_CATEGORY
enum class ProfilingCategoryPair : uint32_t {
PROFILING_CATEGORY_LIST(CATEGORY_ENUM_BEGIN_CATEGORY,
CATEGORY_ENUM_SUBCATEGORY,
CATEGORY_ENUM_END_CATEGORY)
BASE_PROFILING_CATEGORY_LIST(CATEGORY_ENUM_BEGIN_CATEGORY,
CATEGORY_ENUM_SUBCATEGORY,
CATEGORY_ENUM_END_CATEGORY)
COUNT,
LAST = COUNT - 1,
};
@ -105,9 +106,9 @@ enum class ProfilingCategoryPair : uint32_t {
#define SUPERCATEGORY_ENUM_SUBCATEGORY(supercategory, name, labelAsString)
#define SUPERCATEGORY_ENUM_END_CATEGORY
enum class ProfilingCategory : uint32_t {
PROFILING_CATEGORY_LIST(SUPERCATEGORY_ENUM_BEGIN_CATEGORY,
SUPERCATEGORY_ENUM_SUBCATEGORY,
SUPERCATEGORY_ENUM_END_CATEGORY)
BASE_PROFILING_CATEGORY_LIST(SUPERCATEGORY_ENUM_BEGIN_CATEGORY,
SUPERCATEGORY_ENUM_SUBCATEGORY,
SUPERCATEGORY_ENUM_END_CATEGORY)
COUNT,
LAST = COUNT - 1,
};

Просмотреть файл

@ -42,7 +42,7 @@ MOZ_NEVER_INLINE unsigned long long Fibonacci(unsigned long long n) {
}
unsigned long long f2 = Fibonacci<NextDepth(DEPTH)>(n - 2);
if (DEPTH == 0) {
PROFILER_ADD_MARKER("Half-way through Fibonacci", OTHER);
BASE_PROFILER_ADD_MARKER("Half-way through Fibonacci", OTHER);
}
unsigned long long f1 = Fibonacci<NextDepth(DEPTH)>(n - 1);
return f2 + f1;
@ -74,7 +74,7 @@ void TestProfiler() {
{
printf("profiler_init()...\n");
AUTO_PROFILER_INIT;
AUTO_BASE_PROFILER_INIT;
MOZ_RELEASE_ASSERT(!profiler_is_active());
MOZ_RELEASE_ASSERT(!profiler_thread_is_being_profiled());
@ -87,26 +87,27 @@ void TestProfiler() {
const uint32_t features = ProfilerFeature::Leaf |
ProfilerFeature::StackWalk |
ProfilerFeature::Threads;
profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL,
features, filters.begin(), filters.length());
profiler_start(BASE_PROFILER_DEFAULT_ENTRIES,
BASE_PROFILER_DEFAULT_INTERVAL, features, filters.begin(),
filters.length());
MOZ_RELEASE_ASSERT(profiler_is_active());
MOZ_RELEASE_ASSERT(profiler_thread_is_being_profiled());
MOZ_RELEASE_ASSERT(!profiler_thread_is_sleeping());
{
AUTO_PROFILER_TEXT_MARKER_CAUSE("fibonacci", "First leaf call", OTHER,
nullptr);
AUTO_BASE_PROFILER_TEXT_MARKER_CAUSE("fibonacci", "First leaf call",
OTHER, nullptr);
static const unsigned long long fibStart = 40;
printf("Fibonacci(%llu)...\n", fibStart);
AUTO_PROFILER_LABEL("Label around Fibonacci", OTHER);
AUTO_BASE_PROFILER_LABEL("Label around Fibonacci", OTHER);
unsigned long long f = Fibonacci(fibStart);
printf("Fibonacci(%llu) = %llu\n", fibStart, f);
}
printf("Sleep 1s...\n");
{
AUTO_PROFILER_THREAD_SLEEP;
AUTO_BASE_PROFILER_THREAD_SLEEP;
SleepMilli(1000);
}
@ -133,14 +134,14 @@ void TestProfiler() {
void TestProfiler() {
// These don't need to make sense, we just want to know that they're defined
// and don't do anything.
AUTO_PROFILER_INIT;
AUTO_BASE_PROFILER_INIT;
// This wouldn't build if the macro did output its arguments.
AUTO_PROFILER_TEXT_MARKER_CAUSE(catch, catch, catch, catch);
AUTO_BASE_PROFILER_TEXT_MARKER_CAUSE(catch, catch, catch, catch);
AUTO_PROFILER_LABEL(catch, catch);
AUTO_BASE_PROFILER_LABEL(catch, catch);
AUTO_PROFILER_THREAD_SLEEP;
AUTO_BASE_PROFILER_THREAD_SLEEP;
}
#endif // MOZ_BASE_PROFILER else