| 3 | import sys, getopt |
| 4 | |
| 5 | def printHelp(): |
| 6 | print \ |
| 7 | """ |
| 8 | Generates a configuration file to be used in benchmarking NanoLog |
| 9 | (./BenchmarkConfig.h). Note that invoking this file will also |
| 10 | overwrite the contents of ../runtime/Config.h to refer to the |
| 11 | variables in ./BenchmarkConfig.h. |
| 12 | |
| 13 | Usage: |
| 14 | python genConfig.py options |
| 15 | |
| 16 | Options: |
| 17 | --disableOutput Drops the log messages by piping the |
| 18 | results to /dev/null |
| 19 | --disableCompaction Entries will be memcpy'ed directly from |
| 20 | the StagingBuffer to the OutputBuffer. |
| 21 | The output produced will not be useable |
| 22 | by the NanoLog Decompressor |
| 23 | --discardEntriesAtStagingBuffer Drops messages after they've been placed |
| 24 | into the staging buffer by record() |
| 25 | --stagingBufferExp <exp> Specifies the size of the StagingBuffer |
| 26 | as 2^exp bytes (default 20) |
| 27 | --outputBufferExp <exp> Specifies the size of the OutputBuffer |
| 28 | as 2^exp bytes (default 26) |
| 29 | --releaseThresholdExp <exp> Specifies the release threshold as 2^exp |
| 30 | bytes (default 19) |
| 31 | --pollInterval <us> Amount of time (in us) that the NanoLog |
| 32 | should wake from sleep to check for work |
| 33 | (default 1) |
| 34 | |
| 35 | --threads <num> Number of producer threads (default 1). |
| 36 | Each thread will run iterations of benchOp |
| 37 | |
| 38 | --iterations <num> Number of iterations to run benchOp (below) |
| 39 | (default 100000000) |
| 40 | |
| 41 | --benchOp <Nano Log Code> C++ code to run <iteration> times |
| 42 | (default "NANO_LOG("Simple log message with 0 parameters");) |
| 43 | Note: variable int 'i' is accessible here |
| 44 | |
| 45 | --useSnappy Enable the logic to compress the NanoLog |
| 46 | output with snappy https://github.com/google/snappy |
| 47 | |
| 48 | Examples: |
| 49 | |
| 50 | python genConfig.py Generates a default configuration |
| 51 | |
| 52 | python genConfig.py --benchOp "NANO_LOG(\"Test\");" --iterations=100 |
| 53 | """ |
| 54 | |
| 55 | |
| 56 | |