aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorallen <allen@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-10-03 14:19:11 +0000
committerallen <allen@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-10-03 14:19:11 +0000
commit8e0a8a76b48cf24c541327be29d51c4e10630464 (patch)
tree6a8208dfbe7c556de39b8ad459b5e90203e6d361
parent672cdf715e314fec2df6ba3b6eb8248d1112db44 (diff)
Added screen output of how long the simulation has been running (I went up to weeks, hope that is coarse enough)
and estimates of the time per iteration and the time left till it completes. git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@90 1faa4e14-9dd3-4be0-9f0e-ffe519881164
-rw-r--r--param.ccl19
-rw-r--r--src/Content.c120
2 files changed, 129 insertions, 10 deletions
diff --git a/param.ccl b/param.ccl
index 745686c..27ac460 100644
--- a/param.ccl
+++ b/param.ccl
@@ -1,6 +1,23 @@
# Parameter definitions for thorn httpd
# $Header$
+shares: Cactus
+
+USES REAL cctk_final_time ""
+{
+: ::
+}
+
+USES REAL cctk_initial_time ""
+{
+: ::
+}
+
+USES INT cctk_itlast ""
+{
+: ::
+}
+
private:
# Probably the most useful parameter
@@ -10,7 +27,7 @@ INT port "HTTP port number"
1:65535 :: "Any valid port"
} 5555
-# If you desperately need to set the port number by hand, tyrn hunting off.
+# If you desperately need to set the port number by hand, turn hunting off.
BOOLEAN hunt "Should the server hunt for a port if the specified one is taken ?"
{
} "yes"
diff --git a/src/Content.c b/src/Content.c
index 0e27c29..4b16b41 100644
--- a/src/Content.c
+++ b/src/Content.c
@@ -288,12 +288,16 @@ static int CompareStrings(const void *string1, const void *string2)
@@*/
static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
{
+
+ DECLARE_CCTK_PARAMETERS
+
int retval;
int filelen;
char message[10098];
char title[4098];
char menu[4098];
struct httpLink *link;
+ int seconds,minutes,hours,days,weeks;
/* Status message */
strcpy(message,"HTTP/1.0 200 OK\r\n");
@@ -407,15 +411,54 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
/* CONFIGURATION DETAILS */
- sprintf(message, "<h3>Configuration:</h3>"
- "<ul> <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());
+ 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());
- strcat(message,"<li> Parameter filename <font color=red>");
+ HTTP_Write(request, message, strlen(message));
+
+ seconds = CCTK_RunTime();
+ minutes = seconds/60;
+ seconds = seconds-minutes*60;
+ hours = minutes/60;
+ minutes = minutes-hours*60;
+ days = hours/24;
+ hours = hours-days*24;
+ weeks = days/7;
+ days=days-weeks*7;
+
+ strcpy(message,"<li>Time since start up\n<ul>");
+ if (weeks)
+ {
+ sprintf(message,
+ "%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);
+ }
+ if (hours)
+ {
+ sprintf(message,
+ "%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);
+ }
+ if (seconds)
+ {
+ sprintf(message,
+ "%s <li><font color=red>%d</font> seconds\n",message,seconds);
+ }
+
+ strcat(message,"</ul><li> Parameter filename <font color=red>");
HTTP_Write(request, message, strlen(message));
filelen = CCTK_ParameterFilename(4098,message);
@@ -426,6 +469,65 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
if (cctkGH)
{
+
+ strcpy(message,"<li>Estimated time per iteration:<UL> ");
+ sprintf(message,"%s <LI><font color=red>%f</font> seconds</UL>",
+ message,((float)CCTK_RunTime()/(float)cctkGH->cctk_iteration));
+ HTTP_Write(request, message, strlen(message));
+
+ strcpy(message,"<li>Estimated time to completion:<UL> ");
+
+ if (cctk_final_time<cctk_initial_time)
+ {
+ seconds = (cctk_itlast-cctkGH->cctk_iteration)*CCTK_RunTime()/
+ cctkGH->cctk_iteration;
+ }
+ else
+ {
+ seconds = (cctk_final_time-cctkGH->cctk_time)/cctkGH->cctk_delta_time*
+ CCTK_RunTime()/cctkGH->cctk_iteration;
+ }
+
+ minutes = seconds/60;
+ seconds = seconds-minutes*60;
+ hours = minutes/60;
+ minutes = minutes-hours*60;
+ days = hours/24;
+ hours = hours-days*24;
+ weeks = days/7;
+ days=days-weeks*7;
+
+ if (weeks)
+ {
+ sprintf(message,
+ "%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);
+ }
+ if (hours)
+ {
+ sprintf(message,
+ "%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);
+ }
+ if (seconds)
+ {
+ sprintf(message,
+ "%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>");
@@ -973,7 +1075,7 @@ static int ControlTerminationPage(cGH *cctkGH, httpRequest *request)
/* CONFIGURATION DETAILS */
- sprintf(message, "<h3>Configuration:</h3>"
+ sprintf(message, "<h3>Simulation:</h3>"
"<ul> <li>Flesh version <FONT COLOR=RED> %s"
"</FONT></li>\n"
"<li>Code compiled on <FONT COLOR=RED>"