Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'actor-yield' of github.com:Takishipp/simgrid into actor-yield
[simgrid.git] / src / bindings / java / org / simgrid / msg / Host.java
index c15b2af..a5f32b1 100644 (file)
@@ -1,7 +1,6 @@
 /* Bindings to the MSG hosts */
 
-/* Copyright (c) 2006-2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -56,12 +55,11 @@ public class Host {
        protected Host() {
                this.bind = 0;
                this.data = null;
-       };
+       }
 
        @Override
        public String toString (){
                return this.name; 
-
        }
 
        /**
@@ -72,18 +70,16 @@ public class Host {
         *
         * @return              The host object with the given name.
         * @exception           HostNotFoundException if the name of the host is not valid.
-        *                                      NativeException if the native version of this method failed.
         */ 
-       public native static Host getByName(String name) 
-                       throws HostNotFoundException, NullPointerException;
+       public static native Host getByName(String name) throws HostNotFoundException;
        /** Counts the installed hosts. */ 
-       public native static int getCount();
+       public static native int getCount();
 
        /** Returns the host of the current process. */ 
-       public native static Host currentHost();
+       public static native Host currentHost();
 
        /** Returns all hosts of the installed platform. */ 
-       public native static Host[] all();
+       public static native Host[] all();
 
        /** 
         * This static method sets a mailbox to receive in asynchronous mode.
@@ -98,17 +94,14 @@ public class Host {
         */
        public static native void setAsyncMailbox(String mailboxName);
 
-
-       /** Returns the name of an host. */ 
        public String getName() {
                return name;
        }
 
-       /** Sets the user data of the host. */
        public void setData(Object data) {
                this.data = data;
        } 
-       /** Gets the user data of the host. */
+
        public Object getData() {
                return this.data;
        }
@@ -122,18 +115,14 @@ public class Host {
        /** Stops the host if it is on */ 
        public native void off();
 
-
        /**
         * This method returns the speed of the processor of a host (in flops),
         * regardless of the current load of the machine.
         */ 
        public native double getSpeed();
-       /** Returns the number of core of a host. */ 
        public native double getCoreNumber();
 
-       /** Returns the value of a given host property. */
        public native String getProperty(String name);
-       /** Changes the value of a given host property. */
        public native void setProperty(String name, String value);
        /** Tests if an host is up and running. */
        public native boolean isOn();
@@ -143,11 +132,31 @@ public class Host {
        /** This methods returns the list of storages (names) attached to an host */
        public native String[] getAttachedStorage();
 
-       /** Returns the amount of Joules consumed by that host so far */
+       /** After this call, sg_host_get_consumed_energy() will not interrupt your process
+        * (until after the next clock update).
+        */
+       public static native void updateAllEnergyConsumptions();
+       /** Returns the amount of Joules consumed by that host so far 
+        *
+        * Please note that since the consumption is lazily updated, it may require a simcall to update it.
+        * The result is that the actor requesting this value will be interrupted,
+        * the value will be updated in kernel mode before returning the control to the requesting actor.
+        */
        public native double getConsumedEnergy();
+       
+       /** Returns the current pstate */
+       public native int getPstate();
+       /** Changes the current pstate */
+       public native void setPstate(int pstate);
+       public native int getPstatesCount();
+       /** Returns the speed of the processor (in flop/s) at the current pstate. See also @ref plugin_energy. */
+       public native double getCurrentPowerPeak();
+       /** Returns the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy. */
+       public native double getPowerPeakAt(int pstate);
+       
 
        /** Class initializer, to initialize various JNI stuff */
-       public static native void nativeInit();
+       private static native void nativeInit();
        static {
                nativeInit();
        }