Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar, even if it is really pesky sometimes
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 19 Jan 2017 23:30:04 +0000 (00:30 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 19 Jan 2017 23:30:04 +0000 (00:30 +0100)
examples/java/energy/pstate/PstateRunner.java
examples/msg/energy-pstate/energy-pstate.c
src/mc/remote/Channel.hpp

index 7319c3a..859149e 100644 (file)
@@ -25,54 +25,53 @@ public class PstateRunner extends Process {
                @Override
                public void main(String[] strings) throws HostNotFoundException, HostFailureException, TaskCancelledException {
                        double workload = 100E6;
                @Override
                public void main(String[] strings) throws HostNotFoundException, HostFailureException, TaskCancelledException {
                        double workload = 100E6;
-                       int new_peak_index=2;
+                       int newPstate = 2;
                        Host host = getHost();
 
                        int nb = host.getPstatesCount();
                        Msg.info("Count of Processor states="+ nb);
 
                        Host host = getHost();
 
                        int nb = host.getPstatesCount();
                        Msg.info("Count of Processor states="+ nb);
 
-                       double current_peak = host.getCurrentPowerPeak();
-                       Msg.info("Current power peak=" + current_peak);
+                       double currentPeak = host.getCurrentPowerPeak();
+                       Msg.info("Current power peak=" + currentPeak);
 
                        // Run a task
                        Task task1 = new Task("t1", workload, 0);
                        task1.execute();
 
 
                        // Run a task
                        Task task1 = new Task("t1", workload, 0);
                        task1.execute();
 
-                       double task_time = Msg.getClock();
-                       Msg.info("Task1 simulation time: "+ task_time);
+                       double taskTime = Msg.getClock();
+                       Msg.info("Task1 simulation time: "+ taskTime);
 
                        // Change power peak
 
                        // Change power peak
-                       if ((new_peak_index >= nb) || (new_peak_index < 0)){
-                               Msg.info("Cannot set pstate "+new_peak_index+"%d, host supports only "+nb+" pstates.");
+                       if ((newPstate >= nb) || (newPstate < 0)){
+                               Msg.info("Cannot set pstate "+newPstate+"%d, host supports only "+nb+" pstates.");
                                return;
                        }
 
                                return;
                        }
 
-                       double peak_at = host.getPowerPeakAt(new_peak_index);
-                       Msg.info("Changing power peak value to "+peak_at+" (at index "+new_peak_index+")");
+                       double peakAt = host.getPowerPeakAt(newPstate);
+                       Msg.info("Changing power peak value to "+peakAt+" (at index "+newPstate+")");
 
 
-                       host.setPstate(new_peak_index);
+                       host.setPstate(newPstate);
 
 
-                       current_peak = host.getCurrentPowerPeak();
-                       Msg.info("Current power peak="+ current_peak);
+                       currentPeak = host.getCurrentPowerPeak();
+                       Msg.info("Current power peak="+ currentPeak);
 
                        // Run a second task
 
                        // Run a second task
-                       task1 = new Task("t1", workload, 0);
+                       new Task("t1", workload, 0).execute();;
 
 
-                       task_time = Msg.getClock() - task_time;
-                       Msg.info("Task2 simulation time: "+ task_time);
+                       taskTime = Msg.getClock() - taskTime;
+                       Msg.info("Task2 simulation time: "+ taskTime);
 
                        // Verify the default pstate is set to 0
                        host = Host.getByName("MyHost2");
                        int nb2 = host.getPstatesCount();
                        Msg.info("Count of Processor states="+ nb2);
 
 
                        // Verify the default pstate is set to 0
                        host = Host.getByName("MyHost2");
                        int nb2 = host.getPstatesCount();
                        Msg.info("Count of Processor states="+ nb2);
 
-                       double current_peak2 = host.getCurrentPowerPeak();
-                       Msg.info("Current power peak=" + current_peak2);
-                       return ;
+                       double currentPeak2 = host.getCurrentPowerPeak();
+                       Msg.info("Current power peak=" + currentPeak2);
                }
        }
 
                }
        }
 
-       PstateRunner(Host host, String name, String[] args) throws HostNotFoundException, NativeException  {
+       PstateRunner(Host host, String name, String[] args) throws NativeException  {
                super(host, name, args);
        }
 
                super(host, name, args);
        }
 
index 12beaf5..ae27813 100644 (file)
@@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Pstate properties test");
 static int dvfs(int argc, char *argv[])
 {
   double workload = 100E6;
 static int dvfs(int argc, char *argv[])
 {
   double workload = 100E6;
-  int new_peak_index=2;
+  int new_pstate  = 2;
   msg_host_t host = MSG_host_self();
 
   int nb = MSG_host_get_nb_pstates(host);
   msg_host_t host = MSG_host_self();
 
   int nb = MSG_host_get_nb_pstates(host);
@@ -37,15 +37,15 @@ static int dvfs(int argc, char *argv[])
   XBT_INFO("Task1 simulation time: %e", task_time);
 
   // Change power peak
   XBT_INFO("Task1 simulation time: %e", task_time);
 
   // Change power peak
-  if ((new_peak_index >= nb) || (new_peak_index < 0)){
-    XBT_INFO("Cannot set pstate %d, host supports only %d pstates", new_peak_index, nb);
+  if ((new_pstate >= nb) || (new_pstate < 0)) {
+    XBT_INFO("Cannot set pstate %d, host supports only %d pstates", new_pstate, nb);
     return 0;
   }
 
     return 0;
   }
 
-  double peak_at = MSG_host_get_power_peak_at(host, new_peak_index);
-  XBT_INFO("Changing power peak value to %f (at index %d)", peak_at, new_peak_index);
+  double peak_at = MSG_host_get_power_peak_at(host, new_pstate);
+  XBT_INFO("Changing power peak value to %f (at index %d)", peak_at, new_pstate);
 
 
-  MSG_host_set_pstate(host, new_peak_index);
+  MSG_host_set_pstate(host, new_pstate);
 
   current_peak = MSG_host_get_current_power_peak(host);
   XBT_INFO("Current power peak=%f", current_peak);
 
   current_peak = MSG_host_get_current_power_peak(host);
   XBT_INFO("Current power peak=%f", current_peak);
index f3e2ce9..c3fb006 100644 (file)
@@ -29,7 +29,7 @@ class Channel {
   }
 
 public:
   }
 
 public:
-  Channel() {}
+  Channel() = default;
   explicit Channel(int sock) : socket_(sock) {}
   ~Channel();
 
   explicit Channel(int sock) : socket_(sock) {}
   ~Channel();