#define DEBUGSORT
#ifdef DEBUGSORT
#include
static unsigned long long usec(void){
struct timeval tv;
gettimeofday(&tv,NULL);
return (unsigned long long)tv.tv_sec*1000000+tv.tv_usec;
}
static struct {
const char *file;
int line;
unsigned long long usec;
}LOGTABLE[9000000];
static int LOGCOUNT = 0;
void putlog(const char*, const int);
void putlog(const char* file, const int line){
if(LOGCOUNT
LOGTABLE[LOGCOUNT].file = file;
LOGTABLE[LOGCOUNT].line = line;
LOGTABLE[LOGCOUNT].usec = usec();
LOGCOUNT++;
}
}
void printlog(void);
void printlog(void){
int i;
for(i=0; i
fprintf(stderr, "%s:%d=%lld\n",
LOGTABLE[i].file,
LOGTABLE[i].line,
LOGTABLE[i].usec);
}
}
#define LOG putlog(__FILE__,__LINE__)
#define PRINTLOG printlog()
#else /* DEBUGSORT */
#define LOG
#define PRINTLOG
#endif /* DEBUGSORT */
(snowmail)