Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
986d066b
Commit
986d066b
authored
Jul 15, 2022
by
Julian Zobel
Browse files
Output fix for simulator
parent
be5718ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/common/DefaultMonitor.java
View file @
986d066b
...
...
@@ -218,11 +218,12 @@ public class DefaultMonitor implements MonitorComponent, EventHandler,
String
wl
=
ExperimentDAO
.
getExperimentWorkload
();
if
(
wl
!=
null
)
{
output
.
write
(
"-- Workload -- \n"
);
output
.
write
(
wl
+
" \n"
);
output
.
write
(
"---- \n"
);
output
.
write
(
wl
);
}
output
.
close
();
//
output.close();
}
catch
(
IOException
e
)
{
throw
new
AssertionError
();
}
...
...
@@ -239,7 +240,7 @@ public class DefaultMonitor implements MonitorComponent, EventHandler,
}
try
{
output
.
write
(
Time
.
getFormattedTime
()
+
":
[DefaultMonitor] started, initialized all analyzers.. \n"
);
output
.
write
(
"
[DefaultMonitor] started, initialized all analyzers.. \n"
);
}
catch
(
IOException
e
)
{
throw
new
AssertionError
();
}
...
...
@@ -248,7 +249,7 @@ public class DefaultMonitor implements MonitorComponent, EventHandler,
}
else
if
(
type
==
MONITOR_TEST
)
{
//
}
else
if
(
type
==
MONITOR_STOP
)
{
this
.
close
();
//
this.close();
}
else
{
throw
new
AssertionError
(
"Unknown event type."
);
}
...
...
src/de/tud/kom/p2psim/impl/simengine/Simulator.java
View file @
986d066b
...
...
@@ -252,18 +252,21 @@ public class Simulator implements RandomGeneratorComponent, GlobalComponent {
this
.
running
=
false
;
if
(
finishedWithoutError
)
{
Monitor
.
log
(
Simulator
.
class
,
Level
.
INFO
,
"Simulation successfully finished :)"
);
"Simulation successfully finished :)"
);
System
.
out
.
println
(
"Simulation successfully finished"
);
}
else
{
if
(
reason
==
null
)
{
Monitor
.
log
(
Simulator
.
class
,
Level
.
ERROR
,
"Simulation finished with unresolved errors ???"
);
System
.
out
.
println
(
"Simulation finished with unresolved errors ???"
);
}
else
{
Monitor
.
log
(
Simulator
.
class
,
Level
.
ERROR
,
"Simulation finished with errors :( \n "
+
reason
.
toString
()
+
" : "
+
reason
.
getStackTrace
());
}
System
.
out
.
println
(
"Simulation finished with errors :( \n "
+
reason
.
toString
()
+
" : "
+
reason
.
getStackTrace
());
}
}
long
runTime
=
System
.
currentTimeMillis
()
-
startTime
;
long
minutes
=
(
long
)
Math
.
floor
((
runTime
)
/
60000
);
...
...
@@ -288,8 +291,12 @@ public class Simulator implements RandomGeneratorComponent, GlobalComponent {
for
(
SimulatorObserver
so
:
observers
)
{
so
.
simulationFinished
();
}
ExperimentDAO
.
simulationFinished
(
finishedWithoutError
);
// FIXME Hack?
// closing the monitor before also closes the stream and makes it impossible to track erros on simulation termination
DefaultMonitor
.
getInstance
().
close
();
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment