Added a startup timer

This commit is contained in:
Philip Rosedale 2013-04-11 00:11:31 -07:00
parent 81c4186179
commit 407da2aea8
2 changed files with 13 additions and 2 deletions

View file

@ -196,6 +196,9 @@ float FPS = 120.f;
timeval timerStart, timerEnd; timeval timerStart, timerEnd;
timeval lastTimeIdle; timeval lastTimeIdle;
double elapsedTime; double elapsedTime;
timeval applicationStartupTime;
bool justStarted = true;
#ifdef MARKER_CAPTURE #ifdef MARKER_CAPTURE
@ -783,7 +786,7 @@ void display(void)
float sphereRadius = 0.25f; float sphereRadius = 0.25f;
glColor3f(1,0,0); glColor3f(1,0,0);
glPushMatrix(); glPushMatrix();
glTranslatef( 0.0f, sphereRadius, 0.0f ); //glTranslatef( 0.0f, sphereRadius, 0.0f );
glutSolidSphere( sphereRadius, 15, 15 ); glutSolidSphere( sphereRadius, 15, 15 );
glPopMatrix(); glPopMatrix();
@ -915,6 +918,13 @@ void display(void)
glutSwapBuffers(); glutSwapBuffers();
frameCount++; frameCount++;
// If application has just started, report time from startup to now (first frame display)
if (justStarted) {
printf("Startup Time: %4.2f\n",
(usecTimestampNow() - usecTimestamp(&applicationStartupTime))/1000000.0);
justStarted = false;
}
} }
int setValue(int state, int *value) { int setValue(int state, int *value) {
@ -1349,6 +1359,7 @@ void audioMixerUpdate(in_addr_t newMixerAddress, in_port_t newMixerPort) {
int main(int argc, const char * argv[]) int main(int argc, const char * argv[])
{ {
gettimeofday(&applicationStartupTime, NULL);
const char* domainIP = getCmdOption(argc, argv, "--domain"); const char* domainIP = getCmdOption(argc, argv, "--domain");
if (domainIP) { if (domainIP) {
strcpy(DOMAIN_IP,domainIP); strcpy(DOMAIN_IP,domainIP);

View file

@ -327,7 +327,7 @@ void *checkInWithDomainServer(void *args) {
sockaddr_in tempAddress; sockaddr_in tempAddress;
memcpy(&tempAddress.sin_addr, pHostInfo->h_addr_list[0], pHostInfo->h_length); memcpy(&tempAddress.sin_addr, pHostInfo->h_addr_list[0], pHostInfo->h_length);
strcpy(DOMAIN_IP, inet_ntoa(tempAddress.sin_addr)); strcpy(DOMAIN_IP, inet_ntoa(tempAddress.sin_addr));
printf("Domain server %s: \n", DOMAIN_HOSTNAME); printf("Domain server: %s \n", DOMAIN_HOSTNAME);
} else { } else {
printf("Failed lookup domainserver\n"); printf("Failed lookup domainserver\n");