Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(940)

Unified Diff: src/platform/tpm_lite/src/tlcl/tlcl.c

Issue 847005: Bug fixes and timing code. This is the first fully functional code, (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/tpm_lite/src/tlcl/generator.c ('k') | src/platform/tpm_lite/src/tlcl/tlcl_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 */
« no previous file with comments | « src/platform/tpm_lite/src/tlcl/generator.c ('k') | src/platform/tpm_lite/src/tlcl/tlcl_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698