Skip to content

Added command execution time measurement #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions testgres/plugins/pg_probackup2/pg_probackup2/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self, test_class: unittest.TestCase,
self.verbose = init_params.verbose
self.archive_compress = init_params.archive_compress
self.test_class.output = None
self.execution_time = None

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

start_time = time.time()
self.test_class.output = subprocess.check_output(
cmdline,
stderr=subprocess.STDOUT,
env=env
).decode('utf-8', errors='replace')
end_time = time.time()
self.execution_time = end_time - start_time

if command[0] == 'backup' and return_id:
# return backup ID
for line in self.test_class.output.splitlines():
Expand Down