Adds log.h and debug.h to split the logging and debug bits out of
fio, so that the parser can use them.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
verify Dump info related to IO verification
all Enable all debug options
random Dump info related to random offset generation
verify Dump info related to IO verification
all Enable all debug options
random Dump info related to random offset generation
+ parse Dump info related to option matching and parsing
? or help Show available debug options.
You can specify as many as you want, eg --debug=file,mem will enable
? or help Show available debug options.
You can specify as many as you want, eg --debug=file,mem will enable
--- /dev/null
+#ifndef FIO_DEBUG_H
+#define FIO_DEBUG_H
+
+#include <assert.h>
+#include "log.h"
+
+enum {
+ FD_PROCESS = 0,
+ FD_FILE,
+ FD_IO,
+ FD_MEM,
+ FD_BLKTRACE,
+ FD_VERIFY,
+ FD_RANDOM,
+ FD_PARSE,
+ FD_DEBUG_MAX,
+};
+
+#ifdef FIO_INC_DEBUG
+struct debug_level {
+ const char *name;
+ unsigned long shift;
+};
+extern struct debug_level debug_levels[];
+
+extern unsigned long fio_debug;
+
+#define dprint(type, str, args...) \
+ do { \
+ assert(type < FD_DEBUG_MAX); \
+ if ((((1 << type)) & fio_debug) == 0) \
+ break; \
+ log_info("%-8s ", debug_levels[(type)].name); \
+ log_info(str, ##args); \
+ } while (0)
+
+#else
+
+#define dprint(type, str, args...)
+#endif
+
+#endif
#include "arch/arch.h"
#include "os/os.h"
#include "mutex.h"
#include "arch/arch.h"
#include "os/os.h"
#include "mutex.h"
+#include "log.h"
+#include "debug.h"
#ifdef FIO_HAVE_GUASI
#include <guasi.h>
#ifdef FIO_HAVE_GUASI
#include <guasi.h>
extern int shm_id;
extern int groupid;
extern int terse_output;
extern int shm_id;
extern int groupid;
extern int terse_output;
-extern FILE *f_out;
-extern FILE *f_err;
extern int temp_stall_ts;
extern unsigned long long mlock_size;
extern unsigned long page_mask, page_size;
extern int temp_stall_ts;
extern unsigned long long mlock_size;
extern unsigned long page_mask, page_size;
extern int load_blktrace(struct thread_data *, const char *);
#endif
extern int load_blktrace(struct thread_data *, const char *);
#endif
-/*
- * If logging output to a file, stderr should go to both stderr and f_err
- */
-#define log_err(args...) do { \
- fprintf(f_err, ##args); \
- if (f_err != stderr) \
- fprintf(stderr, ##args); \
- } while (0)
-
-#define log_info(args...) fprintf(f_out, ##args)
-
-FILE *get_f_out(void);
-FILE *get_f_err(void);
-
struct ioengine_ops {
struct list_head list;
char name[16];
struct ioengine_ops {
struct list_head list;
char name[16];
-enum {
- FD_PROCESS = 0,
- FD_FILE,
- FD_IO,
- FD_MEM,
- FD_BLKTRACE,
- FD_VERIFY,
- FD_RANDOM,
- FD_DEBUG_MAX,
-};
-
-struct debug_level {
- const char *name;
- unsigned long shift;
-};
-extern struct debug_level debug_levels[];
-
-extern unsigned long fio_debug;
-
-#define dprint(type, str, args...) \
- do { \
- assert(type < FD_DEBUG_MAX); \
- if ((((1 << type)) & fio_debug) == 0) \
- break; \
- log_info("%-8s ", debug_levels[(type)].name); \
- log_info(str, ##args); \
- } while (0)
-
static inline void dprint_io_u(struct io_u *io_u, const char *p)
{
struct fio_file *f = io_u->file;
static inline void dprint_io_u(struct io_u *io_u, const char *p)
{
struct fio_file *f = io_u->file;
-#define dprint(type, str, args...)
#define dprint_io_u(io_u, p)
#endif
#define dprint_io_u(io_u, p)
#endif
{ .name = "blktrace", .shift = FD_BLKTRACE },
{ .name = "verify", .shift = FD_VERIFY },
{ .name = "random", .shift = FD_RANDOM },
{ .name = "blktrace", .shift = FD_BLKTRACE },
{ .name = "verify", .shift = FD_VERIFY },
{ .name = "random", .shift = FD_RANDOM },
+ { .name = "parse", .shift = FD_PARSE },
--- /dev/null
+#ifndef FIO_LOG_H
+#define FIO_LOG_H
+
+extern FILE *f_out;
+extern FILE *f_err;
+
+/*
+ * If logging output to a file, stderr should go to both stderr and f_err
+ */
+#define log_err(args...) do { \
+ fprintf(f_err, ##args); \
+ if (f_err != stderr) \
+ fprintf(stderr, ##args); \
+ } while (0)
+
+#define log_info(args...) fprintf(f_out, ##args)
+
+FILE *get_f_out(void);
+FILE *get_f_err(void);
+
+#endif
#include <limits.h>
#include "parse.h"
#include <limits.h>
#include "parse.h"
static int vp_cmp(const void *p1, const void *p2)
{
static int vp_cmp(const void *p1, const void *p2)
{
char **cp;
int ret = 0, is_time = 0;
char **cp;
int ret = 0, is_time = 0;
+ dprint(FD_PARSE, "__handle_option=%s, type=%d, ptr=%s\n", o->name,
+ o->type, ptr);
+
if (!ptr && o->type != FIO_OPT_STR_SET) {
fprintf(stderr, "Option %s requires an argument\n", o->name);
return 1;
if (!ptr && o->type != FIO_OPT_STR_SET) {
fprintf(stderr, "Option %s requires an argument\n", o->name);
return 1;
const char *ptr2 = NULL;
int r1, r2;
const char *ptr2 = NULL;
int r1, r2;
+ dprint(FD_PARSE, "handle_option=%s, ptr=%s\n", o->name, ptr);
+
/*
* See if we have a second set of parameters, hidden after a comma.
* Do this before parsing the first round, to check if we should
/*
* See if we have a second set of parameters, hidden after a comma.
* Do this before parsing the first round, to check if we should
+ dprint(FD_PARSE, "filling default options\n");
+
for (o = &options[0]; o->name; o++)
if (o->def)
handle_option(o, o->def, data);
for (o = &options[0]; o->name; o++)
if (o->def)
handle_option(o, o->def, data);
+ dprint(FD_PARSE, "init options\n");
+
for (o = &options[0]; o->name; o++) {
if (o->type == FIO_OPT_BOOL) {
o->minval = 0;
for (o = &options[0]; o->name; o++) {
if (o->type == FIO_OPT_BOOL) {
o->minval = 0;