void Badger::Engine::run() { SDL_Event event; Clock* clock = new Clock(); while(true) { if (SDL_PollEvent(&event)) { if(event.type == SDL_QUIT) { break; } _fireEvent(&event); } // Get the time since the last draw/update double elapsed = clock->elapsedTime(); // Update the world _world->update(elapsed); // Draw the world _draw(); // Display SDL_GL_SwapBuffers(); } // Uninitialize the joystick //joystick = SDL_JoystickOpen(0); // Destruct SDL SDL_Quit(); }
void benchmarkSendUnavailablePresence() { Clock clk; std::vector<std::string> lst; for (int i = 0; i < 1000; i++) { pbnetwork::Buddy buddy; buddy.set_username("user@localhost"); buddy.set_buddyname("buddy" + boost::lexical_cast<std::string>(i) + "@test"); buddy.set_status((pbnetwork::StatusType) 5); std::string message; buddy.SerializeToString(&message); lst.push_back(message); } std::vector<std::string> lst2; for (int i = 0; i < 1000; i++) { pbnetwork::Buddy buddy; buddy.set_username("user@localhost"); buddy.set_buddyname("buddy" + boost::lexical_cast<std::string>(1000+i) + "@test"); buddy.set_status((pbnetwork::StatusType) 2); std::string message; buddy.SerializeToString(&message); lst2.push_back(message); } for (int i = 0; i < 1000; i++) { serv->handleBuddyChangedPayload(lst[i]); received.clear(); } for (int i = 0; i < 1000; i++) { serv->handleBuddyChangedPayload(lst2[i]); received.clear(); } User *user = userManager->getUser("user@localhost"); clk.start(); user->getRosterManager()->sendUnavailablePresences("user@localhost"); clk.end(); std::cerr << " " << clk.elapsedTime() << " s"; }