aboutsummaryrefslogtreecommitdiff
path: root/build/lib
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2016-04-20 17:00:46 -0700
committerDan Albert <danalbert@google.com>2016-04-20 17:00:46 -0700
commit67cf59fc54263a6e15fea20ba0d6902e6cc339ce (patch)
treef09c50f54697713cf63fd5c660f222b3a2d3689c /build/lib
parentddaec8a857695c33b38a7637d9f09089b9a7706e (diff)
downloadndk-67cf59fc54263a6e15fea20ba0d6902e6cc339ce.tar.gz
Time the internal steps of packaging.
Change-Id: I228d58bd6607ec6fe8d6e101b7e3ab7347c77e9f
Diffstat (limited to 'build/lib')
-rw-r--r--build/lib/build_support.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/build/lib/build_support.py b/build/lib/build_support.py
index 6d7beb9f6..3b48826de 100644
--- a/build/lib/build_support.py
+++ b/build/lib/build_support.py
@@ -14,12 +14,14 @@
# limitations under the License.
#
import argparse
+import datetime
import multiprocessing
import os
import shutil
import subprocess
import sys
import tempfile
+import timeit
import zipfile
@@ -69,6 +71,29 @@ ALL_ABIS = (
)
+class Timer(object):
+ def __init__(self):
+ self.start_time = None
+ self.end_time = None
+ self.duration = None
+
+ def start(self):
+ self.start_time = timeit.default_timer()
+
+ def finish(self):
+ self.end_time = timeit.default_timer()
+
+ # Not interested in partial seconds at this scale.
+ seconds = int(self.end_time - self.start_time)
+ self.duration = datetime.timedelta(seconds=seconds)
+
+ def __enter__(self):
+ self.start()
+
+ def __exit__(self, _exc_type, _exc_value, _traceback):
+ self.finish()
+
+
def arch_to_toolchain(arch):
return dict(zip(ALL_ARCHITECTURES, ALL_TOOLCHAINS))[arch]