Skip to content
Snippets Groups Projects
Commit b8f29d3c authored by Christian Wulf's avatar Christian Wulf
Browse files

fixed #149 Move getNumWaits to IMonitoringPipe;

moved test framework classes to src/main/java;
parent af4e244c
No related branches found
No related tags found
No related merge requests found
Showing
with 40 additions and 19 deletions
#FindBugs User Preferences
#Thu Apr 30 18:04:06 CEST 2015
#Mon May 04 12:38:24 CEST 2015
detector_threshold=3
effort=max
excludefilter0=.fbExcludeFilterFile|true
......
......@@ -26,4 +26,10 @@ public interface IMonitorablePipe {
long getPushThroughput();
long getPullThroughput();
/**
*
* @return the number of pauses of the pushing stage
*/
int getNumWaits();
}
......@@ -35,7 +35,7 @@ final class SpScPipe extends AbstractInterThreadPipe implements IMonitorablePipe
}
@Deprecated
public static <T> SpScPipe connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) {
public static <T> IMonitorablePipe connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) {
final SpScPipe pipe = new SpScPipe(sourcePort, targetPort, capacity);
pipe.connectPorts(sourcePort, targetPort);
return pipe;
......@@ -81,8 +81,8 @@ final class SpScPipe extends AbstractInterThreadPipe implements IMonitorablePipe
return this.queue.size();
}
// BETTER find a solution w/o any thread-safe code in this stage
public synchronized int getNumWaits() {
@Override
public int getNumWaits() {
return this.numWaits;
}
......
......@@ -27,13 +27,13 @@ import java.util.List;
*/
public final class CyclicListIterator<T> implements Iterator<T> {
private final List<T> list;
private final List<T> elements;
// private Iterator<T> iterator;
private int currentIndex = 0;
public CyclicListIterator(final List<T> list) {
this.list = list;
public CyclicListIterator(final List<T> elements) {
this.elements = elements;
// this.iterator = this.list.iterator();
}
......@@ -53,7 +53,7 @@ public final class CyclicListIterator<T> implements Iterator<T> {
// <li>an index overflow (then restart from index 0), or
// <li>an add() or a remove(), so update the index
this.currentIndex = this.getCurrentIndex();
final T element = this.list.get(this.currentIndex);
final T element = this.elements.get(this.currentIndex);
this.currentIndex++;
return element;
}
......@@ -62,11 +62,11 @@ public final class CyclicListIterator<T> implements Iterator<T> {
public void remove() {
// this.iterator.remove();
this.currentIndex = this.getCurrentIndex();
this.list.remove(this.currentIndex);
this.elements.remove(this.currentIndex);
}
private int getCurrentIndex() {
return this.currentIndex % this.list.size();
return this.currentIndex % this.elements.size();
}
}
......@@ -25,12 +25,12 @@ public final class ListUtil {
}
public static <T> List<T> merge(final List<List<T>> listOfLists) {
List<T> resultList = listOfLists.get(0);
List<T> mergedElements = listOfLists.get(0);
for (int i = 1; i < listOfLists.size(); i++) {
Collection<? extends T> timestampObjectList = listOfLists.get(i);
resultList.addAll(timestampObjectList);
Collection<? extends T> elements = listOfLists.get(i);
mergedElements.addAll(elements);
}
return resultList;
return mergedElements;
}
public static <T> List<T> removeFirstHalfElements(final List<T> list) {
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package util.test;
package teetime.util.test.framework;
public abstract class AbstractProfiledPerformanceAssertion {
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package util.test;
package teetime.util.test.framework;
import java.util.HashMap;
import java.util.Map;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package util.test;
package teetime.util.test.framework;
import java.net.InetAddress;
import java.net.UnknownHostException;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package util.test;
package teetime.util.test.framework;
import java.util.ArrayList;
import java.util.List;
......
wiki @ 0e447457
Subproject commit bb53dfd7de974a433a7b96b0b65f4aacb8da3df3
Subproject commit 0e4474577e1f49bc96e734c286b2d9e0363895e8
/**
* Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (http://teetime.sourceforge.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package teetime.framework.pipe;
import static org.junit.Assert.assertFalse;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment