1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
5 * Do not make changes to this file unless you know what you are doing--modify
6 * the SWIG interface file instead.
7 * ----------------------------------------------------------------------------- */
9 package org.simgrid.surf;
11 public class Cpu extends Resource {
12 private long swigCPtr;
14 protected Cpu(long cPtr, boolean cMemoryOwn) {
15 super(SurfJNI.Cpu_SWIGUpcast(cPtr), cMemoryOwn);
19 protected static long getCPtr(Cpu obj) {
20 return (obj == null) ? 0 : obj.swigCPtr;
23 protected void finalize() {
27 public synchronized void delete() {
31 SurfJNI.delete_Cpu(swigCPtr);
38 protected void swigDirectorDisconnect() {
43 public void swigReleaseOwnership() {
45 SurfJNI.Cpu_change_ownership(this, swigCPtr, false);
48 public void swigTakeOwnership() {
50 SurfJNI.Cpu_change_ownership(this, swigCPtr, true);
53 public Cpu(Model model, String name, XbtDict props, LmmConstraint constraint, int core, double powerPeak, double powerScale) {
54 this(SurfJNI.new_Cpu__SWIG_0(Model.getCPtr(model), model, name, XbtDict.getCPtr(props), props, LmmConstraint.getCPtr(constraint), constraint, core, powerPeak, powerScale), true);
55 SurfJNI.Cpu_director_connect(this, swigCPtr, swigCMemOwn, true);
58 public Cpu(Model model, String name, XbtDict props, int core, double powerPeak, double powerScale) {
59 this(SurfJNI.new_Cpu__SWIG_1(Model.getCPtr(model), model, name, XbtDict.getCPtr(props), props, core, powerPeak, powerScale), true);
60 SurfJNI.Cpu_director_connect(this, swigCPtr, swigCMemOwn, true);
63 public double getCurrentPowerPeak() {
64 return (getClass() == Cpu.class) ? SurfJNI.Cpu_getCurrentPowerPeak(swigCPtr, this) : SurfJNI.Cpu_getCurrentPowerPeakSwigExplicitCpu(swigCPtr, this);
67 public CpuAction execute(double size) {
68 long cPtr = SurfJNI.Cpu_execute(swigCPtr, this, size);
69 return (CpuAction)Surf.getCpuDirector(cPtr);
72 public CpuAction sleep(double duration) {
73 long cPtr = SurfJNI.Cpu_sleep(swigCPtr, this, duration);
74 return (CpuAction)Surf.getCpuDirector(cPtr);
77 public int getCore() {
78 return (getClass() == Cpu.class) ? SurfJNI.Cpu_getCore(swigCPtr, this) : SurfJNI.Cpu_getCoreSwigExplicitCpu(swigCPtr, this);
81 public double getSpeed(double load) {
82 return (getClass() == Cpu.class) ? SurfJNI.Cpu_getSpeed(swigCPtr, this, load) : SurfJNI.Cpu_getSpeedSwigExplicitCpu(swigCPtr, this, load);
85 public double getAvailableSpeed() {
86 return (getClass() == Cpu.class) ? SurfJNI.Cpu_getAvailableSpeed(swigCPtr, this) : SurfJNI.Cpu_getAvailableSpeedSwigExplicitCpu(swigCPtr, this);
89 public double getPowerPeakAt(int pstate_index) {
90 return SurfJNI.Cpu_getPowerPeakAt(swigCPtr, this, pstate_index);
93 public int getNbPstates() {
94 return SurfJNI.Cpu_getNbPstates(swigCPtr, this);
97 public void setPowerPeakAt(int pstate_index) {
98 SurfJNI.Cpu_setPowerPeakAt(swigCPtr, this, pstate_index);
101 public void setState(ResourceState state) {
102 SurfJNI.Cpu_setState(swigCPtr, this, state.swigValue());