X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4cd37b306509da4ed20b4cd8cc1835517af7f306..2c8820859cfc00e1cbf4ba9cbfafadcb827b6197:/src/bindings/java/org/simgrid/surf/Cpu.java 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()); }