main.cc 900 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Performance/main.cc - C++ performance harness entry point
  2. //
  3. // Copyright (c) 2014 - 2016 Apple Inc. and the project authors
  4. // Licensed under Apache License v2.0 with Runtime Library Exception
  5. //
  6. // See LICENSE.txt for license information:
  7. // https://github.com/apple/swift-protobuf/blob/main/LICENSE.txt
  8. //
  9. // -----------------------------------------------------------------------------
  10. ///
  11. /// Entry point for the C++ performance harness.
  12. ///
  13. // -----------------------------------------------------------------------------
  14. #include <fstream>
  15. #include "Harness.h"
  16. using std::ios_base;
  17. using std::ofstream;
  18. int main(int argc, char **argv) {
  19. ofstream* results_stream = (argc > 1) ?
  20. new ofstream(argv[1], ios_base::app) : nullptr;
  21. Harness harness(results_stream);
  22. harness.run();
  23. if (results_stream) {
  24. results_stream->close();
  25. delete results_stream;
  26. }
  27. return 0;
  28. }