mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
build-buildroot: time the build
This commit is contained in:
@@ -6,6 +6,7 @@ import pathlib
|
|||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import common
|
import common
|
||||||
@@ -321,4 +322,8 @@ def write_configs(buildroot_configs, buildroot_config_fragments=None):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = get_argparse()
|
parser = get_argparse()
|
||||||
args = common.setup(parser)
|
args = common.setup(parser)
|
||||||
sys.exit(main(args))
|
start_time = time.time()
|
||||||
|
exit_status = main(args)
|
||||||
|
end_time = time.time()
|
||||||
|
common.print_time(end_time - start_time)
|
||||||
|
sys.exit(exit_status)
|
||||||
|
|||||||
21
common.py
21
common.py
@@ -3,6 +3,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import base64
|
import base64
|
||||||
import copy
|
import copy
|
||||||
|
import datetime
|
||||||
import glob
|
import glob
|
||||||
import imp
|
import imp
|
||||||
import os
|
import os
|
||||||
@@ -13,6 +14,7 @@ import signal
|
|||||||
import stat
|
import stat
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
this = sys.modules[__name__]
|
this = sys.modules[__name__]
|
||||||
|
|
||||||
@@ -45,6 +47,13 @@ if os.path.exists(config_file):
|
|||||||
config = imp.load_source('config', config_file)
|
config = imp.load_source('config', config_file)
|
||||||
configs = {x:getattr(config, x) for x in dir(config) if not x.startswith('__')}
|
configs = {x:getattr(config, x) for x in dir(config) if not x.startswith('__')}
|
||||||
|
|
||||||
|
def add_build_arguments(parser):
|
||||||
|
parser.add_argument(
|
||||||
|
'--clean',
|
||||||
|
help='Clean the build instead of building.',
|
||||||
|
action='store_true',
|
||||||
|
)
|
||||||
|
|
||||||
def base64_encode(string):
|
def base64_encode(string):
|
||||||
return base64.b64encode(string.encode()).decode()
|
return base64.b64encode(string.encode()).decode()
|
||||||
|
|
||||||
@@ -144,13 +153,6 @@ Default: the run ID (-n) if that is an integer, otherwise 0.
|
|||||||
parser.set_defaults(**defaults)
|
parser.set_defaults(**defaults)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def add_build_arguments(parser):
|
|
||||||
parser.add_argument(
|
|
||||||
'--clean',
|
|
||||||
help='Clean the build instead of building.',
|
|
||||||
action='store_true',
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_elf_entry(elf_file_path):
|
def get_elf_entry(elf_file_path):
|
||||||
global this
|
global this
|
||||||
readelf_header = subprocess.check_output([
|
readelf_header = subprocess.check_output([
|
||||||
@@ -211,6 +213,11 @@ def print_cmd(cmd, cmd_file=None, extra_env=None):
|
|||||||
st = os.stat(cmd_file)
|
st = os.stat(cmd_file)
|
||||||
os.chmod(cmd_file, st.st_mode | stat.S_IXUSR)
|
os.chmod(cmd_file, st.st_mode | stat.S_IXUSR)
|
||||||
|
|
||||||
|
def print_time(ellapsed_seconds):
|
||||||
|
hours, rem = divmod(ellapsed_seconds, 3600)
|
||||||
|
minutes, seconds = divmod(rem, 60)
|
||||||
|
print("time {:02}:{:02}:{:02}".format(int(hours), int(minutes), int(seconds)))
|
||||||
|
|
||||||
def resolve_args(defaults, args, extra_args):
|
def resolve_args(defaults, args, extra_args):
|
||||||
if extra_args is None:
|
if extra_args is None:
|
||||||
extra_args = {}
|
extra_args = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user