mirror of
https://github.com/servo/servo.git
synced 2025-06-20 07:08:59 +01:00
Don’t include microsecons when reporting build times.
"0:03:40.817715" is harder to read and no more informative than "0:03:40"
This commit is contained in:
parent
e18bf81905
commit
799490d920
1 changed files with 9 additions and 5 deletions
|
@ -26,6 +26,10 @@ from mach.decorators import (
|
||||||
from servo.command_base import CommandBase, cd, call
|
from servo.command_base import CommandBase, cd, call
|
||||||
|
|
||||||
|
|
||||||
|
def format_duration(seconds):
|
||||||
|
return str(datetime.timedelta(seconds=int(seconds)))
|
||||||
|
|
||||||
|
|
||||||
def notify_linux(title, text):
|
def notify_linux(title, text):
|
||||||
try:
|
try:
|
||||||
import dbus
|
import dbus
|
||||||
|
@ -86,7 +90,7 @@ def notify_build_done(elapsed):
|
||||||
"""Generate desktop notification when build is complete and the
|
"""Generate desktop notification when build is complete and the
|
||||||
elapsed build time was longer than 30 seconds."""
|
elapsed build time was longer than 30 seconds."""
|
||||||
if elapsed > 30:
|
if elapsed > 30:
|
||||||
notify("Servo build", "Completed in %s" % str(datetime.timedelta(seconds=elapsed)))
|
notify("Servo build", "Completed in %s" % format_duration(elapsed))
|
||||||
|
|
||||||
|
|
||||||
def notify(title, text):
|
def notify(title, text):
|
||||||
|
@ -238,7 +242,7 @@ class MachCommands(CommandBase):
|
||||||
# Generate Desktop Notification if elapsed-time > some threshold value
|
# Generate Desktop Notification if elapsed-time > some threshold value
|
||||||
notify_build_done(elapsed)
|
notify_build_done(elapsed)
|
||||||
|
|
||||||
print("Build completed in %s" % str(datetime.timedelta(seconds=elapsed)))
|
print("Build completed in %s" % format_duration(elapsed))
|
||||||
return status
|
return status
|
||||||
|
|
||||||
@Command('build-cef',
|
@Command('build-cef',
|
||||||
|
@ -274,7 +278,7 @@ class MachCommands(CommandBase):
|
||||||
# Generate Desktop Notification if elapsed-time > some threshold value
|
# Generate Desktop Notification if elapsed-time > some threshold value
|
||||||
notify_build_done(elapsed)
|
notify_build_done(elapsed)
|
||||||
|
|
||||||
print("CEF build completed in %s" % str(datetime.timedelta(seconds=elapsed)))
|
print("CEF build completed in %s" % format_duration(elapsed))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
@ -311,7 +315,7 @@ class MachCommands(CommandBase):
|
||||||
# Generate Desktop Notification if elapsed-time > some threshold value
|
# Generate Desktop Notification if elapsed-time > some threshold value
|
||||||
notify_build_done(elapsed)
|
notify_build_done(elapsed)
|
||||||
|
|
||||||
print("GeckoLib build completed in %s" % str(datetime.timedelta(seconds=elapsed)))
|
print("GeckoLib build completed in %s" % format_duration(elapsed))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
@ -349,7 +353,7 @@ class MachCommands(CommandBase):
|
||||||
# Generate Desktop Notification if elapsed-time > some threshold value
|
# Generate Desktop Notification if elapsed-time > some threshold value
|
||||||
notify_build_done(elapsed)
|
notify_build_done(elapsed)
|
||||||
|
|
||||||
print("Gonk build completed in %s" % str(datetime.timedelta(seconds=elapsed)))
|
print("Gonk build completed in %s" % format_duration(elapsed))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue