ContainerTracer  0.1
Data Structures | Macros | Functions | Variables
trace_replay.c File Reference
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <jemalloc/jemalloc.h>
#include <pthread.h>
#include <libaio.h>
#include <errno.h>
#include <signal.h>
#include <float.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/shm.h>
#include <sys/sem.h>
#include <flist.h>
#include <trace_replay.h>
#include <disk_io.h>
Include dependency graph for trace_replay.c:

Data Structures

struct  simple_bio
 

Macros

#define REFRESH_SLEEP   1000000
 
#define RND(x)   ((x > 0) ? (genrand() % (x)) : 0)
 
#define ARG_QDEPTH   1
 
#define ARG_THREAD   2
 
#define ARG_OUTPUT   3
 
#define ARG_TIMEOUT   4
 
#define ARG_REPEAT   5
 
#define ARG_DEV   6
 
#define ARG_TRACE   7
 
#define EXT_ARG_NUM   4
 
#define N   624
 
#define M   397
 
#define MATRIX_A   0x9908b0df /* constant vector a */
 
#define UPPER_MASK   0x80000000 /* most significant w-r bits */
 
#define LOWER_MASK   0x7fffffff /* least significant r bits */
 
#define TEMPERING_MASK_B   0x9d2c5680
 
#define TEMPERING_MASK_C   0xefc60000
 
#define TEMPERING_SHIFT_U(y)   (y >> 11)
 
#define TEMPERING_SHIFT_S(y)   (y << 7)
 
#define TEMPERING_SHIFT_T(y)   (y << 15)
 
#define TEMPERING_SHIFT_L(y)   (y >> 18)
 

Functions

void sgenrand (unsigned long seed)
 
unsigned long genrand ()
 
int timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y)
 
static double time_since_ms (struct timeval *start_tv, struct timeval *stop_tv)
 
static double time_since (struct timeval *start_tv, struct timeval *stop_tv)
 
void * allocate_aligned_buffer (size_t size)
 
void align_sector (struct thread_info_t *t_info, int *blkno, int *bcount)
 
void update_iostat (struct thread_info_t *t_info, struct io_job *job)
 
void trace_reset (struct trace_info_t *trace)
 
int trace_set_eof (struct trace_info_t *trace)
 
int trace_eof (struct trace_info_t *trace)
 
int try_trace_reset (struct trace_info_t *trace, struct io_stat_t *io_stat)
 
int trace_io_get (double *arrival_time, int *devno, int *blkno, int *bcount, int *flags, struct trace_info_t *trace, struct io_stat_t *io_stat)
 
static void io_done (io_context_t ctx, struct iocb *iocb, long res, long res2)
 
int make_jobs (struct thread_info_t *t_info, struct iocb **ioq, struct io_job **jobq, int depth)
 
void wait_arrive (struct thread_info_t *t_info)
 
void wait_completion (struct thread_info_t *t_info, int cnt)
 
void * sub_worker (void *threadid)
 
void print_result (int nr_trace, int nr_thread, FILE *fp, int detail)
 
void usage_help ()
 
int remove_lastchars (FILE *fp, int len)
 
void finalize ()
 
int trace_io_put (char *line, struct trace_info_t *trace, int qdepth)
 
void main_worker ()
 
void synthetic_mix (struct trace_info_t *trace)
 
void synthetic_gen (struct trace_info_t *trace)
 
void destroy (pthread_t *threads, int qdepth)
 
void sig_handler (int signum)
 
void * trace_loader (void *data)
 
int main (int argc, char **argv)
 

Variables

FILE * log_fp
 
FILE * json_fp
 
unsigned int log_count = 0
 
struct thread_info_t th_info [MAX_THREADS]
 
struct trace_info_t traces [MAX_THREADS]
 
struct total_results total_results
 
pthread_t threads [MAX_THREADS]
 
int qdepth
 
int cnt = 0
 
int cnt2 = 0
 
int nr_thread
 
int nr_trace
 
unsigned int io_size
 
struct timeval tv_start tv_end tv_result tv_start2
 
double execution_time = 0.0
 
double timeout
 
long long wanted_io_count
 
char key_pathname [BASE_KEY_PATHNAME_LEN]
 
static unsigned long mt [N]
 
static int mti = N + 1
 

Macro Definition Documentation

◆ ARG_DEV

#define ARG_DEV   6

◆ ARG_OUTPUT

#define ARG_OUTPUT   3

◆ ARG_QDEPTH

#define ARG_QDEPTH   1

◆ ARG_REPEAT

#define ARG_REPEAT   5

◆ ARG_THREAD

#define ARG_THREAD   2

◆ ARG_TIMEOUT

#define ARG_TIMEOUT   4

◆ ARG_TRACE

#define ARG_TRACE   7

◆ EXT_ARG_NUM

#define EXT_ARG_NUM   4

◆ LOWER_MASK

#define LOWER_MASK   0x7fffffff /* least significant r bits */

◆ M

#define M   397

◆ MATRIX_A

#define MATRIX_A   0x9908b0df /* constant vector a */

◆ N

#define N   624

◆ REFRESH_SLEEP

#define REFRESH_SLEEP   1000000

◆ RND

