[PATCH] More function moving
authorJens Axboe <axboe@suse.de>
Wed, 7 Jun 2006 09:14:56 +0000 (11:14 +0200)
committerJens Axboe <axboe@suse.de>
Wed, 7 Jun 2006 09:14:56 +0000 (11:14 +0200)
fio.h
init.c
log.c

diff --git a/fio.h b/fio.h
index f2e3adf26273b2cfa3dfaa0a48bdcb00a826f565..89d7bf94d1c72b9ca160d0b2c4c6f21fbc9296b3 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -258,10 +258,6 @@ struct thread_data {
                snprintf(td->verror, sizeof(td->verror) - 1, "file:%s:%d, error=%s", __FILE__, __LINE__, strerror(e));  \
        } while (0)
 
-extern int parse_jobs_ini(char *);
-extern int parse_options(int, char **);
-extern void finish_log(struct thread_data *, struct io_log *, const char *);
-extern int init_random_state(struct thread_data *);
 extern struct io_u *__get_io_u(struct thread_data *);
 extern void put_io_u(struct thread_data *, struct io_u *);
 
@@ -375,6 +371,9 @@ extern void init_disk_util(struct thread_data *);
 extern void update_rusage_stat(struct thread_data *);
 extern void update_io_ticks(void);
 extern void disk_util_timer_arm(void);
+extern void setup_log(struct io_log **);
+extern void finish_log(struct thread_data *, struct io_log *, const char *);
+extern int setup_rate(struct thread_data *);
 
 /*
  * Time functions
@@ -386,4 +385,10 @@ extern unsigned long time_since_now(struct timeval *);
 extern void usec_sleep(struct thread_data *, unsigned long);
 extern void rate_throttle(struct thread_data *, unsigned long, unsigned int);
 
+/*
+ * Init functions
+ */
+extern int parse_options(int, char **);
+extern int init_random_state(struct thread_data *);
+
 #endif
diff --git a/init.c b/init.c
index d259c998c39215c3e0914b5aa1a57829bd464f9f..4531254a65b9edb3784d13a8271ece3a7b6cf89e 100644 (file)
--- a/init.c
+++ b/init.c
@@ -55,55 +55,6 @@ int write_bw_log = 0;
 int exitall_on_terminate = 0;
 unsigned long long mlock_size = 0;
 
-static int setup_rate(struct thread_data *td)
-{
-       int nr_reads_per_sec;
-
-       if (!td->rate)
-               return 0;
-
-       if (td->rate < td->ratemin) {
-               fprintf(stderr, "min rate larger than nominal rate\n");
-               return -1;
-       }
-
-       nr_reads_per_sec = (td->rate * 1024) / td->min_bs;
-       td->rate_usec_cycle = 1000000 / nr_reads_per_sec;
-       td->rate_pending_usleep = 0;
-       return 0;
-}
-
-static void setup_log(struct io_log **log)
-{
-       struct io_log *l = malloc(sizeof(*l));
-
-       l->nr_samples = 0;
-       l->max_samples = 1024;
-       l->log = malloc(l->max_samples * sizeof(struct io_sample));
-       *log = l;
-}
-
-void finish_log(struct thread_data *td, struct io_log *log, const char *name)
-{
-       char file_name[256];
-       FILE *f;
-       unsigned int i;
-
-       snprintf(file_name, 200, "client%d_%s.log", td->thread_number, name);
-       f = fopen(file_name, "w");
-       if (!f) {
-               perror("fopen log");
-               return;
-       }
-
-       for (i = 0; i < log->nr_samples; i++)
-               fprintf(f, "%lu, %lu, %u\n", log->log[i].time, log->log[i].val, log->log[i].ddir);
-
-       fclose(f);
-       free(log->log);
-       free(log);
-}
-
 static struct thread_data *get_new_job(int global, struct thread_data *parent)
 {
        struct thread_data *td;
diff --git a/log.c b/log.c
index 42aedf270ff0882c56de0f13b78614f1c88bfff6..8d313ec65419ef926f560d762d88eb4996341379 100644 (file)
--- a/log.c
+++ b/log.c
@@ -160,3 +160,52 @@ int init_iolog(struct thread_data *td)
 
        return 0;
 }
+
+int setup_rate(struct thread_data *td)
+{
+       int nr_reads_per_sec;
+
+       if (!td->rate)
+               return 0;
+
+       if (td->rate < td->ratemin) {
+               fprintf(stderr, "min rate larger than nominal rate\n");
+               return -1;
+       }
+
+       nr_reads_per_sec = (td->rate * 1024) / td->min_bs;
+       td->rate_usec_cycle = 1000000 / nr_reads_per_sec;
+       td->rate_pending_usleep = 0;
+       return 0;
+}
+
+void setup_log(struct io_log **log)
+{
+       struct io_log *l = malloc(sizeof(*l));
+
+       l->nr_samples = 0;
+       l->max_samples = 1024;
+       l->log = malloc(l->max_samples * sizeof(struct io_sample));
+       *log = l;
+}
+
+void finish_log(struct thread_data *td, struct io_log *log, const char *name)
+{
+       char file_name[256];
+       FILE *f;
+       unsigned int i;
+
+       snprintf(file_name, 200, "client%d_%s.log", td->thread_number, name);
+       f = fopen(file_name, "w");
+       if (!f) {
+               perror("fopen log");
+               return;
+       }
+
+       for (i = 0; i < log->nr_samples; i++)
+               fprintf(f, "%lu, %lu, %u\n", log->log[i].time, log->log[i].val, log->log[i].ddir);
+
+       fclose(f);
+       free(log->log);
+       free(log);
+}