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:
21
common.py
21
common.py
@@ -3,6 +3,7 @@
|
||||
import argparse
|
||||
import base64
|
||||
import copy
|
||||
import datetime
|
||||
import glob
|
||||
import imp
|
||||
import os
|
||||
@@ -13,6 +14,7 @@ import signal
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
this = sys.modules[__name__]
|
||||
|
||||
@@ -45,6 +47,13 @@ if os.path.exists(config_file):
|
||||
config = imp.load_source('config', config_file)
|
||||
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):
|
||||
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)
|
||||
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):
|
||||
global this
|
||||
readelf_header = subprocess.check_output([
|
||||
@@ -211,6 +213,11 @@ def print_cmd(cmd, cmd_file=None, extra_env=None):
|
||||
st = os.stat(cmd_file)
|
||||
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):
|
||||
if extra_args is None:
|
||||
extra_args = {}
|
||||
|
||||
Reference in New Issue
Block a user