print ms in debug_level 3 logs. Seconds is not enough.
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 13 Mar 2008 08:17:01 +0000 (08:17 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 13 Mar 2008 08:17:01 +0000 (08:17 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@510 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/helper/log.c
src/helper/time_support.c
src/helper/time_support.h

index cb45a7eb536d3c83df122dae86997fc56bfe3239..03fecc208ec7a699d3b1c7a20e1f52c24be300ef 100644 (file)
@@ -35,7 +35,7 @@ int debug_level = -1;
 static FILE* log_output;
 static log_callback_t *log_callbacks = NULL;
 
-static time_t start;
+static long long start;
 
 static char *log_strings[5] =
 {
@@ -77,7 +77,7 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
                if (debug_level >= LOG_DEBUG)
                {
                        /* print with count and time information */
-                       int t=(int)(time(NULL)-start);
+                       int t=(int)(timeval_ms()-start);
                        fprintf(log_output, "%s %d %d %s:%d %s(): %s", log_strings[level+1], count, t, file, line, function, string);
                }
                else
@@ -191,7 +191,7 @@ int handle_log_output_command(struct command_context_s *cmd_ctx, char *cmd, char
 
 int log_register_commands(struct command_context_s *cmd_ctx)
 {
-       start = time(NULL);
+       start = timeval_ms();
        register_command(cmd_ctx, NULL, "log_output", handle_log_output_command,
                COMMAND_ANY, "redirect logging to <file> (default: stderr)");
        register_command(cmd_ctx, NULL, "debug_level", handle_debug_level_command,
index f772d2f4f0b887a588c657f6c48f041f5f79b37f..267746145f895636ea66ae0ac3eca753b3fc3f4e 100644 (file)
@@ -111,3 +111,18 @@ int duration_stop_measure(duration_t *duration, char **text)
        
        return ERROR_OK;
 }
+
+
+
+
+long long timeval_ms()
+{
+       struct timeval now; 
+       long long t=0;
+       gettimeofday(&now, NULL);
+       
+       t+=now.tv_usec/1000;
+       t+=now.tv_sec*1000;
+       
+       return t;
+}
index 4e79d0d0b1e3f8a5ea6745a05d0ce33092a52ae2..05dc91190a2a802c99deab20e51aafe771ca7fee 100644 (file)
@@ -26,6 +26,8 @@
 extern int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y);
 extern int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y);
 extern int timeval_add_time(struct timeval *result, int sec, int usec);
+/* gettimeofday() timeval in 64 bit ms */
+extern long long timeval_ms();
 
 typedef struct duration_s
 {

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)