generator.cpp 916 B

1234567891011121314151617181920212223242526272829303132
  1. #include <iostream>
  2. #include <string>
  3. #include <ZLibrary.h>
  4. #include <ZLFile.h>
  5. #include <ZLOutputStream.h>
  6. #include <ZLStatistics.h>
  7. #include <ZLStatisticsGenerator.h>
  8. #include <ZLStatisticsXMLWriter.h>
  9. int main(int argc, char **argv) {
  10. if (argc == 1) {
  11. std::cerr << "usage:\n " << argv[0] << " <file name>\n";
  12. return 1;
  13. }
  14. ZLibrary::init(argc, argv);
  15. std::string outputFileName = argv[1];
  16. outputFileName += ".stat";
  17. shared_ptr<ZLOutputStream> stream = ZLFile(outputFileName).outputStream();
  18. ZLMapBasedStatistics s1,s2;
  19. ZLStatisticsGenerator("\n\r ").generate(argv[1], 2, s1); // Here are available to change char sequence length [second method arg]
  20. s2 = s1.top(500); // Here are available to change amount of top statistics items
  21. stream->open();
  22. ZLStatisticsXMLWriter(*stream).writeStatistics(s2);
  23. stream->close();
  24. ZLibrary::shutdown();
  25. return 0;
  26. }
  27. // vim: ts=4