#define RND (   x)    ((x > 0) ? (genrand() % (x)) : 0)

◆ TEMPERING_MASK_B

#define TEMPERING_MASK_B   0x9d2c5680

◆ TEMPERING_MASK_C

#define TEMPERING_MASK_C   0xefc60000

◆ TEMPERING_SHIFT_L

#define TEMPERING_SHIFT_L (   y)    (y >> 18)

◆ TEMPERING_SHIFT_S

#define TEMPERING_SHIFT_S (   y)    (y << 7)

◆ TEMPERING_SHIFT_T

#define TEMPERING_SHIFT_T (   y)    (y << 15)

◆ TEMPERING_SHIFT_U

#define TEMPERING_SHIFT_U (   y)    (y >> 11)

◆ UPPER_MASK

#define UPPER_MASK   0x80000000 /* most significant w-r bits */

Function Documentation

◆ align_sector()

void align_sector ( struct thread_info_t t_info,
int *  blkno,
int *  bcount 
)

◆ allocate_aligned_buffer()

void* allocate_aligned_buffer ( size_t  size)

◆ destroy()

void destroy ( pthread_t *  threads,
int  qdepth 
)
Here is the call graph for this function:

◆ finalize()

void finalize ( )
Here is the call graph for this function:

◆ genrand()

unsigned long genrand ( )
Here is the call graph for this function:

◆ io_done()

static void io_done ( io_context_t  ctx,
struct iocb *  iocb,
long  res,
long  res2 
)
static

◆ main()

int main ( int  argc,
char **  argv 
)
Here is the call graph for this function:

◆ main_worker()

void main_worker ( )
Here is the call graph for this function:

◆ make_jobs()

int make_jobs ( struct thread_info_t t_info,
struct iocb **  ioq,
struct io_job **  jobq,
int  depth 
)
Here is the call graph for this function:

◆ print_result()

void print_result ( int  nr_trace,
int  nr_thread,
FILE *  fp,
int  detail 
)
Here is the call graph for this function:

◆ remove_lastchars()

int remove_lastchars ( FILE *  fp,
int  len 
)

◆ sgenrand()

void sgenrand ( unsigned long  seed)

◆ sig_handler()

void sig_handler ( int  signum)
Here is the call graph for this function:

◆ sub_worker()

void* sub_worker ( void *  threadid)
Here is the call graph for this function:

◆ synthetic_gen()

void synthetic_gen ( struct trace_info_t trace)
Here is the call graph for this function:

◆ synthetic_mix()

void synthetic_mix ( struct trace_info_t trace)
Here is the call graph for this function:

◆ time_since()

static double time_since ( struct timeval *  start_tv,
struct timeval *  stop_tv 
)
static

◆ time_since_ms()

static double time_since_ms ( struct timeval *  start_tv,
struct timeval *  stop_tv 
)
static

◆ timeval_subtract()

int timeval_subtract ( struct timeval *  result,
struct timeval *  x,
struct timeval *  y 
)

◆ trace_eof()

int trace_eof ( struct trace_info_t trace)

◆ trace_io_get()

int trace_io_get ( double *  arrival_time,
int *  devno,
int *  blkno,
int *  bcount,
int *  flags,
struct trace_info_t trace,
struct io_stat_t io_stat 
)
Here is the call graph for this function:

◆ trace_io_put()

int trace_io_put ( char *  line,
struct trace_info_t trace,
int  qdepth 
)

◆ trace_loader()

void* trace_loader ( void *  data)
Here is the call graph for this function:

◆ trace_reset()

void trace_reset ( struct trace_info_t trace)

◆ trace_set_eof()

int trace_set_eof ( struct trace_info_t trace)

◆ try_trace_reset()

int try_trace_reset ( struct trace_info_t trace,
struct io_stat_t io_stat 
)
Here is the call graph for this function:

◆ update_iostat()

void update_iostat ( struct thread_info_t t_info,
struct io_job job 
)
Here is the call graph for this function:

◆ usage_help()

void usage_help ( )

◆ wait_arrive()

void wait_arrive ( struct thread_info_t t_info)
Here is the call graph for this function:

◆ wait_completion()

void wait_completion ( struct thread_info_t t_info,
int  cnt 
)
Here is the call graph for this function:

Variable Documentation

◆ cnt

int cnt = 0

◆ cnt2

int cnt2 = 0

◆ execution_time

double execution_time = 0.0

◆ io_size

unsigned int io_size

◆ json_fp

FILE* json_fp

◆ key_pathname

char key_pathname[BASE_KEY_PATHNAME_LEN]

◆ log_count

unsigned int log_count = 0

◆ log_fp

FILE* log_fp

◆ mt

unsigned long mt[N]
static

◆ mti

int mti = N + 1
static

◆ nr_thread

int nr_thread

◆ nr_trace

int nr_trace

◆ qdepth

int qdepth

◆ th_info

struct thread_info_t th_info[MAX_THREADS]

◆ threads

pthread_t threads[MAX_THREADS]

◆ timeout

double timeout

◆ total_results

◆ traces

struct trace_info_t traces[MAX_THREADS]

◆ tv_start2

struct timeval tv_start tv_end tv_result tv_start2

◆ wanted_io_count

long long wanted_io_count