Index: src/platform/tpm_lite/src/tlcl/tlcl.c |
diff --git a/src/platform/tpm_lite/src/tlcl/tlcl.c b/src/platform/tpm_lite/src/tlcl/tlcl.c |
index b505f7238070c310ade69a79b39ec73d2649685f..22d3613a809604cdd0a2fb96d4b7e8ef941cb010 100644 |
--- a/src/platform/tpm_lite/src/tlcl/tlcl.c |
+++ b/src/platform/tpm_lite/src/tlcl/tlcl.c |
@@ -17,6 +17,7 @@ |
#include <errno.h> |
#include <fcntl.h> |
#include <string.h> |
+#include <sys/time.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <tss/tcs.h> |
@@ -134,7 +135,10 @@ static void SendReceive(uint8_t* request, uint8_t* response, int max_length) { |
#if USE_TPM_EMULATOR |
tpmemu_execute(request, TpmCommandSize(request), response, &response_length); |
#else |
+ struct timeval before, after; |
+ gettimeofday(&before, NULL); |
gauravsh
2010/03/13 00:47:47
For better precision I would recommend using clock
|
TpmExecute(request, TpmCommandSize(request), response, &response_length); |
+ gettimeofday(&after, NULL); |
#endif |
{ |
@@ -146,6 +150,9 @@ static void SendReceive(uint8_t* request, uint8_t* response, int max_length) { |
printf("response (%d bytes): ", y); |
PrintBytes(response, 10); |
PrintBytes(response + 10, y - 10); |
+ printf("execution time: %dms\n", |
+ (int) ((after.tv_sec - before.tv_sec) * 1000 + |
+ (after.tv_usec - before.tv_usec) / 1000)); |
} |
/* sanity checks */ |