Docs script edit + better precision in verbose tracer + progress bar updates

This commit is contained in:
rparedis 2023-10-12 11:12:48 +02:00
parent a2a6928b0a
commit 5982ba62ba
130 changed files with 12 additions and 11 deletions

View file

@ -675,7 +675,7 @@ class Simulator(object):
else:
gvt = max(self.controller.getGVT(), 0)
gvt_percentage = int(gvt / finishtime * 100)
gvt_length = min(barwidth, gvt_percentage * barwidth / 100)
gvt_length = int(min(barwidth, gvt_percentage * barwidth / 100))
for node in locations:
if self.progress_finished:
nodetime = float('inf')
@ -687,16 +687,16 @@ class Simulator(object):
s += " |"
percentage = int(nodetime / finishtime * 100)
s += "#" * gvt_length
length = min(barwidth, percentage * barwidth / 100) - gvt_length
length = int(min(barwidth, percentage * barwidth / 100) - gvt_length)
s += self.fillchar * length
s += " " * (barwidth - gvt_length - length)
s += " " * int(barwidth - gvt_length - length)
if percentage == 100 and self.fillchar != "E":
s += "|DONE"
elif percentage == 100 and self.fillchar == "E":
s += "|FAIL"
else:
s += "| %2d" % percentage + "%"
print(s)
print("\r" + s)
if self.progress_finished:
return
@ -705,6 +705,7 @@ class Simulator(object):
The actual simulation part, this is identical for the 'start from scratch' and 'start from checkpoint' algorithm, thus it was split up
"""
locations = range(self.server.size)
thread = threading.Thread(target=self.showProgress, args=[locations])
try:
## Progress visualisation code
if self.progress:
@ -717,8 +718,8 @@ class Simulator(object):
# self.progress = False
else:
self.progress_finished = False
thread = threading.Thread(target=self.show_progress,
args=[locations])
# thread = threading.Thread(target=self.show_progress,
# args=[locations])
if self.checkpoint_interval < 0:
self.progress_event = threading.Event()
thread.start()

View file

@ -64,7 +64,7 @@ class TracerVerbose(BaseTracer):
"""
string = ""
if time > self.prevtime:
string = ("\n__ Current Time: %10.2f " + "_"*42 + " \n\n") % (time[0])
string = ("\n__ Current Time: %10.6f " + "_"*42 + " \n\n") % (time[0])
self.prevtime = time
string += "%s\n" % text
try:
@ -87,7 +87,7 @@ class TracerVerbose(BaseTracer):
for msg in aDEVS.my_output.get(aDEVS.OPorts[I], []):
text += "\t\t\t\t" + str(msg) + "\n"
# Don't show the age
text += "\t\tNext scheduled internal transition at time %.2f\n" \
text += "\t\tNext scheduled internal transition at time %.6f\n" \
% (aDEVS.time_next[0])
runTraceAtController(self.server,
self.uid,
@ -114,7 +114,7 @@ class TracerVerbose(BaseTracer):
for msg in aDEVS.my_output.get(aDEVS.OPorts[I], []):
text += "\t\t\t\t" + str(msg) + "\n"
# Don't show the age
text += "\t\tNext scheduled internal transition at time %.2f\n" \
text += "\t\tNext scheduled internal transition at time %.6f\n" \
% (aDEVS.time_next[0])
runTraceAtController(self.server,
self.uid,
@ -136,7 +136,7 @@ class TracerVerbose(BaseTracer):
text += "\t\t\t\t" + str(msg) + "\n"
text += "\t\tNew State: %s\n" % str(aDEVS.state)
# Don't show the age
text += "\t\tNext scheduled internal transition at time %.2f\n" \
text += "\t\tNext scheduled internal transition at time %.6f\n" \
% (aDEVS.time_next[0])
runTraceAtController(self.server,
self.uid,
@ -154,7 +154,7 @@ class TracerVerbose(BaseTracer):
text += "\tINITIAL CONDITIONS in model <%s>\n" % aDEVS.getModelFullName()
text += "\t\tInitial State: %s\n" % str(aDEVS.state)
# Don't show the age
text += "\t\tNext scheduled internal transition at time %.2f\n" \
text += "\t\tNext scheduled internal transition at time %.6f\n" \
% (aDEVS.time_next[0])
runTraceAtController(self.server,
self.uid,