Skip to content

Commit 63db275

Browse files
authored
Added command execution time measurement (#123)
This will be useful to keep track of possible performance degradation when code changes.
1 parent e375302 commit 63db275

File tree

1 file changed

+5
-0
lines changed
  • testgres/plugins/pg_probackup2/pg_probackup2

1 file changed

+5
-0
lines changed

testgres/plugins/pg_probackup2/pg_probackup2/app.py

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def __init__(self, test_class: unittest.TestCase,
5656
self.verbose = init_params.verbose
5757
self.archive_compress = init_params.archive_compress
5858
self.test_class.output = None
59+
self.execution_time = None
5960

6061
def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
6162
skip_log_directory=False, expect_error=False, use_backup_dir=True):
@@ -113,11 +114,15 @@ def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
113114
cmdline = ['gdbserver'] + ['localhost:' + str(gdb_port)] + cmdline
114115
print("pg_probackup gdb suspended, waiting gdb connection on localhost:{0}".format(gdb_port))
115116

117+
start_time = time.time()
116118
self.test_class.output = subprocess.check_output(
117119
cmdline,
118120
stderr=subprocess.STDOUT,
119121
env=env
120122
).decode('utf-8', errors='replace')
123+
end_time = time.time()
124+
self.execution_time = end_time - start_time
125+
121126
if command[0] == 'backup' and return_id:
122127
# return backup ID
123128
for line in self.test_class.output.splitlines():

0 commit comments

Comments
 (0)