Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
6c20206a7f1169d5df6ca0beefc6b3b17335ed1f
[simgrid.git] / src / bindings / java / org / simgrid / surf / Cpu.java
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 2.0.11
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8
9 package org.simgrid.surf;
10
11 public class Cpu extends Resource {
12   private long swigCPtr;
13
14   protected Cpu(long cPtr, boolean cMemoryOwn) {
15     super(SurfJNI.Cpu_SWIGUpcast(cPtr), cMemoryOwn);
16     swigCPtr = cPtr;
17   }
18
19   protected static long getCPtr(Cpu obj) {
20     return (obj == null) ? 0 : obj.swigCPtr;
21   }
22
23   protected void finalize() {
24     delete();
25   }
26
27   public synchronized void delete() {
28     if (swigCPtr != 0) {
29       if (swigCMemOwn) {
30         swigCMemOwn = false;
31         SurfJNI.delete_Cpu(swigCPtr);
32       }
33       swigCPtr = 0;
34     }
35     super.delete();
36   }
37
38   protected void swigDirectorDisconnect() {
39     swigCMemOwn = false;
40     delete();
41   }
42
43   public void swigReleaseOwnership() {
44     swigCMemOwn = false;
45     SurfJNI.Cpu_change_ownership(this, swigCPtr, false);
46   }
47
48   public void swigTakeOwnership() {
49     swigCMemOwn = true;
50     SurfJNI.Cpu_change_ownership(this, swigCPtr, true);
51   }
52
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);
56   }
57
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);
61   }
62
63   public double getCurrentPowerPeak() {
64     return (getClass() == Cpu.class) ? SurfJNI.Cpu_getCurrentPowerPeak(swigCPtr, this) : SurfJNI.Cpu_getCurrentPowerPeakSwigExplicitCpu(swigCPtr, this);
65   }
66
67   public CpuAction execute(double size) {
68   long cPtr = SurfJNI.Cpu_execute(swigCPtr, this, size);
69   return (CpuAction)Surf.getCpuDirector(cPtr);
70 }
71
72   public CpuAction sleep(double duration) {
73   long cPtr = SurfJNI.Cpu_sleep(swigCPtr, this, duration);
74   return (CpuAction)Surf.getCpuDirector(cPtr);
75 }
76
77   public int getCore() {
78     return (getClass() == Cpu.class) ? SurfJNI.Cpu_getCore(swigCPtr, this) : SurfJNI.Cpu_getCoreSwigExplicitCpu(swigCPtr, this);
79   }
80
81   public double getSpeed(double load) {
82     return (getClass() == Cpu.class) ? SurfJNI.Cpu_getSpeed(swigCPtr, this, load) : SurfJNI.Cpu_getSpeedSwigExplicitCpu(swigCPtr, this, load);
83   }
84
85   public double getAvailableSpeed() {
86     return (getClass() == Cpu.class) ? SurfJNI.Cpu_getAvailableSpeed(swigCPtr, this) : SurfJNI.Cpu_getAvailableSpeedSwigExplicitCpu(swigCPtr, this);
87   }
88
89   public double getPowerPeakAt(int pstate_index) {
90     return SurfJNI.Cpu_getPowerPeakAt(swigCPtr, this, pstate_index);
91   }
92
93   public int getNbPstates() {
94     return SurfJNI.Cpu_getNbPstates(swigCPtr, this);
95   }
96
97   public void setPowerPeakAt(int pstate_index) {
98     SurfJNI.Cpu_setPowerPeakAt(swigCPtr, this, pstate_index);
99   }
100
101   public void setState(ResourceState state) {
102     SurfJNI.Cpu_setState(swigCPtr, this, state.swigValue());
103   }
104
105 }