1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 if CONFIG["MOZ_GECKO_PROFILER"]:
8 DEFINES["MOZ_REPLACE_MALLOC_PREFIX"] = "profiler"
9 XPIDL_MODULE = "profiler"
11 "gecko/nsIProfiler.idl",
14 "public/GeckoProfilerReporter.h",
15 "public/ProfilerChild.h",
16 "public/ProfilerCodeAddressService.h",
19 "core/PageInformation.cpp",
21 "core/ProfileBuffer.cpp",
22 "core/ProfileBufferEntry.cpp",
23 "core/ProfiledThreadData.cpp",
24 "core/ProfilerBacktrace.cpp",
25 "core/ProfilerCodeAddressService.cpp",
26 "core/ProfilerMarkers.cpp",
27 "gecko/ChildProfilerController.cpp",
28 "gecko/nsProfilerStartParams.cpp",
29 "gecko/ProfilerChild.cpp",
30 "gecko/ProfilerIOInterposeObserver.cpp",
32 if CONFIG["MOZ_REPLACE_MALLOC"] and CONFIG["MOZ_PROFILER_MEMORY"]:
34 "core/memory_hooks.cpp", # Non-unified because of order of #includes
38 "gecko/components.conf",
41 if CONFIG["OS_TARGET"] == "Darwin":
42 # This file cannot be built in unified mode because it includes
43 # "nsLocalFile.h", which pulls in a system header which uses a type
44 # called TextRange, which conflicts with mozilla::TextRange due to
45 # a "using namespace mozilla;" declaration from a different file.
47 "gecko/nsProfiler.cpp",
51 "gecko/nsProfiler.cpp",
54 if CONFIG["OS_TARGET"] in ("Android", "Linux"):
56 "core/ProfilerCPUFreq-linux-android.cpp",
58 if CONFIG["OS_TARGET"] in ("Android", "Linux", "FreeBSD"):
59 if CONFIG["TARGET_CPU"] in ("arm", "aarch64", "x86", "x86_64", "mips64"):
61 "lul/AutoObjectMapper.cpp",
64 "lul/LulDwarfSummariser.cpp",
67 "lul/platform-linux-lul.cpp",
69 # These files cannot be built in unified mode because of name clashes with mozglue headers on Android.
71 "core/shared-libraries-linux.cc",
73 if not CONFIG["MOZ_CRASHREPORTER"]:
75 "/toolkit/crashreporter/google-breakpad/src/common/linux/elfutils.cc",
76 "/toolkit/crashreporter/google-breakpad/src/common/linux/file_id.cc",
77 "/toolkit/crashreporter/google-breakpad/src/common/linux/linux_libc_support.cc",
78 "/toolkit/crashreporter/google-breakpad/src/common/linux/memory_mapped_file.cc",
80 if not CONFIG["HAVE_GETCONTEXT"]:
82 "/toolkit/crashreporter/google-breakpad/src/common/linux/breakpad_getcontext.S"
84 if CONFIG["TARGET_CPU"] == "x86_64" and CONFIG["OS_TARGET"] == "Linux":
86 "core/PowerCounters-linux.cpp",
88 elif CONFIG["TARGET_CPU"] == "aarch64" and CONFIG["OS_TARGET"] == "Android":
90 "core/PowerCounters-android.cpp",
92 if CONFIG["TARGET_CPU"] == "arm" and CONFIG["OS_TARGET"] != "FreeBSD":
94 "core/EHABIStackWalk.cpp",
96 elif CONFIG["OS_TARGET"] == "Darwin":
98 "core/shared-libraries-macos.cc",
100 if CONFIG["TARGET_CPU"] == "aarch64":
102 "core/PowerCounters-mac-arm64.cpp",
104 if CONFIG["TARGET_CPU"] == "x86_64":
106 "core/PowerCounters-mac-amd64.cpp",
108 elif CONFIG["OS_TARGET"] == "WINNT":
109 if CONFIG["CC_TYPE"] == "clang-cl":
111 "core/PowerCounters-win.cpp",
117 "core/ProfilerCPUFreq-win.cpp",
118 "core/shared-libraries-win32.cc",
127 "/netwerk/protocol/http",
128 "/toolkit/components/jsoncpp/include",
129 "/toolkit/crashreporter/google-breakpad/src",
130 "/tools/profiler/core/",
131 "/tools/profiler/gecko/",
135 if CONFIG["OS_TARGET"] == "Android":
136 DEFINES["ANDROID_NDK_MAJOR_VERSION"] = CONFIG["ANDROID_NDK_MAJOR_VERSION"]
137 DEFINES["ANDROID_NDK_MINOR_VERSION"] = CONFIG["ANDROID_NDK_MINOR_VERSION"]
139 # We need access to Breakpad's getcontext(3) which is suitable for Android
140 "/toolkit/crashreporter/google-breakpad/src/common/android/include",
143 if CONFIG["MOZ_VTUNE"]:
144 DEFINES["MOZ_VTUNE_INSTRUMENTATION"] = True
146 "core/VTuneProfiler.cpp",
149 XPCSHELL_TESTS_MANIFESTS += ["tests/xpcshell/xpcshell.toml"]
150 MOCHITEST_CHROME_MANIFESTS += ["tests/chrome/chrome.toml"]
151 BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.toml"]
154 "core/MicroGeckoProfiler.cpp",
155 "core/ProfileAdditionalInformation.cpp",
156 "core/ProfilerBindings.cpp",
157 "core/ProfilerThreadRegistration.cpp",
158 "core/ProfilerThreadRegistrationData.cpp",
159 "core/ProfilerThreadRegistry.cpp",
160 "core/ProfilerUtils.cpp",
161 "gecko/ProfilerParent.cpp",
165 "gecko/PProfiler.ipdl",
166 "gecko/ProfilerTypes.ipdlh",
169 include("/ipc/chromium/chromium-config.mozbuild")
172 "public/ChildProfilerController.h",
174 "public/GeckoProfiler.h",
175 "public/MicroGeckoProfiler.h",
176 "public/ProfileAdditionalInformation.h",
177 "public/ProfilerBindings.h",
178 "public/ProfilerControl.h",
179 "public/ProfilerNativeStack.h",
180 "public/ProfilerParent.h",
181 "public/ProfilerRustBindings.h",
182 "public/ProfilerStackWalk.h",
183 "public/shared-libraries.h",
187 "public/ProfileBufferEntrySerializationGeckoExtensions.h",
188 "public/ProfileJSONWriter.h",
189 "public/ProfilerBandwidthCounter.h",
190 "public/ProfilerCounts.h",
191 "public/ProfilerLabels.h",
192 "public/ProfilerMarkers.h",
193 "public/ProfilerMarkersDetail.h",
194 "public/ProfilerMarkersPrerequisites.h",
195 "public/ProfilerMarkerTypes.h",
196 "public/ProfilerRunnable.h",
197 "public/ProfilerState.h",
198 "public/ProfilerThreadPlatformData.h",
199 "public/ProfilerThreadRegistration.h",
200 "public/ProfilerThreadRegistrationData.h",
201 "public/ProfilerThreadRegistrationInfo.h",
202 "public/ProfilerThreadRegistry.h",
203 "public/ProfilerThreadSleep.h",
204 "public/ProfilerThreadState.h",
205 "public/ProfilerUtils.h",
209 "rust-api/src/gecko_bindings/profiling_categories.rs",
210 script="../../mozglue/baseprofiler/build/generate_profiling_categories.py",
211 entry_point="generate_rust_enums",
212 inputs=["../../mozglue/baseprofiler/build/profiling_categories.yaml"],
215 CONFIGURE_SUBST_FILES += [
216 "rust-api/extra-bindgen-flags",
220 if CONFIG["COMPILE_ENVIRONMENT"]:
221 CbindgenHeader("profiler_ffi_generated.h", inputs=["rust-api"])
224 "!profiler_ffi_generated.h",
231 FINAL_LIBRARY = "xul"
233 if CONFIG["ENABLE_TESTS"]:
234 DIRS += ["tests/gtest"]
236 if CONFIG["CC_TYPE"] in ("clang", "gcc"):
238 "-Wno-error=stack-protector",
239 "-Wno-ignored-qualifiers", # due to use of breakpad headers
243 BUG_COMPONENT = ("Core", "Gecko Profiler")