ffdc: Add reporting of Total Time taken to collect ffdc
Tests:
- Set 1: Regression testing with OpenBmc, Ubuntu, RHEL
Signed-off-by: Peter D Phan <peterp@us.ibm.com>
Change-Id: I52f81316f63c8d64a686197f09da545c4389f877
diff --git a/ffdc/collect_ffdc.py b/ffdc/collect_ffdc.py
index ca56b41..1915b2a 100644
--- a/ffdc/collect_ffdc.py
+++ b/ffdc/collect_ffdc.py
@@ -56,8 +56,9 @@
else:
click.echo(str("\n\t" + str(len(os.listdir(thisFFDC.ffdc_dir_path)))
+ " files were retrieved from " + remote))
- click.echo("\tFiles are stored in " + thisFFDC.ffdc_dir_path + "\n\n")
+ click.echo("\tFiles are stored in " + thisFFDC.ffdc_dir_path)
+ click.echo("\tTotal elapsed time " + thisFFDC.elapsed_time + "\n\n")
click.echo("\n********** FFDC Finishes **********\n\n")
diff --git a/ffdc/ffdc_collector.py b/ffdc/ffdc_collector.py
index 2316df2..2604650 100644
--- a/ffdc/ffdc_collector.py
+++ b/ffdc/ffdc_collector.py
@@ -22,9 +22,6 @@
"""
- # List of supported OSes.
- supported_oses = ['OPENBMC', 'RHEL', 'AIX', 'UBUNTU']
-
def __init__(self,
hostname,
username,
@@ -55,6 +52,8 @@
self.ffdc_prefix = ""
self.target_type = remote_type.upper()
self.remote_protocol = remote_protocol.upper()
+ self.start_time = 0
+ self.elapsed_time = ''
else:
sys.exit(-1)
@@ -177,6 +176,7 @@
"""
print("\n\t---- Start communicating with %s ----" % self.hostname)
+ self.start_time = time.time()
working_protocol_list = []
if self.target_is_pingable():
# Check supported protocol ping,ssh, redfish are working.
@@ -270,6 +270,7 @@
self.protocol_ipmi(ffdc_actions, machine_type, k)
# Close network connection after collecting all files
+ self.elapsed_time = time.strftime("%H:%M:%S", time.gmtime(time.time() - self.start_time))
self.remoteclient.ssh_remoteclient_disconnect()
def protocol_ssh(self,