1 /* JNI interface to C code for MSG. */
3 /* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 package org.simgrid.msg;
10 public final class Msg {
12 /** Retrieves the simulation time */
13 public static final native double getClock();
14 /** Issue a debug logging message. */
15 public static final native void debug(String msg);
16 /** Issue a verbose logging message. */
17 public static final native void verb(String msg);
18 /** Issue an information logging message */
19 public static final native void info(String msg);
20 /** Issue a warning logging message. */
21 public static final native void warn(String msg);
22 /** Issue an error logging message. */
23 public static final native void error(String msg);
24 /** Issue a critical logging message. */
25 public static final native void critical(String s);
28 throw new IllegalAccessError("Utility class");
31 /*********************************************************************************
32 * Deployment and initialization related functions *
33 *********************************************************************************/
35 /** Initialize a MSG simulation.
37 * @param args The arguments of the command line of the simulation.
39 public static final native void init(String[]args);
41 /** Tell the kernel that you want to use the energy plugin */
42 public static final native void energyInit();
43 public static final native void fileSystemInit();
45 /** Run the MSG simulation.
47 * After the simulation, you can freely retrieve the information that you want..
48 * In particular, retrieving the status of a process or the current date is perfectly ok.
50 public static final native void run() ;
52 /** Create the simulation environment by parsing a platform file. */
53 public static final native void createEnvironment(String platformFile);
55 public static final native As environmentGetRoutingRoot();
57 /** Starts your processes by parsing a deployment file. */
58 public static final native void deployApplication(String deploymentFile);
60 /** Example launcher. You can use it or provide your own launcher, as you wish
63 public static void main(String[]args) {
64 /* initialize the MSG simulation. Must be done before anything else (even logging). */
67 if (args.length < 2) {
68 Msg.info("Usage: Msg platform_file deployment_file");
72 /* Load the platform and deploy the application */
73 Msg.createEnvironment(args[0]);
74 Msg.deployApplication(args[1]);
75 /* Execute the simulation */
79 /* Class initializer, to initialize various JNI stuff */
81 org.simgrid.NativeLib.nativeInit();