il2cpp-benchmark-support.cpp 668 B

12345678910111213141516171819202122232425
  1. #if IL2CPP_GOOGLE_BENCHMARK
  2. #include "il2cpp-config.h"
  3. #include "utils/StringUtils.h"
  4. #include <benchmark/benchmark.h>
  5. void il2cpp_benchmark_initialize(int argc, const Il2CppChar* const* argv)
  6. {
  7. std::vector<std::string> args(argc);
  8. for (int i = 0; i < argc; ++i)
  9. args[i] = il2cpp::utils::StringUtils::Utf16ToUtf8(argv[i], -1);
  10. std::vector<const char*> cargs(argc);
  11. for (int i = 0; i < argc; ++i)
  12. cargs[i] = args[i].c_str();
  13. benchmark::Initialize(&argc, const_cast<char**>(&cargs[0]));
  14. }
  15. void il2cpp_benchmark_initialize(int argc, const char* const* argv)
  16. {
  17. benchmark::Initialize(&argc, const_cast<char**>(argv));
  18. }
  19. #endif