forked from mirrors/gecko-dev
Bug 1892641 - include timestamps in BUILDSTATUS lines from gradle, r=glandium.
Differential Revision: https://phabricator.services.mozilla.com/D208531
This commit is contained in:
parent
b0f26d11ff
commit
9118178e3b
3 changed files with 30 additions and 9 deletions
13
build.gradle
13
build.gradle
|
|
@ -72,6 +72,11 @@ def getRustVersionFor(packageName) {
|
||||||
return version
|
return version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def now() {
|
||||||
|
Instant now = Instant.now();
|
||||||
|
return now.getEpochSecond() + now.getNano() / 1_000_000_000L;
|
||||||
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
def shouldPrintBuildStatus =
|
def shouldPrintBuildStatus =
|
||||||
System.getenv("MACH") && !System.getenv("NO_BUILDSTATUS_MESSAGES")
|
System.getenv("MACH") && !System.getenv("NO_BUILDSTATUS_MESSAGES")
|
||||||
|
|
@ -80,23 +85,23 @@ allprojects {
|
||||||
// Adding new line before each line to make sure they're dumped as a separate line.
|
// Adding new line before each line to make sure they're dumped as a separate line.
|
||||||
// Add profile marker to the start of the project evaluation
|
// Add profile marker to the start of the project evaluation
|
||||||
project.beforeEvaluate {
|
project.beforeEvaluate {
|
||||||
println "\nBUILDSTATUS START_gradle:evaluate-project ${project.name}"
|
println "\nBUILDSTATUS ${now()} START_gradle:evaluate-project ${project.name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add profile marker to the end of the project evaluation
|
// Add profile marker to the end of the project evaluation
|
||||||
project.afterEvaluate {
|
project.afterEvaluate {
|
||||||
println "\nBUILDSTATUS END_gradle:evaluate-project ${project.name}"
|
println "\nBUILDSTATUS ${now()} END_gradle:evaluate-project ${project.name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.configureEach { task ->
|
tasks.configureEach { task ->
|
||||||
// Add profile marker to the start of the gradle task
|
// Add profile marker to the start of the gradle task
|
||||||
task.doFirst {
|
task.doFirst {
|
||||||
println "\nBUILDSTATUS START_gradle:${project.name}-tasks ${task.name}"
|
println "\nBUILDSTATUS ${now()} START_gradle-task ${project.name}:${task.name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add profile marker to the end of the gradle task
|
// Add profile marker to the end of the gradle task
|
||||||
task.doLast {
|
task.doLast {
|
||||||
println "\nBUILDSTATUS END_gradle:${project.name}-tasks ${task.name}"
|
println "\nBUILDSTATUS ${now()} END_gradle-task ${project.name}:${task.name}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -263,6 +263,12 @@ class BuildMonitor(MozbuildObject):
|
||||||
|
|
||||||
_, _, disambiguator = args.pop(0).partition("@")
|
_, _, disambiguator = args.pop(0).partition("@")
|
||||||
action = args.pop(0)
|
action = args.pop(0)
|
||||||
|
time = None
|
||||||
|
regexp = re.compile(r"\d{10}(\.\d{1,9})?$")
|
||||||
|
if regexp.match(action):
|
||||||
|
time = float(action)
|
||||||
|
action = args.pop(0)
|
||||||
|
|
||||||
update_needed = True
|
update_needed = True
|
||||||
|
|
||||||
if action == "TIERS":
|
if action == "TIERS":
|
||||||
|
|
@ -280,12 +286,12 @@ class BuildMonitor(MozbuildObject):
|
||||||
update_needed = False
|
update_needed = False
|
||||||
elif action.startswith("START_"):
|
elif action.startswith("START_"):
|
||||||
self.resources.begin_marker(
|
self.resources.begin_marker(
|
||||||
action[len("START_") :], " ".join(args), disambiguator
|
action[len("START_") :], " ".join(args), disambiguator, time
|
||||||
)
|
)
|
||||||
update_needed = False
|
update_needed = False
|
||||||
elif action.startswith("END_"):
|
elif action.startswith("END_"):
|
||||||
self.resources.end_marker(
|
self.resources.end_marker(
|
||||||
action[len("END_") :], " ".join(args), disambiguator
|
action[len("END_") :], " ".join(args), disambiguator, time
|
||||||
)
|
)
|
||||||
update_needed = False
|
update_needed = False
|
||||||
elif action == "BUILD_VERBOSE":
|
elif action == "BUILD_VERBOSE":
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,7 @@ class SystemResourceMonitor(object):
|
||||||
self._swap_type = type(swap)
|
self._swap_type = type(swap)
|
||||||
self._swap_len = len(swap)
|
self._swap_len = len(swap)
|
||||||
self.start_timestamp = time.time()
|
self.start_timestamp = time.time()
|
||||||
|
self.start_time = time.monotonic()
|
||||||
|
|
||||||
self._pipe, child_pipe = multiprocessing.Pipe(True)
|
self._pipe, child_pipe = multiprocessing.Pipe(True)
|
||||||
|
|
||||||
|
|
@ -328,6 +329,9 @@ class SystemResourceMonitor(object):
|
||||||
self._pipe.send(("terminate",))
|
self._pipe.send(("terminate",))
|
||||||
self._process.join()
|
self._process.join()
|
||||||
|
|
||||||
|
def convert_to_monotonic_time(self, timestamp):
|
||||||
|
return timestamp - self.start_timestamp + self.start_time
|
||||||
|
|
||||||
# Methods to control monitoring.
|
# Methods to control monitoring.
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
|
@ -458,18 +462,24 @@ class SystemResourceMonitor(object):
|
||||||
SystemResourceMonitor.instance.markers.append((name, start, end, text))
|
SystemResourceMonitor.instance.markers.append((name, start, end, text))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def begin_marker(name, text, disambiguator=None):
|
def begin_marker(name, text, disambiguator=None, timestamp=None):
|
||||||
if SystemResourceMonitor.instance:
|
if SystemResourceMonitor.instance:
|
||||||
id = name + ":" + text
|
id = name + ":" + text
|
||||||
if disambiguator:
|
if disambiguator:
|
||||||
id += ":" + disambiguator
|
id += ":" + disambiguator
|
||||||
SystemResourceMonitor.instance._active_markers[id] = time.monotonic()
|
SystemResourceMonitor.instance._active_markers[id] = (
|
||||||
|
SystemResourceMonitor.instance.convert_to_monotonic_time(timestamp)
|
||||||
|
if timestamp
|
||||||
|
else time.monotonic()
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def end_marker(name, text, disambiguator=None):
|
def end_marker(name, text, disambiguator=None, timestamp=None):
|
||||||
if not SystemResourceMonitor.instance:
|
if not SystemResourceMonitor.instance:
|
||||||
return
|
return
|
||||||
end = time.monotonic()
|
end = time.monotonic()
|
||||||
|
if timestamp:
|
||||||
|
end = SystemResourceMonitor.instance.convert_to_monotonic_time(timestamp)
|
||||||
id = name + ":" + text
|
id = name + ":" + text
|
||||||
if disambiguator:
|
if disambiguator:
|
||||||
id += ":" + disambiguator
|
id += ":" + disambiguator
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue