diff options
author | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-02-24 18:46:09 +0000 |
---|---|---|
committer | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-02-24 18:46:09 +0000 |
commit | 2fe9bf1613a892693676f391ac055efee306800f (patch) | |
tree | 34f4beb6d77598233e979292a18b5fd893463eb1 /src | |
parent | db4fe036131b5f1751bc46b2b79b7139210a6df9 (diff) | |
download | riscv-openocd-2fe9bf1613a892693676f391ac055efee306800f.zip riscv-openocd-2fe9bf1613a892693676f391ac055efee306800f.tar.gz riscv-openocd-2fe9bf1613a892693676f391ac055efee306800f.tar.bz2 |
debug_level 3 now prints seconds since start of openocd
git-svn-id: svn://svn.berlios.de/openocd/trunk@330 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r-- | src/helper/log.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/helper/log.c b/src/helper/log.c index 7b7c914..8567c03 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -36,6 +36,7 @@ static FILE* log_output; static void *privData;
static logCallback callback;
+static time_t start;
void log_setCallback(logCallback c, void *p)
{
@@ -72,7 +73,8 @@ void log_printf(enum log_levels level, const char *file, int line, const char *f if (debug_level >= LOG_DEBUG)
{
/* print with count and time information */
- fprintf(log_output, "%s %d %ld %s:%d %s(): %s\n", log_strings[level+1], count, time(NULL), file, line, function, buffer);
+ time_t t=time(NULL)-start;
+ fprintf(log_output, "%s %d %ld %s:%d %s(): %s\n", log_strings[level+1], count, t, file, line, function, buffer);
}
else
{
@@ -133,6 +135,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);
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,
|