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",
17 "public/shared-libraries.h",
20 "core/PageInformation.cpp",
22 "core/ProfileBuffer.cpp",
23 "core/ProfileBufferEntry.cpp",
24 "core/ProfiledThreadData.cpp",
25 "core/ProfilerBacktrace.cpp",
26 "core/ProfilerCodeAddressService.cpp",
27 "core/ProfilerMarkers.cpp",
28 "gecko/ChildProfilerController.cpp",
29 "gecko/nsProfilerStartParams.cpp",
30 "gecko/ProfilerChild.cpp",
31 "gecko/ProfilerIOInterposeObserver.cpp",
33 if CONFIG["MOZ_REPLACE_MALLOC"] and CONFIG["MOZ_PROFILER_MEMORY"]:
35 "core/memory_hooks.cpp", # Non-unified because of order of #includes
39 "gecko/components.conf",
42 if CONFIG["OS_TARGET"] == "Darwin":
43 # This file cannot be built in unified mode because it includes
44 # "nsLocalFile.h", which pulls in a system header which uses a type
45 # called TextRange, which conflicts with mozilla::TextRange due to
46 # a "using namespace mozilla;" declaration from a different file.
48 "gecko/nsProfiler.cpp",
52 "gecko/nsProfiler.cpp",
55 if CONFIG["OS_TARGET"] in ("Android", "Linux"):
57 "core/ProfilerCPUFreq-linux-android.cpp",
59 if CONFIG["OS_TARGET"] in ("Android", "Linux", "FreeBSD"):
60 if CONFIG["CPU_ARCH"] in ("arm", "aarch64", "x86", "x86_64", "mips64"):
62 "lul/AutoObjectMapper.cpp",
65 "lul/LulDwarfSummariser.cpp",
68 "lul/platform-linux-lul.cpp",
70 # These files cannot be built in unified mode because of name clashes with mozglue headers on Android.
72 "core/shared-libraries-linux.cc",
74 if not CONFIG["MOZ_CRASHREPORTER"]:
76 "/toolkit/crashreporter/google-breakpad/src/common/linux/elfutils.cc",
77 "/toolkit/crashreporter/google-breakpad/src/common/linux/file_id.cc",
78 "/toolkit/crashreporter/google-breakpad/src/common/linux/linux_libc_support.cc",
79 "/toolkit/crashreporter/google-breakpad/src/common/linux/memory_mapped_file.cc",
81 if not CONFIG["HAVE_GETCONTEXT"]:
83 "/toolkit/crashreporter/google-breakpad/src/common/linux/breakpad_getcontext.S"
85 if CONFIG["CPU_ARCH"] == "x86_64" and CONFIG["OS_TARGET"] == "Linux":
87 "core/PowerCounters-linux.cpp",
89 if CONFIG["CPU_ARCH"] == "arm" and CONFIG["OS_TARGET"] != "FreeBSD":
91 "core/EHABIStackWalk.cpp",
93 elif CONFIG["OS_TARGET"] == "Darwin":
95 "core/shared-libraries-macos.cc",
97 if CONFIG["CPU_ARCH"] == "aarch64":
99 "core/PowerCounters-mac-arm64.cpp",
101 if CONFIG["CPU_ARCH"] == "x86_64":
103 "core/PowerCounters-mac-amd64.cpp",
105 elif CONFIG["OS_TARGET"] == "WINNT":
106 if CONFIG["CC_TYPE"] == "clang-cl":
108 "core/PowerCounters-win.cpp",
111 "core/ProfilerCPUFreq-win.cpp",
112 "core/shared-libraries-win32.cc",
121 "/netwerk/protocol/http",
122 "/toolkit/components/jsoncpp/include",
123 "/toolkit/crashreporter/google-breakpad/src",
124 "/tools/profiler/core/",
125 "/tools/profiler/gecko/",
129 if CONFIG["OS_TARGET"] == "Android":
130 DEFINES["ANDROID_NDK_MAJOR_VERSION"] = CONFIG["ANDROID_NDK_MAJOR_VERSION"]
131 DEFINES["ANDROID_NDK_MINOR_VERSION"] = CONFIG["ANDROID_NDK_MINOR_VERSION"]
133 # We need access to Breakpad's getcontext(3) which is suitable for Android
134 "/toolkit/crashreporter/google-breakpad/src/common/android/include",
137 if CONFIG["MOZ_VTUNE"]:
138 DEFINES["MOZ_VTUNE_INSTRUMENTATION"] = True
140 "core/VTuneProfiler.cpp",
143 XPCSHELL_TESTS_MANIFESTS += ["tests/xpcshell/xpcshell.ini"]
144 MOCHITEST_CHROME_MANIFESTS += ["tests/chrome/chrome.toml"]
145 BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.ini"]
148 "core/MicroGeckoProfiler.cpp",
149 "core/ProfileAdditionalInformation.cpp",
150 "core/ProfilerBindings.cpp",
151 "core/ProfilerThreadRegistration.cpp",
152 "core/ProfilerThreadRegistrationData.cpp",
153 "core/ProfilerThreadRegistry.cpp",
154 "core/ProfilerUtils.cpp",
155 "gecko/ProfilerParent.cpp",
159 "gecko/PProfiler.ipdl",
160 "gecko/ProfilerTypes.ipdlh",
163 include("/ipc/chromium/chromium-config.mozbuild")
166 "public/ChildProfilerController.h",
167 "public/GeckoProfiler.h",
168 "public/MicroGeckoProfiler.h",
169 "public/ProfileAdditionalInformation.h",
170 "public/ProfilerBindings.h",
171 "public/ProfilerControl.h",
172 "public/ProfilerParent.h",
173 "public/ProfilerRustBindings.h",
177 "public/ProfileBufferEntrySerializationGeckoExtensions.h",
178 "public/ProfileJSONWriter.h",
179 "public/ProfilerCounts.h",
180 "public/ProfilerLabels.h",
181 "public/ProfilerMarkers.h",
182 "public/ProfilerMarkersDetail.h",
183 "public/ProfilerMarkersPrerequisites.h",
184 "public/ProfilerMarkerTypes.h",
185 "public/ProfilerRunnable.h",
186 "public/ProfilerState.h",
187 "public/ProfilerThreadPlatformData.h",
188 "public/ProfilerThreadRegistration.h",
189 "public/ProfilerThreadRegistrationData.h",
190 "public/ProfilerThreadRegistrationInfo.h",
191 "public/ProfilerThreadRegistry.h",
192 "public/ProfilerThreadSleep.h",
193 "public/ProfilerThreadState.h",
194 "public/ProfilerUtils.h",
198 "rust-api/src/gecko_bindings/profiling_categories.rs",
199 script="../../mozglue/baseprofiler/build/generate_profiling_categories.py",
200 entry_point="generate_rust_enums",
201 inputs=["../../mozglue/baseprofiler/build/profiling_categories.yaml"],
204 CONFIGURE_SUBST_FILES += [
205 "rust-api/extra-bindgen-flags",
209 if CONFIG["COMPILE_ENVIRONMENT"]:
210 CbindgenHeader("profiler_ffi_generated.h", inputs=["rust-api"])
213 "!profiler_ffi_generated.h",
220 FINAL_LIBRARY = "xul"
222 if CONFIG["ENABLE_TESTS"]:
223 DIRS += ["tests/gtest"]
225 if CONFIG["CC_TYPE"] in ("clang", "gcc"):
227 "-Wno-error=stack-protector",
228 "-Wno-ignored-qualifiers", # due to use of breakpad headers
232 BUG_COMPONENT = ("Core", "Gecko Profiler")