firedragon/0021-bmo-1516081-Disable-watchdog-during-PGO-builds.patch

56 lines
2.4 KiB
Diff
Raw Normal View History

2021-04-22 11:09:29 +00:00
From b67daf06346038ed243b68e916126fa373043b15 Mon Sep 17 00:00:00 2001
From: Thomas Deutschmann <whissi@gentoo.org>
Date: Mon, 6 Apr 2020 20:27:06 +0200
Subject: [PATCH 21/35] bmo#1516081: Disable watchdog during PGO builds
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1516081
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
build/moz.configure/lto-pgo.configure | 4 ++--
toolkit/components/terminator/nsTerminator.cpp | 7 +++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/build/moz.configure/lto-pgo.configure b/build/moz.configure/lto-pgo.configure
index 2f32b11588..d55abb4934 100644
--- a/build/moz.configure/lto-pgo.configure
+++ b/build/moz.configure/lto-pgo.configure
@@ -85,7 +85,7 @@ set_config("PGO_PROFILE_PATH", pgo_profile_path)
def pgo_flags(compiler, profdata, target_is_windows):
if compiler.type == "gcc":
return namespace(
- gen_cflags=["-fprofile-generate"],
+ gen_cflags=["-fprofile-generate", "-DMOZ_PROFILE_INSTRUMENTATION"],
gen_ldflags=["-fprofile-generate"],
use_cflags=["-fprofile-use", "-fprofile-correction", "-Wcoverage-mismatch"],
use_ldflags=["-fprofile-use"],
@@ -99,7 +99,7 @@ def pgo_flags(compiler, profdata, target_is_windows):
else:
gen_ldflags = ["-fprofile-generate"]
- gen_cflags = [prefix + "-fprofile-generate"]
+ gen_cflags = [prefix + "-fprofile-generate", "-DMOZ_PROFILE_INSTRUMENTATION"]
if target_is_windows:
# native llvm-profdata.exe on Windows can't read profile data
# if name compression is enabled (which cross-compiling enables
diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp
index c35dfed444..98dfe42369 100644
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -418,6 +418,13 @@ void nsTerminator::StartWatchdog() {
}
#endif
+ // Disable watchdog for PGO train builds - writting profile information at
+ // exit may take time and it is better to make build hang rather than
+ // silently produce poorly performing binary.
+#ifdef MOZ_PROFILE_INSTRUMENTATION
+ crashAfterMS = INT32_MAX;
+#endif
+
UniquePtr<Options> options(new Options());
const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000);
options->crashAfterTicks = crashAfterMS / ticksDuration;
--
2.29.2