MCPcopy Create free account
hub / github.com/PlatformLab/NanoLog / main

Function main

runtime/LogDecompressor.cc:152–325  ·  view source on GitHub ↗

* Simple program to decompress log files produced by the NanoLog System. * Note that this executable must be compiled with the same BufferStuffer.h * as the LogCompressor that generated the compressedLog for this to work. */

Source from the content-addressed store, hash-verified

150 * as the LogCompressor that generated the compressedLog for this to work.
151 */
152int main(int argc, char** argv) {
153 if (argc < 3) {
154 printHelp(argv[0]);
155 exit(1);
156 }
157
158 const char *command = argv[1];
159 const char *logFileName = argv[2];
160 bool find = false;
161 bool sorted = false;
162 bool doRCDF = false;
163 FILE *outputFd = NULL;
164 int filterId = -1;
165
166 if (strcmp(command, "decompress") == 0) {
167 outputFd = stdout;
168 sorted = true;
169 } else if (strcmp(command, "decompressUnordered") == 0) {
170 outputFd = stdout;
171 } else if (strcmp(command, "rcdfTime") == 0) {
172 doRCDF = true;
173 } else if (strcmp(command, "minMaxMean") == 0) {
174 if (argc < 4) {
175 printHelp(argv[0]);
176 exit(1);
177 }
178
179 try {
180 filterId = std::stoi(argv[3]);
181 } catch (const std::invalid_argument& e) {
182 printf("Invalid logId, please enter a number: %s\r\n", argv[3]);
183 exit(-1);
184 } catch (const std::out_of_range& e) {
185 printf("The logId is too large: %s\r\n", argv[3]);
186 exit(-1);
187 }
188
189 if (filterId < 0) {
190 printf("The logId must be positive: %s\r\n", argv[3]);
191 exit(-1);
192 }
193 } else if (strcmp(command, "find") == 0) {
194 if (argc < 4) {
195 printHelp(argv[0]);
196 exit(1);
197 }
198
199 find = true;
200 } else {
201 printHelp(argv[0]);
202 exit(1);
203 }
204
205 Decoder decoder;
206 if(!decoder.open(logFileName)) {
207 printf("Unable to open file %s\r\n", logFileName);
208 exit(1);
209 }

Callers

nothing calls this directly

Calls 10

rdtscFunction · 0.85
runRCDFFunction · 0.85
openMethod · 0.80
reserveMethod · 0.80
getNextLogStatementMethod · 0.80
getTimestampMethod · 0.80
decompressToMethod · 0.80
getLogIdMethod · 0.80
printHelpFunction · 0.70

Tested by

no test coverage detected