Permalink
Browse files

MODCLUSTER-322 Using AverageSystemLoadMetric can improperly cause a L…

…oad Factor of 0
  • Loading branch information...
1 parent d7ae6cd commit 2d53be1fc1651cedf5d7b50348e5bcc3d6a1de35 @pferraro pferraro committed Jul 17, 2012
@@ -45,6 +45,6 @@ public AverageSystemLoadMetric(OperatingSystemMXBean bean) {
@Override
public double getLoad(Engine engine) throws Exception {
- return this.bean.getSystemLoadAverage();
+ return this.bean.getSystemLoadAverage() / this.bean.getAvailableProcessors();
}
}
@@ -42,7 +42,8 @@ public void getLoad() throws Exception {
LoadMetric metric = new AverageSystemLoadMetric(bean);
Engine engine = mock(Engine.class);
- when(bean.getSystemLoadAverage()).thenReturn(0.25);
+ when(bean.getSystemLoadAverage()).thenReturn(0.50);
+ when(bean.getAvailableProcessors()).thenReturn(2);
double load = metric.getLoad(engine);

0 comments on commit 2d53be1

Please sign in to comment.