diff options
author | tradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164> | 2002-01-04 16:18:17 +0000 |
---|---|---|
committer | tradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164> | 2002-01-04 16:18:17 +0000 |
commit | c51ca28d5f4c00dac08ea97b2de0cfdab1fbdf7b (patch) | |
tree | abc5c0aa78e00b2d6e41ebfd5924d8f75f8048da | |
parent | bf0001377ee0765926ae1848ccab76f5cdb5608a (diff) |
Don't print estimated times per iteration / to completion at iteration 0
to avoid division by zero.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@146 1faa4e14-9dd3-4be0-9f0e-ffe519881164
-rw-r--r-- | src/Content.c | 182 |
1 files changed, 90 insertions, 92 deletions
diff --git a/src/Content.c b/src/Content.c index 896c25e..825d634 100644 --- a/src/Content.c +++ b/src/Content.c @@ -3,12 +3,12 @@ @date Wed Sep 13 23:47:43 2000 @author Tom Goodale @desc - The actual content of the web pages. - Note that this need not be in this thorn, since - it should just use the interface defined in http_Request.h - and should never touch the internals. + The actual content of the web pages. + Note that this need not be in this thorn, since + it should just use the interface defined in http_Request.h + and should never touch the internals. @enddesc - @version $Header$ + @version $Id$ @@*/ #include "cctk.h" @@ -348,8 +348,8 @@ static int MainPage(const cGH *cctkGH, httpRequest *request, void *data) { if (CCTK_IsThornActive(thorns[i])) { - sprintf(menu,"%s<DT><A HREF=\"/Thorns/%s/\">%s</A>\n", - menu, thorns[i], thorns[i]); + sprintf(menu,"%s<DT><A HREF=\"/Thorns/%s/\">%s</A>\n", + menu, thorns[i], thorns[i]); } } free(thorns); @@ -359,8 +359,8 @@ static int MainPage(const cGH *cctkGH, httpRequest *request, void *data) HTTP_Write(request, message, strlen(message)); strcpy(message,"<CENTER>\n" - "<IMG SRC=\"/Images/wwwcactuscodeorg.jpg\"" - " ALT=\"Cactus\" BORDER=0></CENTER>\n"); + "<IMG SRC=\"/Images/wwwcactuscodeorg.jpg\"" + " ALT=\"Cactus\" BORDER=0></CENTER>\n"); HTTP_Write(request, message, strlen(message)); @@ -368,31 +368,31 @@ static int MainPage(const cGH *cctkGH, httpRequest *request, void *data) /* Some blurb */ sprintf(message, "<br>" - "<CENTER>\n" - "<TABLE WIDTH=60%%>\n" - "<TR>\n" - "<TD ALIGN=CENTER>\n" - "<H2>%s</H2>\n" - "<P>This browser is connected to a Cactus simulation which " - "contains a web server thorn. This thorn provides information " - " and control for the simulation.</P>\n" - "<TABLE CELLPADDING=15>\n" - "<TR>\n" - "<TD ALIGN=CENTER BGCOLOR=#E5FFA2>\n" - "<P><B>Before controlling any features of the simulation, users " - "must <A HREF=\"/control.html\">authenticate</A>.</B></P>\n" - "</TD></TR></TABLE>\n" - "</TD>\n" - "</TR>\n" - "</TABLE>\n",title); + "<CENTER>\n" + "<TABLE WIDTH=60%%>\n" + "<TR>\n" + "<TD ALIGN=CENTER>\n" + "<H2>%s</H2>\n" + "<P>This browser is connected to a Cactus simulation which " + "contains a web server thorn. This thorn provides information " + " and control for the simulation.</P>\n" + "<TABLE CELLPADDING=15>\n" + "<TR>\n" + "<TD ALIGN=CENTER BGCOLOR=#E5FFA2>\n" + "<P><B>Before controlling any features of the simulation, users " + "must <A HREF=\"/control.html\">authenticate</A>.</B></P>\n" + "</TD></TR></TABLE>\n" + "</TD>\n" + "</TR>\n" + "</TABLE>\n",title); HTTP_Write(request, message, strlen(message)); strcpy(message, - "<CENTER>\n" - "<TABLE CELLPADDING=10>\n" - "<TR>\n" - "<TD VALIGN=TOP>\n"); + "<CENTER>\n" + "<TABLE CELLPADDING=10>\n" + "<TR>\n" + "<TD VALIGN=TOP>\n"); HTTP_Write(request, message, strlen(message)); /* AVAILABLE OPTIONS */ @@ -416,20 +416,20 @@ static int MainPage(const cGH *cctkGH, httpRequest *request, void *data) } strcpy(message, - "</TD>\n" - "<TD VALIGN=TOP>\n"); + "</TD>\n" + "<TD VALIGN=TOP>\n"); HTTP_Write(request, message, strlen(message)); /* CONFIGURATION DETAILS */ sprintf(message, - "<h3>Simulation:</h3>\n" - "<ul>\n" - "<li>Flesh version <FONT COLOR=RED> %s</FONT></li>\n" - "<li>Code compiled on <FONT COLOR=RED>"__DATE__ "</FONT>" - " at <FONT COLOR=RED>"__TIME__"</font></li>\n", - CCTK_FullVersion()); + "<h3>Simulation:</h3>\n" + "<ul>\n" + "<li>Flesh version <FONT COLOR=RED> %s</FONT></li>\n" + "<li>Code compiled on <FONT COLOR=RED>"__DATE__ "</FONT>" + " at <FONT COLOR=RED>"__TIME__"</font></li>\n", + CCTK_FullVersion()); HTTP_Write(request, message, strlen(message)); @@ -453,42 +453,42 @@ static int MainPage(const cGH *cctkGH, httpRequest *request, void *data) if (millenia) { sprintf(message, - "%s <li><font color=red>%d</font> millenia\n",message,millenia); + "%s <li><font color=red>%d</font> millenia\n",message,millenia); } if (years) { sprintf(message, - "%s <li><font color=red>%d</font> years\n",message,years); + "%s <li><font color=red>%d</font> years\n",message,years); } if (months) { sprintf(message, - "%s <li><font color=red>%d</font> months\n",message,months); + "%s <li><font color=red>%d</font> months\n",message,months); } if (weeks) { sprintf(message, - "%s <li><font color=red>%d</font> weeks\n",message,weeks); + "%s <li><font color=red>%d</font> weeks\n",message,weeks); } if (days) { sprintf(message, - "%s <li><font color=red>%d</font> days\n",message,days); + "%s <li><font color=red>%d</font> days\n",message,days); } if (hours) { sprintf(message, - "%s <li><font color=red>%d</font> hours\n",message,hours); + "%s <li><font color=red>%d</font> hours\n",message,hours); } if (minutes) { sprintf(message, - "%s <li><font color=red>%d</font> minutes\n",message,minutes); + "%s <li><font color=red>%d</font> minutes\n",message,minutes); } if (seconds) { sprintf(message, - "%s <li><font color=red>%d</font> seconds\n",message,seconds); + "%s <li><font color=red>%d</font> seconds\n",message,seconds); } strcat(message,"</ul><li> Parameter filename <font color=red>"); @@ -501,12 +501,11 @@ static int MainPage(const cGH *cctkGH, httpRequest *request, void *data) strcpy(message,"</font>\n"); HTTP_Write(request, message, strlen(message)); - if (cctkGH) + if (cctkGH && cctkGH->cctk_iteration) { - strcpy(message,"<li>Estimated time per iteration:<UL> "); sprintf(message,"%s <LI><font color=red>%f</font> seconds</UL>", - message,CCTK_RunTime()/(double)cctkGH->cctk_iteration); + message,CCTK_RunTime()/(double)cctkGH->cctk_iteration); HTTP_Write(request, message, strlen(message)); strcpy(message,"<li>Estimated time to completion:<UL> "); @@ -514,12 +513,12 @@ static int MainPage(const cGH *cctkGH, httpRequest *request, void *data) if (cctk_final_time<cctk_initial_time) { seconds = (cctk_itlast-cctkGH->cctk_iteration)*CCTK_RunTime()/ - cctkGH->cctk_iteration; + cctkGH->cctk_iteration; } else { seconds = (cctk_final_time-cctkGH->cctk_time)/cctkGH->cctk_delta_time* - CCTK_RunTime()/cctkGH->cctk_iteration; + CCTK_RunTime()/cctkGH->cctk_iteration; } minutes = seconds/60; @@ -541,70 +540,69 @@ static int MainPage(const cGH *cctkGH, httpRequest *request, void *data) if (millenia) { sprintf(message, - "%s <li><font color=red>%d</font> millenia\n",message,millenia); + "%s <li><font color=red>%d</font> millenia\n",message,millenia); } if (years) { sprintf(message, - "%s <li><font color=red>%d</font> years\n",message,years); + "%s <li><font color=red>%d</font> years\n",message,years); } if (months) { sprintf(message, - "%s <li><font color=red>%d</font> months\n",message,months); + "%s <li><font color=red>%d</font> months\n",message,months); } if (weeks) { sprintf(message, - "%s <li><font color=red>%d</font> weeks\n",message,weeks); + "%s <li><font color=red>%d</font> weeks\n",message,weeks); } if (days) { sprintf(message, - "%s <li><font color=red>%d</font> days\n",message,days); + "%s <li><font color=red>%d</font> days\n",message,days); } if (hours) { sprintf(message, - "%s <li><font color=red>%d</font> hours\n",message,hours); + "%s <li><font color=red>%d</font> hours\n",message,hours); } if (minutes) { sprintf(message, - "%s <li><font color=red>%d</font> minutes\n",message,minutes); + "%s <li><font color=red>%d</font> minutes\n",message,minutes); } if (seconds) { sprintf(message, - "%s <li><font color=red>%d</font> seconds\n",message,seconds); + "%s <li><font color=red>%d</font> seconds\n",message,seconds); } strcat(message,"</UL>"); HTTP_Write(request, message, strlen(message)); - + } - if (CCTK_nProcs(cctkGH) == 1) - { - strcpy(message,"<li>Single processor run</li>"); - } - else - { - sprintf(message," <li>Multiprocessor run on %d CPUs</li>", - CCTK_nProcs(cctkGH)); - } - HTTP_Write(request, message, strlen(message)); + if (CCTK_nProcs(cctkGH) == 1) + { + strcpy(message,"<li>Single processor run</li>"); } + else + { + sprintf(message," <li>Multiprocessor run on %d CPUs</li>", + CCTK_nProcs(cctkGH)); + } + HTTP_Write(request, message, strlen(message)); strcpy(message,"</UL>"); HTTP_Write(request, message, strlen(message)); /* Finish table started by blurb */ strcpy(message, - "</TD>\n" - "</TR>\n" - "</TABLE>\n" - "</CENTER>\n"); + "</TD>\n" + "</TR>\n" + "</TABLE>\n" + "</CENTER>\n"); HTTP_Write(request, message, strlen(message)); /* Write out the footer part. */ @@ -783,10 +781,10 @@ static int ControlPage(const cGH *cctkGH, httpRequest *request, void *data) HTTP_Write(request, message, strlen(message)); strcpy(message, - "<P>This page is the control center for interacting with" - " the current simulation. It is possible to steer certain" - " parameters, as well as pause, restart, or terminate the" - " simulation.</P>"); + "<P>This page is the control center for interacting with" + " the current simulation. It is possible to steer certain" + " parameters, as well as pause, restart, or terminate the" + " simulation.</P>"); HTTP_Write(request, message, strlen(message)); @@ -1152,7 +1150,7 @@ static int ControlTerminationPage(const cGH *cctkGH, httpRequest *request) else { sprintf(message," <li>Multiprocessor run on %d CPUs</li>", - CCTK_nProcs(cctkGH)); + CCTK_nProcs(cctkGH)); } HTTP_Write(request, message, strlen(message)); } @@ -1334,23 +1332,23 @@ static int AboutPage(const cGH *cctkGH, httpRequest *request, void *data) HTTP_Write(request, message, strlen(message)); strcpy(message, "</center><p>These web pages are served by a simulation " - "which is using the Cactus Code and Computational ToolKit, " - "a freely available, parallel, collaborative," - " portable and " - "modular programming environment for HPC.</p>" - "<p>The HTTPD module, or <i>thorn</i> " - "which is serving these pages" - " can be added to any Cactus application to provide on-line " - "monitoring and control of simulations from any web browser.</p>" - "<p>This HTTPD server and thorn interface has been designed and " - "and implemented by Tom Goodale, based on the original idea and " - "implementation by Werner Benger.</p>"); + "which is using the Cactus Code and Computational ToolKit, " + "a freely available, parallel, collaborative," + " portable and " + "modular programming environment for HPC.</p>" + "<p>The HTTPD module, or <i>thorn</i> " + "which is serving these pages" + " can be added to any Cactus application to provide on-line " + "monitoring and control of simulations from any web browser.</p>" + "<p>This HTTPD server and thorn interface has been designed and " + "and implemented by Tom Goodale, based on the original idea and " + "implementation by Werner Benger.</p>"); retval = HTTP_Write(request, message, strlen(message)); strcpy(message, "<p>For more information about Cactus, visit our " - "permanent home page at " - "<a href=\"http://www.cactuscode.org\">www.cactuscode.org</a></p>"); + "permanent home page at " + "<a href=\"http://www.cactuscode.org\">www.cactuscode.org</a></p>"); retval = HTTP_Write(request, message, strlen(message)); |