[autotest] Improve performance on result size collection.
1. Don't do a deepcopy for result info of new directories.
2. Delay updating parent result info's size information.
3. Add metrics for the collect_result_sizes call.
BUG=chromium:781066
TEST=unittest
Change-Id: I0b13d8641d1cdfc46c503822f41e25088245f37d
Reviewed-on: https://chromium-review.googlesource.com/753974
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/tko/parse.py b/tko/parse.py
index c4b398f..772daaf 100755
--- a/tko/parse.py
+++ b/tko/parse.py
@@ -10,6 +10,7 @@
import socket
import subprocess
import sys
+import time
import traceback
import common
@@ -400,8 +401,11 @@
_throttle_result_size(path)
# Record test result size to job_keyvals
+ start_time = time.time()
result_size_info = site_utils.collect_result_sizes(
path, log=tko_utils.dprint)
+ tko_utils.dprint('Finished collecting result sizes after %s seconds' %
+ (time.time()-start_time))
job.keyval_dict.update(result_size_info.__dict__)
# TODO(dshi): Update sizes with sponge_invocation.xml and throttle it.