Add job number specific dumping and fix atexit() error

The threads/process jobs should use _exit() so they don't run
the main atexit() function.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/debug.h b/debug.h
index 22577a8..883628d 100644
--- a/debug.h
+++ b/debug.h
@@ -14,6 +14,7 @@
 	FD_RANDOM,
 	FD_PARSE,
 	FD_DISKUTIL,
+	FD_JOB,
 	FD_DEBUG_MAX,
 };
 
@@ -21,17 +22,24 @@
 struct debug_level {
 	const char *name;
 	unsigned long shift;
+	unsigned int jobno;
 };
 extern struct debug_level debug_levels[];
 
 extern unsigned long fio_debug;
+extern unsigned int fio_debug_jobno, *fio_debug_jobp;
 
 #define dprint(type, str, args...)				\
 	do {							\
+		pid_t pid = getpid();				\
 		assert(type < FD_DEBUG_MAX);			\
 		if ((((1 << type)) & fio_debug) == 0)		\
 			break;					\
+		if (fio_debug_jobp && *fio_debug_jobp != -1U	\
+		    && pid != *fio_debug_jobp)			\
+			break;					\
 		log_info("%-8s ", debug_levels[(type)].name);	\
+		log_info("%-5u ", pid);				\
 		log_info(str, ##args);				\
 	} while (0)