예제 #1
0
int main( int argc, char * argv[])
{
    try
    {
        coro::flag_fpu_t preserve_fpu = coro::fpu_not_preserved;
        bind_to_processor( 0);

#ifdef BOOST_CONTEXT_CYCLE
        {
            cycle_t ov( overhead_cycles() );
            std::cout << "overhead for rdtsc == " << ov << " cycles" << std::endl;

            unsigned int res = test_cycles( ov, preserve_fpu);
            std::cout << "coroutine: average of " << res << " cycles per switch" << std::endl;
        }
#endif

#if _POSIX_C_SOURCE >= 199309L
        {
            zeit_t ov( overhead_zeit() );
            std::cout << "\noverhead for clock_gettime()  == " << ov << " ns" << std::endl;

            unsigned int res = test_zeit( ov, preserve_fpu);
            std::cout << "coroutine: average of " << res << " ns per switch" << std::endl;
        }
#endif

        return EXIT_SUCCESS;
    }
    catch ( std::exception const& e)
    { std::cerr << "exception: " << e.what() << std::endl; }
    catch (...)
    { std::cerr << "unhandled exception" << std::endl; }
    return EXIT_FAILURE;
}
예제 #2
0
파일: test_def.c 프로젝트: chenbk85/upb
int run_tests(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "Usage: test_def <test.proto.pb>\n");
    return 1;
  }
  descriptor_file = argv[1];
  test_empty_symtab();
  test_cycles();
  test_symbol_resolution();
  test_fielddef();
  test_fielddef_unref();
  test_replacement();
  test_freeze_free();
  test_partial_freeze();
  test_noreftracking();
  test_descriptor_flags();
  test_mapentry_check();
  test_oneofs();
  return 0;
}