| 194 | """ |
| 195 | |
| 196 | def main(argv): |
| 197 | |
| 198 | disableCompaction = "false" |
| 199 | outputFile = "/tmp/logFile" |
| 200 | stagingBufferExp = 20 |
| 201 | outputBufferExp = 26 |
| 202 | releaseThreshExp = 19 |
| 203 | pollInterval = 1 |
| 204 | iterations = 100000000 |
| 205 | benchOp = "NANO_LOG(NOTICE, \"Simple log message with 0 parameters\");" |
| 206 | threads = 1 |
| 207 | extraDefines = "" |
| 208 | |
| 209 | |
| 210 | try: |
| 211 | opts, args = getopt.getopt(argv,"hs:o:r:p:i:t:b:",["disableOutput", "disableCompaction", "discardEntriesAtStagingBuffer", "stagingBufferExp=","outputBufferExp=", "releaseThresholdExp=", "pollInterval=", "threads=", "iterations=","benchOp=","useSnappy"]) |
| 212 | except getopt.GetoptError: |
| 213 | printHelp() |
| 214 | sys.exit(2) |
| 215 | for opt, arg in opts: |
| 216 | if opt == '-h': |
| 217 | printHelp() |
| 218 | sys.exit() |
| 219 | elif opt in ("--disableOutput"): |
| 220 | outputFile = "/dev/null" |
| 221 | elif opt in ("--disableCompaction"): |
| 222 | disableCompaction = "true" |
| 223 | elif opt in ("-s", "--stagingBufferExp"): |
| 224 | stagingBufferExp = int(arg) |
| 225 | elif opt in ("-o", "--outputBufferExp"): |
| 226 | outputBufferExp = int(arg) |
| 227 | elif opt in ("-r", "--releaseThresholdExp"): |
| 228 | releaseThreshExp = int(arg) |
| 229 | elif opt in ("-p", "--pollInterval"): |
| 230 | pollInterval = int(arg) |
| 231 | elif opt in ("-t", "--threads"): |
| 232 | threads = int(arg) |
| 233 | elif opt in ("-i", "--iterations"): |
| 234 | iterations = int(arg) |
| 235 | elif opt in ("-b", "--benchOp"): |
| 236 | benchOp = str(arg) |
| 237 | elif opt in ("--useSnappy"): |
| 238 | extraDefines += "\r\n#define USE_SNAPPY" |
| 239 | elif opt in ("--discardEntriesAtStagingBuffer"): |
| 240 | extraDefines += "\r\n#define BENCHMARK_DISCARD_ENTRIES_AT_STAGINGBUFFER" |
| 241 | |
| 242 | with open('BenchmarkConfig.h', 'w') as oFile: |
| 243 | benchOpStr = benchOp.replace('"', "'") |
| 244 | oFile.write(clientConfigTemplate % (outputFile, disableCompaction, stagingBufferExp, outputBufferExp, releaseThreshExp, pollInterval, pollInterval, threads, iterations, benchOp, benchOpStr, extraDefines)) |
| 245 | |
| 246 | with open('../runtime/Config.h', 'w') as oFile: |
| 247 | oFile.write(libraryConfigTemplate) |
| 248 | print """ |
| 249 | *********** |
| 250 | * WARNING * |
| 251 | *********** |
| 252 | """ |
| 253 | print "\"../runtime/Config.h\" has been modified to support " \ |