| 84 | |
| 85 | |
| 86 | void main( int argc, char **argv) |
| 87 | { |
| 88 | /************************************** |
| 89 | * |
| 90 | * m a i n |
| 91 | * |
| 92 | ************************************** |
| 93 | * |
| 94 | * Functional description |
| 95 | * Replay all I/O to compute overhead of I/O system. |
| 96 | * |
| 97 | **************************************/ |
| 98 | |
| 99 | bool detail = true; |
| 100 | |
| 101 | char** end; |
| 102 | for (end = argv + argc, ++argv; argv < end; argv++) |
| 103 | { |
| 104 | const char* s = *argv; |
| 105 | if (*s++ == '-') |
| 106 | { |
| 107 | if (UPPER(*s) == 'S') |
| 108 | detail = false; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | SLONG reads = 0, writes = 0; |
| 113 | trace = os_utils::fopen("trace.log", "r"); |
| 114 | page_size = 1024; |
| 115 | SLONG sequence = 0; |
| 116 | |
| 117 | struct tms before; |
| 118 | time_t elapsed = times(&before); |
| 119 | |
| 120 | SCHAR string[128] = ""; |
| 121 | |
| 122 | const pag* page; |
| 123 | SSHORT event; |
| 124 | while ((event = getc(trace)) != trace_close && event != EOF) |
| 125 | { |
| 126 | switch (event) |
| 127 | { |
| 128 | case trace_open: |
| 129 | { |
| 130 | const SLONG length = getc(trace); |
| 131 | SLONG n = length; |
| 132 | SCHAR* p = string; |
| 133 | while (--n >= 0) |
| 134 | *p++ = getc(trace); |
| 135 | *p = 0; |
| 136 | db_open(string, length); |
| 137 | } |
| 138 | break; |
| 139 | |
| 140 | case trace_page_size: |
| 141 | page_size = get_long(); |
| 142 | if (global_buffer) |
| 143 | free(global_buffer); |