Skip to content

Instantly share code, notes, and snippets.

@NilashishC
Created May 10, 2021 06:50
Show Gist options
  • Save NilashishC/47d58086f31ceda5c9e52c5f39c212a0 to your computer and use it in GitHub Desktop.
Save NilashishC/47d58086f31ceda5c9e52c5f39c212a0 to your computer and use it in GitHub Desktop.
diff --git a/plugins/connection/network_cli.py b/plugins/connection/network_cli.py
index 63b15e9..874b370 100644
--- a/plugins/connection/network_cli.py
+++ b/plugins/connection/network_cli.py
@@ -323,7 +323,7 @@ from functools import wraps
import getpass
import json
import logging
-import re
+import re, q
import os
import signal
import socket
@@ -915,6 +915,10 @@ class Connection(NetworkConnectionBase):
self._log_messages("command: %s" % command)
if self._ssh_type == "libssh":
+ import q, time
+ debug1 = "sending %s" % command
+ q(debug1)
+ start_time = time.perf_counter()
response = self.receive_libssh(
command,
prompts,
@@ -923,7 +927,14 @@ class Connection(NetworkConnectionBase):
prompt_retry_check,
check_all,
)
+ elapsed_time = time.perf_counter() - start_time
+ debug2 = "elapsed time for %s is %s" %(command, elapsed_time)
+ q(debug2)
else:
+ import q, time
+ debug1 = "sending %s" % command
+ q(debug1)
+ start_time = time.perf_counter()
response = self.receive_paramiko(
command,
prompts,
@@ -932,6 +943,9 @@ class Connection(NetworkConnectionBase):
prompt_retry_check,
check_all,
)
+ elapsed_time = time.perf_counter() - start_time
+ debug2 = "elapsed time for %s is %s" %(command, elapsed_time)
+ q(debug2)
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment