comparison lwasm/debug.c @ 199:3132b1742eca

Add a time stamp to debug messages Add time stamps to debug messages to improve ability to profile the assembly process.
author William Astle <lost@l-w.ca>
date Fri, 16 Mar 2012 17:29:53 -0600
parents 697bc543368c
children 5d401d1eb3e9
comparison
equal deleted inserted replaced
198:d2bed389e94a 199:3132b1742eca
20 */ 20 */
21 21
22 #include <stdio.h> 22 #include <stdio.h>
23 #include <string.h> 23 #include <string.h>
24 #include <stdarg.h> 24 #include <stdarg.h>
25 #include <time.h>
25 26
26 #include "lwasm.h" 27 #include "lwasm.h"
27 #include "instab.h" 28 #include "instab.h"
28 29
29 /* 30 /*
81 if (as -> debug_file == NULL) 82 if (as -> debug_file == NULL)
82 as -> debug_file = stderr; 83 as -> debug_file = stderr;
83 84
84 va_start(args, fmt); 85 va_start(args, fmt);
85 86
86 fprintf(as -> debug_file, "DEBUG %03d: ", level); 87 fprintf(as -> debug_file, "DEBUG %03d (%ld): ", level, (long)time(NULL));
87 vfprintf(as -> debug_file, fmt, args); 88 vfprintf(as -> debug_file, fmt, args);
88 fputc('\n', as -> debug_file); 89 fputc('\n', as -> debug_file);
89 90
90 va_end(args); 91 va_end(args);
91 } 92 }