FileDocCategorySizeDatePackage
LoopUser.javaAPI DocExample2753Thu Feb 04 16:10:44 GMT 1999None

LoopUser

public class LoopUser extends Object implements ScaleTester

Fields Summary
private float[]
lookupValues
private int
nRows
private int
nCols
private int
nThreads
private LoopUserThread[]
worker
Constructors Summary
Methods Summary
public float[][]doCalc()

		for (int i = 0; i < nCols; i++) {
			lookupValues[0][i] = 0;
		}
		for (int i = 0; i < nThreads; i++)
			worker[i].start();
		for (int i = 0; i < nThreads; i++) {
			try {
				worker[i].join();
			} catch (InterruptedException ie) {}
		}
		return lookupValues;
	
public voidinit(int nRows, int nCols, int nThreads)

		int start, end;

		this.nRows = nRows;
		this.nCols = nCols;
		this.nThreads = nThreads;
		lookupValues = new float[nRows][];
		for (int j = 0; j < nRows; j++) {
			lookupValues[j] = new float[nCols];
		}
		end = 0;
		worker = new LoopUserThread[nThreads];
		for (int i = 0; i < nThreads; i++) {
			start = end;
			end += (nCols / nThreads) + 1;
			if (end > nCols)
				end = nCols;
			worker[i] = new LoopUserThread(start, end);
		}