-
Notifications
You must be signed in to change notification settings - Fork 0
/
replay.h
88 lines (76 loc) · 2.36 KB
/
replay.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef _REPLAY_H
#define _REPLAY_H
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <aio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/fs.h>
#include <errno.h>
#include <pthread.h>
//#include <signal.h>
//#include <sys/types.h>
//#include <sys/stat.h>
#define SUCCESS 1
#define FAILURE 0
#define BUFSIZE 300
#define RAMSIZE 60 //MB
#define MEM_ALIGN 512 // Memory alignment
#define USE_GLOBAL_BUFF 1
#define AIO_THREAD_POOL_SIZE 50
#define BYTE_PER_BLOCK 512 //blk size (bits)
#define LARGEST_REQUEST_SIZE 1024*2 //1MB Largest request size (blks)
#define BLOCK_PER_DRIVE (long long)8*1024*1024*1024*2 //8TB Drive capacity (blks)
struct config_info{
char device[64];
char traceFileName[64];
char logFileName[64];
};
struct req_info{
double time;
long long lba;
unsigned int size;
unsigned int type;
struct req_info *next;
};
struct trace_info{
unsigned int inNum;
unsigned int outNum;
long long latencySum;
FILE *logFile;
struct req_info *front;
struct req_info *rear;
};
struct aiocb_info{
struct aiocb* aiocb;
///* The order of these fields is implementation-dependent */
//int aio_fildes; /* File descriptor */
//off_t aio_offset; /* File offset */
//volatile void *aio_buf; /* Location of buffer */
//size_t aio_nbytes; /* Length of transfer */
//int aio_reqprio; /* Request priority */
//struct sigevent aio_sigevent; /* Notification method */
//int aio_lio_opcode; /* Operation to be performed;lio_listio() only */
//
struct req_info* req;
long long beginTime;
struct trace_info *trace;
};
//replay.c
void replay(char *configName);
void config_read(struct config_info *config,const char *filename);
void trace_read(struct config_info *config,struct trace_info *trace);
long long time_now();
long long time_elapsed(long long begin);
static void handle_aio(sigval_t sigval);
static void submit_aio(int fd, void *buf,struct req_info *req,struct trace_info *trace);
static void init_aio();
//queue.c
void queue_push(struct trace_info *trace,struct req_info *req);
void queue_pop(struct trace_info *trace,struct req_info *req);
void queue_print(struct trace_info *trace);
#endif