If the cpumodel is constructed before msg init is called, a log message is sent without proper init
This meant undefined behavior, and in one particular case the wrong locale being selected, the message used a comma as a separator instead of a dot.
There was a big hint in the comment just before : "do not do anything before the msg.init call !"
public static void main(String[] args) throws NativeException {
/* initialize the MSG simulation. Must be done before anything else (even logging). */
+ Msg.init(args);
+
CpuConstantModel cm = new CpuConstantModel();
Surf.setCpuModel(cm);
- Msg.init(args);
-
if(args.length < 2) {
Msg.info("Usage : TestPlugin platform_file deployment_file");
Msg.info("example : TestPlugin ping_pong_platform.xml ping_pong_deployment.xml");
#! tesh
$ java -classpath ${classpath:=.} surfCpuModel/TestCpuModel ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/surfCpuModel/surfCpuModelDeployment.xml --cfg=workstation/model:compound
-> [0.000000] [jmsg/INFO] Initialize Cpu Constant Model
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'workstation/model' to 'compound'
> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
+> [0.000000] [jmsg/INFO] Initialize Cpu Constant Model
> [0.000000] [jmsg/INFO] New Cpu(Tremblay, 9.8095E7, 1.0)
> [0.000000] [jmsg/INFO] New Cpu(Jupiter, 7.6296E7, 1.0)
> [0.000000] [jmsg/INFO] New Cpu(Fafard, 7.6296E7, 1.0)