mirror of
https://github.com/overte-org/overte.git
synced 2025-04-24 05:53:29 +02:00
Refactor startup timing a little by getting the current time the moment the application enters its main function, then passing that to Application's constructor. Also fix the titlebar bug by setting the title bar at the end of initializeGL() instead of at the end of the first frame (which would actually further the inaccuracy of the startup time).
This commit is contained in:
parent
a8c4e928b8
commit
fb553fce80
3 changed files with 43 additions and 41 deletions
|
@ -114,7 +114,7 @@ void GLCanvas::wheelEvent(QWheelEvent* event) {
|
|||
Application::getInstance()->wheelEvent(event);
|
||||
}
|
||||
|
||||
Application::Application(int& argc, char** argv) :
|
||||
Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||
QApplication(argc, argv),
|
||||
_window(new QMainWindow(desktop())),
|
||||
_glWidget(new GLCanvas()),
|
||||
|
@ -152,7 +152,7 @@ Application::Application(int& argc, char** argv) :
|
|||
_bytesPerSecond(0),
|
||||
_bytesCount(0)
|
||||
{
|
||||
gettimeofday(&_applicationStartupTime, NULL);
|
||||
_applicationStartupTime = startup_time;
|
||||
_window->setWindowTitle("Interface");
|
||||
printLog("Interface Startup:\n");
|
||||
|
||||
|
@ -268,6 +268,15 @@ void Application::initializeGL() {
|
|||
QTimer* idleTimer = new QTimer(this);
|
||||
connect(idleTimer, SIGNAL(timeout()), SLOT(idle()));
|
||||
idleTimer->start(0);
|
||||
|
||||
if (_justStarted) {
|
||||
float startupTime = (usecTimestampNow() - usecTimestamp(&_applicationStartupTime))/1000000.0;
|
||||
_justStarted = false;
|
||||
char title[50];
|
||||
sprintf(title, "Interface: %4.2f seconds\n", startupTime);
|
||||
printLog("%s", title);
|
||||
_window->setWindowTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::paintGL() {
|
||||
|
@ -403,16 +412,6 @@ void Application::paintGL() {
|
|||
|
||||
|
||||
_frameCount++;
|
||||
|
||||
// If application has just started, report time from startup to now (first frame display)
|
||||
if (_justStarted) {
|
||||
float startupTime = (usecTimestampNow() - usecTimestamp(&_applicationStartupTime))/1000000.0;
|
||||
_justStarted = false;
|
||||
char title[50];
|
||||
sprintf(title, "Interface: %4.2f seconds\n", startupTime);
|
||||
printLog("%s", title);
|
||||
_window->setWindowTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::resizeGL(int width, int height) {
|
||||
|
|
|
@ -46,7 +46,7 @@ class Application : public QApplication {
|
|||
public:
|
||||
static Application* getInstance() { return static_cast<Application*>(QCoreApplication::instance()); }
|
||||
|
||||
Application(int& argc, char** argv);
|
||||
Application(int& argc, char** argv, timeval &startup_time);
|
||||
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
//
|
||||
// Interface
|
||||
//
|
||||
// Allows you to connect to and see/hear the shared 3D space.
|
||||
// Optionally uses serialUSB connection to get gyro data for head movement.
|
||||
// Optionally gets UDP stream from transmitter to animate controller/hand.
|
||||
//
|
||||
// Usage: The interface client first attempts to contact a domain server to
|
||||
// discover the appropriate audio, voxel, and avatar servers to contact.
|
||||
// Right now, the default domain server is "highfidelity.below92.com"
|
||||
// You can change the domain server to use your own by editing the
|
||||
// DOMAIN_HOSTNAME or DOMAIN_IP strings in the file AgentList.cpp
|
||||
//
|
||||
//
|
||||
// Welcome Aboard!
|
||||
//
|
||||
|
||||
#include "Application.h"
|
||||
#include "Log.h"
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
|
||||
Application app(argc, const_cast<char**>(argv));
|
||||
printLog( "Created QT Application.\n" );
|
||||
int exitCode = app.exec();
|
||||
printLog("Normal exit.\n");
|
||||
return exitCode;
|
||||
}
|
||||
//
|
||||
// Interface
|
||||
//
|
||||
// Allows you to connect to and see/hear the shared 3D space.
|
||||
// Optionally uses serialUSB connection to get gyro data for head movement.
|
||||
// Optionally gets UDP stream from transmitter to animate controller/hand.
|
||||
//
|
||||
// Usage: The interface client first attempts to contact a domain server to
|
||||
// discover the appropriate audio, voxel, and avatar servers to contact.
|
||||
// Right now, the default domain server is "highfidelity.below92.com"
|
||||
// You can change the domain server to use your own by editing the
|
||||
// DOMAIN_HOSTNAME or DOMAIN_IP strings in the file AgentList.cpp
|
||||
//
|
||||
//
|
||||
// Welcome Aboard!
|
||||
//
|
||||
|
||||
#include "Application.h"
|
||||
#include "Log.h"
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
|
||||
timeval startup_time;
|
||||
gettimeofday(&startup_time, NULL);
|
||||
|
||||
Application app(argc, const_cast<char**>(argv), startup_time);
|
||||
printLog( "Created QT Application.\n" );
|
||||
int exitCode = app.exec();
|
||||
printLog("Normal exit.\n");
|
||||
return exitCode;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue