From 2c8820859cfc00e1cbf4ba9cbfafadcb827b6197 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20B=C3=A9daride?= Date: Tue, 15 Apr 2014 17:59:42 +0200 Subject: [PATCH] Add doc to surf java --- buildtools/Cmake/DefinePackages.cmake | 7 +- buildtools/Cmake/Distrib.cmake | 1 + .../java/org/simgrid/surf/Action.java | 53 +++ src/bindings/java/org/simgrid/surf/Cpu.java | 72 +++ .../java/org/simgrid/surf/CpuAction.java | 16 + .../java/org/simgrid/surf/CpuModel.java | 26 ++ src/bindings/java/org/simgrid/surf/Model.java | 40 +- .../java/org/simgrid/surf/NetworkAction.java | 8 + .../java/org/simgrid/surf/NetworkLink.java | 31 ++ .../java/org/simgrid/surf/Resource.java | 37 ++ src/bindings/java/org/simgrid/surf/Surf.java | 4 + .../java/org/simgrid/surf/SurfJNI.java | 1 - src/bindings/java/surf.i | 6 +- src/bindings/java/surfJAVA_wrap.cxx | 18 - src/bindings/java/surfdoc.i | 439 ++++++++++++++++++ 15 files changed, 729 insertions(+), 30 deletions(-) create mode 100644 src/bindings/java/surfdoc.i diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index c0bea8e546..d1c9bc4887 100644 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -433,6 +433,11 @@ set(BINDINGS_SRC set(JSURF_SWIG_SRC src/bindings/java/surf.i ) + +set(JSURF_SWIG_SRC_EXTRA + src/bindings/java/surfdoc.i +) + set(JSURF_JAVA_C_SRC src/bindings/java/surf_swig.cpp src/bindings/java/surf_swig.hpp @@ -493,8 +498,8 @@ set(JMSG_C_SRC src/bindings/java/smx_context_cojava.h src/bindings/java/smx_context_java.c src/bindings/java/smx_context_java.h - ${JSURF_JAVA_C_SRC} ) + set(JSURF_C_SRC src/bindings/java/surfJAVA_wrap.cxx src/bindings/java/surfJAVA_wrap.h diff --git a/buildtools/Cmake/Distrib.cmake b/buildtools/Cmake/Distrib.cmake index 5c11fa319a..61b8edf8ee 100644 --- a/buildtools/Cmake/Distrib.cmake +++ b/buildtools/Cmake/Distrib.cmake @@ -190,6 +190,7 @@ set(source_to_pack ${JMSG_C_SRC} ${JMSG_JAVA_SRC} ${JSURF_SWIG_SRC} + ${JSURF_SWIG_SRC_EXTRA} ${JSURF_C_SRC} ${LUA_SRC} ${MC_SRC} diff --git a/src/bindings/java/org/simgrid/surf/Action.java b/src/bindings/java/org/simgrid/surf/Action.java index b01d4f7edf..d81b2ba23e 100644 --- a/src/bindings/java/org/simgrid/surf/Action.java +++ b/src/bindings/java/org/simgrid/surf/Action.java @@ -8,6 +8,11 @@ package org.simgrid.surf; +/** + * An action created by a Resource (e.g., a communication, an execution) + * @see Model + * @see Resource + */ public class Action { private long swigCPtr; protected boolean swigCMemOwn; @@ -49,48 +54,96 @@ public class Action { return arrayWrapper; } + + /** + * Action constructor + * @param model The model associated + * @param cost The cost of the action (e.g., flops, bytes) + * @param failed If the action has failed + */ public Action(Model model, double cost, boolean failed) { this(SurfJNI.new_Action(Model.getCPtr(model), model, cost, failed), true); } + + /** + * @return The model associated + */ public Model getModel() { long cPtr = SurfJNI.Action_getModel(swigCPtr, this); return (cPtr == 0) ? null : new Model(cPtr, false); } + + /** + * @return The variable associatied (if using LMM) + */ public LmmVariable getVariable() { long cPtr = SurfJNI.Action_getVariable(swigCPtr, this); return (cPtr == 0) ? null : new LmmVariable(cPtr, false); } + + /** + * @return The state of the action + */ public ActionState getState() { return ActionState.swigToEnum(SurfJNI.Action_getState(swigCPtr, this)); } + + /** + * @return True if suspended + */ public boolean isSuspended() { return SurfJNI.Action_isSuspended(swigCPtr, this); } + + /** + * @return TODO + */ public double getBound() { return SurfJNI.Action_getBound(swigCPtr, this); } + + /** + * @param TODO + */ public void setBound(double bound) { SurfJNI.Action_setBound(swigCPtr, this, bound); } + + /** + * Update remaining amount of cost to do + * @param delta Difference of time since last call to this function + */ public void updateRemains(double delta) { SurfJNI.Action_updateRemains(swigCPtr, this, delta); } + + /** + * @return The remaining amount of cost to do + */ public double getRemains() { return SurfJNI.Action_getRemains(swigCPtr, this); } + + /** + * @param The new priority of the action + */ public void setPriority(double priority) { SurfJNI.Action_setPriority(swigCPtr, this, priority); } + + /** + * @param The new state + */ public void setState(ActionState state) { SurfJNI.Action_setState(swigCPtr, this, state.swigValue()); } diff --git a/src/bindings/java/org/simgrid/surf/Cpu.java b/src/bindings/java/org/simgrid/surf/Cpu.java index 6c20206a7f..82ce3e2915 100644 --- a/src/bindings/java/org/simgrid/surf/Cpu.java +++ b/src/bindings/java/org/simgrid/surf/Cpu.java @@ -8,6 +8,11 @@ package org.simgrid.surf; +/** + * A generic resource for the cpu component + * @see CpuModel + * @see CpuAction + */ public class Cpu extends Resource { private long swigCPtr; @@ -50,54 +55,121 @@ public class Cpu extends Resource { SurfJNI.Cpu_change_ownership(this, swigCPtr, true); } + + /** + * A cpu constructor (using LMM) + * @param model + * @param name + * @param properties + * @param constraint + * @param core + * @param powerPeak + * @param powerScale + */ public Cpu(Model model, String name, XbtDict props, LmmConstraint constraint, int core, double powerPeak, double powerScale) { this(SurfJNI.new_Cpu__SWIG_0(Model.getCPtr(model), model, name, XbtDict.getCPtr(props), props, LmmConstraint.getCPtr(constraint), constraint, core, powerPeak, powerScale), true); SurfJNI.Cpu_director_connect(this, swigCPtr, swigCMemOwn, true); } + + /** + * A cpu constructor + * @param model + * @param name + * @param properties + * @param core + * @param powerPeak + * @param powerScale + */ public Cpu(Model model, String name, XbtDict props, int core, double powerPeak, double powerScale) { this(SurfJNI.new_Cpu__SWIG_1(Model.getCPtr(model), model, name, XbtDict.getCPtr(props), props, core, powerPeak, powerScale), true); SurfJNI.Cpu_director_connect(this, swigCPtr, swigCMemOwn, true); } + + /** + * @return The current power peak + */ public double getCurrentPowerPeak() { return (getClass() == Cpu.class) ? SurfJNI.Cpu_getCurrentPowerPeak(swigCPtr, this) : SurfJNI.Cpu_getCurrentPowerPeakSwigExplicitCpu(swigCPtr, this); } + + /** + * Execute some quantity of computation + * @param size The processing amount (in flop) needed to process + * @return A cpu action representing code execution + */ public CpuAction execute(double size) { long cPtr = SurfJNI.Cpu_execute(swigCPtr, this, size); return (CpuAction)Surf.getCpuDirector(cPtr); } + + /** + * Make a process sleep for duration + * @param duration The number of seconds to sleep + * @return A cpu action representing sleeping + */ public CpuAction sleep(double duration) { long cPtr = SurfJNI.Cpu_sleep(swigCPtr, this, duration); return (CpuAction)Surf.getCpuDirector(cPtr); } + + /** + * @return The number of cores on the cpu + */ public int getCore() { return (getClass() == Cpu.class) ? SurfJNI.Cpu_getCore(swigCPtr, this) : SurfJNI.Cpu_getCoreSwigExplicitCpu(swigCPtr, this); } + + /** + * TODO + * @param load + */ public double getSpeed(double load) { return (getClass() == Cpu.class) ? SurfJNI.Cpu_getSpeed(swigCPtr, this, load) : SurfJNI.Cpu_getSpeedSwigExplicitCpu(swigCPtr, this, load); } + + /** + * TODO + */ public double getAvailableSpeed() { return (getClass() == Cpu.class) ? SurfJNI.Cpu_getAvailableSpeed(swigCPtr, this) : SurfJNI.Cpu_getAvailableSpeedSwigExplicitCpu(swigCPtr, this); } + + /** + * @param pstate_index index of power peak to get + * @return Power peak at index + */ public double getPowerPeakAt(int pstate_index) { return SurfJNI.Cpu_getPowerPeakAt(swigCPtr, this, pstate_index); } + + /** + * @return Number of power peak + */ public int getNbPstates() { return SurfJNI.Cpu_getNbPstates(swigCPtr, this); } + + /** + * @param index of power peak to set + */ public void setPowerPeakAt(int pstate_index) { SurfJNI.Cpu_setPowerPeakAt(swigCPtr, this, pstate_index); } + + /** + * @param The new state of the cpu + */ public void setState(ResourceState state) { SurfJNI.Cpu_setState(swigCPtr, this, state.swigValue()); } diff --git a/src/bindings/java/org/simgrid/surf/CpuAction.java b/src/bindings/java/org/simgrid/surf/CpuAction.java index be740ec056..50f0fd6055 100644 --- a/src/bindings/java/org/simgrid/surf/CpuAction.java +++ b/src/bindings/java/org/simgrid/surf/CpuAction.java @@ -8,6 +8,11 @@ package org.simgrid.surf; +/** + * An cpu action created by a Cpu + * @see CpuModel + * @see Cpu + */ public class CpuAction extends Action { private long swigCPtr; @@ -50,11 +55,22 @@ public class CpuAction extends Action { SurfJNI.CpuAction_change_ownership(this, swigCPtr, true); } + + /** + * CpuAction constructor + * @param model The model associated + * @param cost The cost of the action (e.g., flops, bytes) + * @param failed If the action has failed + */ public CpuAction(Model model, double cost, boolean failed) { this(SurfJNI.new_CpuAction(Model.getCPtr(model), model, cost, failed), true); SurfJNI.CpuAction_director_connect(this, swigCPtr, swigCMemOwn, true); } + + /** + * @return The associated cpu + */ public Cpu getCpu() { long cPtr = SurfJNI.CpuAction_getCpu(swigCPtr, this); return (Cpu)Surf.getCpuDirector(cPtr); diff --git a/src/bindings/java/org/simgrid/surf/CpuModel.java b/src/bindings/java/org/simgrid/surf/CpuModel.java index d3bb7978ce..466308afbf 100644 --- a/src/bindings/java/org/simgrid/surf/CpuModel.java +++ b/src/bindings/java/org/simgrid/surf/CpuModel.java @@ -8,6 +8,11 @@ package org.simgrid.surf; +/** + * The generic model for the Cpu component + * @see Cpu + * @see CpuAction + */ public class CpuModel extends Model { private long swigCPtr; @@ -50,11 +55,32 @@ public class CpuModel extends Model { SurfJNI.CpuModel_change_ownership(this, swigCPtr, true); } + + /** + * CpuModel constructon + * @param name The name of the cpumodel + */ public CpuModel(String name) { this(SurfJNI.new_CpuModel(name), true); SurfJNI.CpuModel_director_connect(this, swigCPtr, swigCMemOwn, true); } + + /** + * Create a new Cpu + * + * @param name + * @param power_peak + * @param pstate + * @param power_scale + * @param power_trace + * @param core + * @param state_initial + * @param state_trace + * @param cpu_properties + * @return The new Cpu + * @see Cpu + */ public Cpu createResource(String name, double[] power_peak, int pstate, double power_scale, TmgrTrace power_trace, int core, ResourceState state_initial, TmgrTrace state_trace, XbtDict cpu_properties) { long cPtr = SurfJNI.CpuModel_createResource(swigCPtr, this, name, power_peak, pstate, power_scale, TmgrTrace.getCPtr(power_trace), power_trace, core, state_initial.swigValue(), TmgrTrace.getCPtr(state_trace), state_trace, XbtDict.getCPtr(cpu_properties), cpu_properties); return (Cpu)Surf.getCpuDirector(cPtr); diff --git a/src/bindings/java/org/simgrid/surf/Model.java b/src/bindings/java/org/simgrid/surf/Model.java index 9a33e0e0bc..f1caaa3cbc 100644 --- a/src/bindings/java/org/simgrid/surf/Model.java +++ b/src/bindings/java/org/simgrid/surf/Model.java @@ -8,6 +8,16 @@ package org.simgrid.surf; +/** + * A component (e.g., Cpu, Network, Storage, ...) is composed of three classes: + * + * @see Resource + * @see Action + */ public class Model { private long swigCPtr; protected boolean swigCMemOwn; @@ -35,14 +45,29 @@ public class Model { } } + + /** + * Model constructor + * @param name The name of the model + */ public Model(String name) { this(SurfJNI.new_Model(name), true); } + + /** + * @return The name of the model + */ public String getName() { return SurfJNI.Model_getName(swigCPtr, this); } + + /** + * Share the resources between the actions + * @param now the current time + * @return the date of the next action of the model will finish + */ public double shareResources(double now) { return SurfJNI.Model_shareResources(swigCPtr, this, now); } @@ -55,6 +80,12 @@ public class Model { return SurfJNI.Model_shareResourcesFull(swigCPtr, this, now); } + + /** + * Update time of actions and eventually their states + * @param now the new current time + * @param delta the delta between previous and new current time + */ public void updateActionsState(double now, double delta) { SurfJNI.Model_updateActionsState(swigCPtr, this, now, delta); } @@ -67,14 +98,13 @@ public class Model { SurfJNI.Model_updateActionsStateFull(swigCPtr, this, now, delta); } + + /** + * Get the List of running Actions + */ public ActionList getRunningActionSet() { long cPtr = SurfJNI.Model_getRunningActionSet(swigCPtr, this); return (cPtr == 0) ? null : new ActionList(cPtr, false); } - public Action getRunningActionS() { - long cPtr = SurfJNI.Model_getRunningActionS(swigCPtr, this); - return (cPtr == 0) ? null : new Action(cPtr, false); - } - } diff --git a/src/bindings/java/org/simgrid/surf/NetworkAction.java b/src/bindings/java/org/simgrid/surf/NetworkAction.java index 7f35a60c2e..c1b758dc68 100644 --- a/src/bindings/java/org/simgrid/surf/NetworkAction.java +++ b/src/bindings/java/org/simgrid/surf/NetworkAction.java @@ -8,6 +8,10 @@ package org.simgrid.surf; +/** + * An network action created by network model + * @see NetworkLink + */ public class NetworkAction extends Action { private long swigCPtr; @@ -35,6 +39,10 @@ public class NetworkAction extends Action { super.delete(); } + + /** + * @return The latency of the action + */ public double getLatency() { return SurfJNI.NetworkAction_getLatency(swigCPtr, this); } diff --git a/src/bindings/java/org/simgrid/surf/NetworkLink.java b/src/bindings/java/org/simgrid/surf/NetworkLink.java index 730a281cfe..a787a8bd4f 100644 --- a/src/bindings/java/org/simgrid/surf/NetworkLink.java +++ b/src/bindings/java/org/simgrid/surf/NetworkLink.java @@ -8,6 +8,9 @@ package org.simgrid.surf; +/** + * A generic resource for the network component + */ public class NetworkLink extends Resource { private long swigCPtr; @@ -49,26 +52,54 @@ public class NetworkLink extends Resource { return arrayWrapper; } + + /** + * @return The bandwidth of the link + */ public double getBandwidth() { return SurfJNI.NetworkLink_getBandwidth(swigCPtr, this); } + + /** + * @param value The new bandwidth + * @param date When to change the bandwidth + */ public void updateBandwidth(double value, double date) { SurfJNI.NetworkLink_updateBandwidth__SWIG_0(swigCPtr, this, value, date); } + + /** + * @param value The new bandwidth + * @param date When to change the bandwidth + */ public void updateBandwidth(double value) { SurfJNI.NetworkLink_updateBandwidth__SWIG_1(swigCPtr, this, value); } + + /** + * @return The latency of the link + */ public double getLatency() { return SurfJNI.NetworkLink_getLatency(swigCPtr, this); } + + /** + * @param value The new latency + * @param date When to change the latency + */ public void updateLatency(double value, double date) { SurfJNI.NetworkLink_updateLatency__SWIG_0(swigCPtr, this, value, date); } + + /** + * @param value The new latency + * @param date When to change the latency + */ public void updateLatency(double value) { SurfJNI.NetworkLink_updateLatency__SWIG_1(swigCPtr, this, value); } diff --git a/src/bindings/java/org/simgrid/surf/Resource.java b/src/bindings/java/org/simgrid/surf/Resource.java index 478ae282e4..4091eb538f 100644 --- a/src/bindings/java/org/simgrid/surf/Resource.java +++ b/src/bindings/java/org/simgrid/surf/Resource.java @@ -8,6 +8,11 @@ package org.simgrid.surf; +/** + * A resource used by a model (e.g., a cpu, a network link) + * @see Model + * @see Action + */ public class Resource { private long swigCPtr; protected boolean swigCMemOwn; @@ -35,33 +40,65 @@ public class Resource { } } + + /** + * @return The name of the resource + */ public String getName() { return SurfJNI.Resource_getName(swigCPtr, this); } + + /** + * @return True if the Resource is used + */ public boolean isUsed() { return SurfJNI.Resource_isUsed(swigCPtr, this); } + + /** + * @return The model associated to this Resource + */ public Model getModel() { long cPtr = SurfJNI.Resource_getModel(swigCPtr, this); return (cPtr == 0) ? null : new Model(cPtr, false); } + + /** + * @return The state of the resource + * @see ResourceState + */ public ResourceState getState() { return ResourceState.swigToEnum(SurfJNI.Resource_getState(swigCPtr, this)); } + + /** + * @return The constraint associatied (if using LMM) + */ public LmmConstraint getConstraint() { long cPtr = SurfJNI.Resource_getConstraint(swigCPtr, this); return (cPtr == 0) ? null : new LmmConstraint(cPtr, false); } + + /** + * @return The XbtDict of properties associated to this Resource + */ public XbtDict getProperties() { long cPtr = SurfJNI.Resource_getProperties(swigCPtr, this); return (cPtr == 0) ? null : new XbtDict(cPtr, false); } + + /** + * Update the state of the Resource + * @param event_type + * @param value + * @param date + */ public void updateState(TmgrTraceEvent event_type, double value, double date) { SurfJNI.Resource_updateState(swigCPtr, this, TmgrTraceEvent.getCPtr(event_type), event_type, value, date); } diff --git a/src/bindings/java/org/simgrid/surf/Surf.java b/src/bindings/java/org/simgrid/surf/Surf.java index 8cfbc04fce..b4ef317ae5 100644 --- a/src/bindings/java/org/simgrid/surf/Surf.java +++ b/src/bindings/java/org/simgrid/surf/Surf.java @@ -25,6 +25,10 @@ public class Surf { return SurfJNI.getCpuActionDirector(jarg1); } + + /** + * @return The current simulated time + */ public static double getClock() { return SurfJNI.getClock(); } diff --git a/src/bindings/java/org/simgrid/surf/SurfJNI.java b/src/bindings/java/org/simgrid/surf/SurfJNI.java index c973f0074d..040ca882d3 100644 --- a/src/bindings/java/org/simgrid/surf/SurfJNI.java +++ b/src/bindings/java/org/simgrid/surf/SurfJNI.java @@ -80,7 +80,6 @@ public class SurfJNI { public final static native void Model_updateActionsStateLazy(long jarg1, Model jarg1_, double jarg2, double jarg3); public final static native void Model_updateActionsStateFull(long jarg1, Model jarg1_, double jarg2, double jarg3); public final static native long Model_getRunningActionSet(long jarg1, Model jarg1_); - public final static native long Model_getRunningActionS(long jarg1, Model jarg1_); public final static native void delete_Model(long jarg1); public final static native long new_CpuModel(String jarg1); public final static native void delete_CpuModel(long jarg1); diff --git a/src/bindings/java/surf.i b/src/bindings/java/surf.i index 2be8718bc0..70006b3936 100644 --- a/src/bindings/java/surf.i +++ b/src/bindings/java/surf.i @@ -9,6 +9,7 @@ %include "arrays_java.i" %include "std_string.i" +%include "surfdoc.i" %pragma(java) jniclassimports=%{ import org.simgrid.NativeLib; @@ -245,11 +246,6 @@ public: virtual void updateActionsStateFull(double now, double delta); virtual ActionList *getRunningActionSet(); -%extend { - Action *getRunningActionS() { - return (Action*)(&($self->getRunningActionSet()->front())); - } -} }; %feature("director") CpuModel; diff --git a/src/bindings/java/surfJAVA_wrap.cxx b/src/bindings/java/surfJAVA_wrap.cxx index 279f305737..ee52a22e1a 100644 --- a/src/bindings/java/surfJAVA_wrap.cxx +++ b/src/bindings/java/surfJAVA_wrap.cxx @@ -1054,9 +1054,6 @@ SWIGINTERN ActionArrayPtr ActionList_getArray(ActionList *self){ return self; } SWIGINTERN unsigned int tmgr_trace_event_getIdx(tmgr_trace_event *self){return 0;} -SWIGINTERN Action *Model_getRunningActionS(Model *self){ - return (Action*)(&(self->getRunningActionSet()->front())); - } SWIGINTERN Cpu *CpuAction_getCpu(CpuAction *self){return getActionCpu(self);} SWIGINTERN double NetworkAction_getLatency(NetworkAction *self){return self->m_latency;} SWIGINTERN double lmm_constraint_getUsage(lmm_constraint *self){return lmm_constraint_get_usage(self);} @@ -2959,21 +2956,6 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Model_1getRunningActionSe } -SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Model_1getRunningActionS(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - Model *arg1 = (Model *) 0 ; - Action *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(Model **)&jarg1; - result = (Action *)Model_getRunningActionS(arg1); - *(Action **)&jresult = result; - return jresult; -} - - SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1Model(JNIEnv *jenv, jclass jcls, jlong jarg1) { Model *arg1 = (Model *) 0 ; diff --git a/src/bindings/java/surfdoc.i b/src/bindings/java/surfdoc.i new file mode 100644 index 0000000000..362c1e48fa --- /dev/null +++ b/src/bindings/java/surfdoc.i @@ -0,0 +1,439 @@ + +%javamethodmodifiers getClock() " + /** + * @return The current simulated time + */ + public"; + +%typemap(javaimports) Model " +/** + * A component (e.g., Cpu, Network, Storage, ...) is composed of three classes: + * + * @see Resource + * @see Action + */" + +%javamethodmodifiers Model::Model(const char *name) " + /** + * Model constructor + * @param name The name of the model + */ + public"; + +%javamethodmodifiers Model::getName() " + /** + * @return The name of the model + */ + public"; + +%javamethodmodifiers Model::shareResources(double now) " + /** + * Share the resources between the actions + * @param now the current time + * @return the date of the next action of the model will finish + */ + public"; + +%javamethodmodifiers Model::updateActionsState(double now, double delta) " + /** + * Update time of actions and eventually their states + * @param now the new current time + * @param delta the delta between previous and new current time + */ + public"; + + %javamethodmodifiers Model::getRunningActionSet() " + /** + * Get the List of running Actions + */ + public"; + + +%typemap(javaimports) CpuModel " +/** + * The generic model for the Cpu component + * @see Cpu + * @see CpuAction + */" + +%javamethodmodifiers CpuModel::CpuModel(const char *name) " + /** + * CpuModel constructon + * @param name The name of the cpumodel + */ + public"; + + +%javamethodmodifiers CpuModel::createResource(const char *name, DoubleDynar power_peak, + int pstate, double power_scale, + tmgr_trace *power_trace, int core, + e_surf_resource_state_t state_initial, + tmgr_trace *state_trace, + s_xbt_dict *cpu_properties) " + /** + * Create a new Cpu + * + * @param name + * @param power_peak + * @param pstate + * @param power_scale + * @param power_trace + * @param core + * @param state_initial + * @param state_trace + * @param cpu_properties + * @return The new Cpu + * @see Cpu + */ + public"; + + +%typemap(javaimports) Resource " +/** + * A resource used by a model (e.g., a cpu, a network link) + * @see Model + * @see Action + */" + +%javamethodmodifiers Resource::getName() " + /** + * @return The name of the resource + */ + public"; + +%javamethodmodifiers Resource::isUsed() " + /** + * @return True if the Resource is used + */ + public"; + +%javamethodmodifiers Resource::getModel() " + /** + * @return The model associated to this Resource + */ + public"; + +%javamethodmodifiers Resource::getState() " + /** + * @return The state of the resource + * @see ResourceState + */ + public"; + +%javamethodmodifiers Resource::getConstraint() " + /** + * @return The constraint associatied (if using LMM) + */ + public"; + +%javamethodmodifiers Resource::getProperties() " + /** + * @return The XbtDict of properties associated to this Resource + */ + public"; + +%javamethodmodifiers Resource::updateState(tmgr_trace_event *event_type, double value, double date) " + /** + * Update the state of the Resource + * @param event_type + * @param value + * @param date + */ + public"; + + +%typemap(javaimports) Cpu " +/** + * A generic resource for the cpu component + * @see CpuModel + * @see CpuAction + */" + +%javamethodmodifiers Cpu::Cpu(Model *model, const char *name, s_xbt_dict *props, + lmm_constraint *constraint, int core, double powerPeak, double powerScale) " + /** + * A cpu constructor (using LMM) + * @param model + * @param name + * @param properties + * @param constraint + * @param core + * @param powerPeak + * @param powerScale + */ + public"; + +%javamethodmodifiers Cpu::Cpu(Model *model, const char *name, s_xbt_dict *props, + int core, double powerPeak, double powerScale) " + /** + * A cpu constructor + * @param model + * @param name + * @param properties + * @param core + * @param powerPeak + * @param powerScale + */ + public"; + +%javamethodmodifiers Cpu::getCurrentPowerPeak() " + /** + * @return The current power peak + */ + public"; + +%javamethodmodifiers Cpu::execute(double size) " + /** + * Execute some quantity of computation + * @param size The processing amount (in flop) needed to process + * @return A cpu action representing code execution + */ + public"; + +%javamethodmodifiers Cpu::sleep(double duration) " + /** + * Make a process sleep for duration + * @param duration The number of seconds to sleep + * @return A cpu action representing sleeping + */ + public"; + +%javamethodmodifiers Cpu::getCore() " + /** + * @return The number of cores on the cpu + */ + public"; + +%javamethodmodifiers Cpu::getSpeed(double load) " + /** + * TODO + * @param load + */ + public"; + +%javamethodmodifiers Cpu::getAvailableSpeed() " + /** + * TODO + */ + public"; + +%javamethodmodifiers Cpu::getPowerPeakAt(int pstate_index) " + /** + * @param pstate_index index of power peak to get + * @return Power peak at index + */ + public"; + + %javamethodmodifiers Cpu::getNbPstates() " + /** + * @return Number of power peak + */ + public"; + +%javamethodmodifiers Cpu::setPowerPeakAt(int pstate_index) " + /** + * @param index of power peak to set + */ + public"; + +%javamethodmodifiers Cpu::setState(e_surf_resource_state_t state) " + /** + * @param The new state of the cpu + */ + public"; + + +%typemap(javaimports) NetworkLink " +/** + * A generic resource for the network component + */" + + %javamethodmodifiers NetworkLink::getBandwidth() " + /** + * @return The bandwidth of the link + */ + public"; + +%javamethodmodifiers NetworkLink::updateBandwidth(double value, double date=surf_get_clock()) " + /** + * @param value The new bandwidth + * @param date When to change the bandwidth + */ + public"; + + %javamethodmodifiers NetworkLink::getLatency() " + /** + * @return The latency of the link + */ + public"; + +%javamethodmodifiers NetworkLink::updateLatency(double value, double date=surf_get_clock()) " + /** + * @param value The new latency + * @param date When to change the latency + */ + public"; + + +%typemap(javaimports) Action " +/** + * An action created by a Resource (e.g., a communication, an execution) + * @see Model + * @see Resource + */" + +%javamethodmodifiers Action::Action(Model *model, double cost, bool failed) " + /** + * Action constructor + * @param model The model associated + * @param cost The cost of the action (e.g., flops, bytes) + * @param failed If the action has failed + */ + public"; + +%javamethodmodifiers Action::getModel() " + /** + * @return The model associated + */ + public"; + +%javamethodmodifiers Action::getVariable() " + /** + * @return The variable associatied (if using LMM) + */ + public"; + +%javamethodmodifiers Action::getState() " + /** + * @return The state of the action + */ + public"; + +%javamethodmodifiers Action::isSuspended() " + /** + * @return True if suspended + */ + public"; + +%javamethodmodifiers Action::getBound() " + /** + * @return TODO + */ + public"; + +%javamethodmodifiers Action::setBound(double bound) " + /** + * @param TODO + */ + public"; + +%javamethodmodifiers Action::updateRemains(double delta) " + /** + * Update remaining amount of cost to do + * @param delta Difference of time since last call to this function + */ + public"; + +%javamethodmodifiers Action::getRemains() " + /** + * @return The remaining amount of cost to do + */ + public"; + +%javamethodmodifiers Action::setPriority(double priority) " + /** + * @param The new priority of the action + */ + public"; + +%javamethodmodifiers Action::setState(e_surf_action_state_t state) " + /** + * @param The new state + */ + public"; + + +%typemap(javaimports) CpuAction " +/** + * An cpu action created by a Cpu + * @see CpuModel + * @see Cpu + */" + +%javamethodmodifiers CpuAction::CpuAction(Model *model, double cost, bool failed) " + /** + * CpuAction constructor + * @param model The model associated + * @param cost The cost of the action (e.g., flops, bytes) + * @param failed If the action has failed + */ + public"; + +%javamethodmodifiers CpuAction::getCpu() " + /** + * @return The associated cpu + */ + public"; + + +%typemap(javaimports) NetworkAction " +/** + * An network action created by network model + * @see NetworkLink + */" + +%javamethodmodifiers NetworkAction::getLatency() " + /** + * @return The latency of the action + */ + public"; + + +%typemap(javaimports) LmmConstraint " +/** + * An linear maxmin generic constraint + */" + +%javamethodmodifiers LmmConstraint::getUsage() " + /** + * + */ + public"; + +%typemap(javaimports) LmmVariable " +/** + * An linear maxmin generic variable + */" + +%javamethodmodifiers LmmVariable::getValue() " + /** + * + */ + public"; + +%typemap(javaimports) XbtDict " +/** + * A c structure handling key:values + */" + +%javamethodmodifiers XbtDict::getValue(char *key) " + /** + * + */ + public"; + + +%typemap(javaimports) ActionState " +/** + * The possible states of an Action + */" + + +%typemap(javaimports) ResourceState " +/** + * The possible states of a Resource + */" -- 2.20.1