diff --git a/toolkit/content/license.html b/toolkit/content/license.html index 5059d0390e54..17019c53c429 100644 --- a/toolkit/content/license.html +++ b/toolkit/content/license.html @@ -1,4 +1,4 @@ - + @@ -6789,7 +6789,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This license applies to certain files in the directory
- js/src/vtune
.
js/src/vtune
and tools/profiler/core/vtune
.
Copyright (c) 2011 Intel Corporation. All rights reserved. diff --git a/tools/profiler/core/VTuneProfiler.cpp b/tools/profiler/core/VTuneProfiler.cpp index 1f62424d73c4..d01927ca96d3 100644 --- a/tools/profiler/core/VTuneProfiler.cpp +++ b/tools/profiler/core/VTuneProfiler.cpp @@ -4,6 +4,11 @@ * 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/. */ +#ifdef XP_WIN +#undef UNICODE +#undef _UNICODE +#endif + #include "VTuneProfiler.h" #include "mozilla/Bootstrap.h" #include@@ -18,8 +23,8 @@ VTuneProfiler::Initialize() // This is just a 'dirty trick' to find out if the ittnotify DLL was found. // If it wasn't this function always returns 0, otherwise it returns incrementing // numbers, if the library was found this wastes 2 events but that should be okay. - __itt_event testEvent = __itt_event_createA("Test event", strlen("Test event")); - testEvent = __itt_event_createA("Test event 2", strlen("Test event 2")); + __itt_event testEvent = __itt_event_create("Test event", strlen("Test event")); + testEvent = __itt_event_create("Test event 2", strlen("Test event 2")); if (testEvent) { mInstance = new VTuneProfiler(); @@ -46,7 +51,7 @@ VTuneProfiler::TraceInternal(const char* aName, TracingKind aKind) if (iter != mStrings.end()) { event = iter->second; } else { - event = __itt_event_createA(aName, str.length()); + event = __itt_event_create(aName, str.length()); mStrings.insert({ str, event }); } @@ -66,21 +71,21 @@ VTuneProfiler::RegisterThreadInternal(const char* aName) // Process main thread. switch (XRE_GetProcessType()) { case GeckoProcessType::GeckoProcessType_Default: - __itt_thread_set_nameA("Main Process"); + __itt_thread_set_name("Main Process"); break; case GeckoProcessType::GeckoProcessType_Content: - __itt_thread_set_nameA("Content Process"); + __itt_thread_set_name("Content Process"); break; case GeckoProcessType::GeckoProcessType_GMPlugin: - __itt_thread_set_nameA("Plugin Process"); + __itt_thread_set_name("Plugin Process"); break; case GeckoProcessType::GeckoProcessType_GPU: - __itt_thread_set_nameA("GPU Process"); + __itt_thread_set_name("GPU Process"); break; default: - __itt_thread_set_nameA("Unknown Process"); + __itt_thread_set_name("Unknown Process"); } return; } - __itt_thread_set_nameA(aName); + __itt_thread_set_name(aName); } \ No newline at end of file diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index ac73c1a32d95..129de4f3084a 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -39,6 +39,7 @@ #include "mozilla/UniquePtr.h" #include "mozilla/Vector.h" #include "GeckoProfiler.h" +#include "VTuneProfiler.h" #include "GeckoProfilerReporter.h" #include "ProfilerIOInterposeObserver.h" #include "mozilla/AutoProfilerLabel.h" @@ -2182,6 +2183,8 @@ locked_register_thread(PSLockRef aLock, const char* aName, void* aStackTop) MOZ_RELEASE_ASSERT(!FindLiveThreadInfo(aLock)); + VTUNE_REGISTER_THREAD(aName); + if (!TLSInfo::Init(aLock)) { return; } @@ -2297,6 +2300,8 @@ profiler_init(void* aStackTop) { LOG("profiler_init"); + VTUNE_INIT(); + MOZ_RELEASE_ASSERT(!CorePS::Exists()); if (getenv("MOZ_PROFILER_HELP")) { @@ -2445,6 +2450,8 @@ profiler_shutdown() { LOG("profiler_shutdown"); + VTUNE_SHUTDOWN(); + MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_RELEASE_ASSERT(CorePS::Exists()); @@ -3329,6 +3336,8 @@ profiler_tracing(const char* aCategory, const char* aMarkerName, { MOZ_RELEASE_ASSERT(CorePS::Exists()); + VTUNE_TRACING(aMarkerName, aKind); + // This function is hot enough that we use RacyFeatures, notActivePS. if (!RacyFeatures::IsActiveWithoutPrivacy()) { return; @@ -3344,6 +3353,8 @@ profiler_tracing(const char* aCategory, const char* aMarkerName, { MOZ_RELEASE_ASSERT(CorePS::Exists()); + VTUNE_TRACING(aMarkerName, aKind); + // This function is hot enough that we use RacyFeatures, notActivePS. if (!RacyFeatures::IsActiveWithoutPrivacy()) { return; diff --git a/tools/profiler/moz.build b/tools/profiler/moz.build index 82b0e6b6e5f5..36c0d77facd2 100644 --- a/tools/profiler/moz.build +++ b/tools/profiler/moz.build @@ -121,6 +121,13 @@ EXPORTS += [ 'public/GeckoProfiler.h', ] +if CONFIG['MOZ_VTUNE']: + DEFINES['MOZ_VTUNE_INSTRUMENTATION'] = True + UNIFIED_SOURCES += [ + 'core/VTuneProfiler.cpp', + ] + + if CONFIG['MOZ_TASK_TRACER']: EXPORTS += [ 'tasktracer/GeckoTaskTracer.h',