Skip to content

Commit 38b8a98

Browse files
committed
fix for ticket #3444
1 parent 6f0b7a7 commit 38b8a98

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Compiler/FrontEnd/ModelicaBuiltin.mo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ constant Integer RT_CLOCK_UNCERTAINTIES = 18;
964964
constant Integer RT_CLOCK_USER_RESERVED = 19;
965965

966966
function readableTime
967+
"returns time in format AhBmTs [X.YYYY]"
967968
input Real sec;
968969
output String str;
969970
protected
@@ -974,6 +975,7 @@ algorithm
974975
hr := div(min,60);
975976
min := mod(min,60);
976977
str := (if hr>0 then String(hr) + "h" else "") + (if min>0 then String(min) + "m" else "") + String(tmp) + "s";
978+
str := str + " [" + String(sec, significantDigits=4) + "]";
977979
end readableTime;
978980

979981
function timerTick

Examples/BuildModelRecursive.mos

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function cell
106106
algorithm
107107
str := if mdFile == \\\"\\\" then \\\"\\\" else \\\" <a href=\\\\\\\"files/mdpad_local.html?\\\"+mdFile+\\\"\\\\\\\"><img width=\\\\\\\"16px\\\\\\\" src=\\\\\\\"files/Modelica.Icons.Example.svg\\\\\\\"></img></a>\\\";
108108
str := if time==-1.0 then \\\"<td bgcolor=\\\\\\\"#FF0000\\\\\\\">&nbsp;</td>\\\" else ((if greenOnOk then \\\"<td bgcolor=\\\\\\\"\\\" + greenColor + \\\"\\\\\\\">\\\" else \\\"<td>\\\") +
109-
OpenModelica.Scripting.Internal.Time.readableTime(if time < 1e-5 then 0 else time)+str+\\\"</td>\\\");
109+
OpenModelica.Scripting.Internal.Time.readableTime(time)+str+\\\"</td>\\\");
110110
end cell;
111111
function length input String str; output Integer len; external \\\"C\\\" len=ModelicaStrings_length(str); end length;
112112
function substring input String str; input Integer i1,i2; output String out; external \\\"C\\\" out=ModelicaStrings_substring(str,i1,i2); end substring;
@@ -213,12 +213,13 @@ if err <> \"\" then
213213
writeFile(errFile,err);
214214
end if;
215215

216-
frontend :=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_FRONTEND);
217-
backend :=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_BACKEND);
218-
simcode :=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_SIMCODE);
219-
templates:=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_TEMPLATES);
220-
total :=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_SIMULATE_TOTAL);
221216
build :=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_BUILD_MODEL);
217+
total :=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_SIMULATE_TOTAL);
218+
templates:=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_TEMPLATES);
219+
simcode :=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_SIMCODE);
220+
backend :=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_BACKEND);
221+
frontend :=OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_FRONTEND);
222+
222223
frontend :=if backend <> -1.0 then frontend-backend else frontend;
223224
backend :=if simcode <> -1.0 then backend-simcode else backend;
224225
simcode :=if templates <> -1.0 then simcode-templates else simcode;
@@ -397,7 +398,7 @@ a.messagesError {color:#FF0000;}
397398
a.messagesWarning {color:#FFCC66;}
398399
</style>
399400
</head><body>" + str);
400-
writeFile(log,"<table><tr><th>Model</th>"+(if referenceFiles == "" then "" else "<th>Verified</th>")+"<th>Simulate</th><th>Total buildModel</th><th>Frontend</th><th>Backend</th><th>SimCode</th><th>Templates</th><th>Compile</th></tr>\n",append=true);getErrorString();
401+
writeFile(log,"<table border=\"1\"><tr><th>Model</th>"+(if referenceFiles == "" then "" else "<th>Verified</th>")+"<th>Simulate</th><th>Total buildModel</th><th>Frontend</th><th>Backend</th><th>SimCode</th><th>Templates</th><th>Compile</th></tr>\n",append=true);getErrorString();
401402
writeFile(log,sum(readFile(s + ".stat") + "\n" for s in a),append=true);getErrorString();
402403
writeFile(log,"</table><hr /><p><a href=\"BuildModelRecursive.tar.gz\">Offline version</a></p></body></html>",append=true);getErrorString();
403404
writeFile("files/" + typeNameString(library) + ".classes",sum(typeNameString(c) + "\n" for c in getClassNames(library, recursive=true)));

0 commit comments

Comments
 (0)