// System.out.println(t + " reading at " +
fileOffset);
fd.seek(fileOffset);
err = fd.read(b, 0, 1);
if (err == -1) {
throw new IOException();
}
InterruptibleThread.spin(spinTime * 1000);
nProcessed[me]++;
// It's interesting to see the results of yield()
here
// when using > 1 GREEN THREADS. (The results are
what
// you expect -- same performance only spread to all
// threads.) You would never include this in a "real"
// program.
//
Thread.yield();
}
// If one thread completes MAX_READS, all quit.
// This is probably because you're using GREEN THREADS.
stop = true;
} catch (IOException e) {
System.out.println("Is " + path + " correct? \n" +e);
System.exit(-1);
}
}
public static void main(String argv[]) throws Exception {
int
totalProcessed;
double[] rates = new double[MAX_THREADS];
double
S = 0.0, mean, rate_sum = 0.0, realtime;
Thread
t;
if (argv.length > 0)
nThreads = Integer.parseInt(argv[0]);
if (argv.length > 1)
spinTime = Integer.parseInt(argv[1]);
if (argv.length > 2)
runtime = Integer.parseInt(argv[2]);
if (argv.length > 3)
iterations = Integer.parseInt(argv[3]);
if (argv.length > 4)
setConcurrency = (Integer.parseInt(argv[4]) == 1);
if (System.getProperty("DEBUG") != null) DEBUG = true;
System.out.println("Test(nThreads: " + nThreads +
" spinTime: " + spinTime + "ms runtime: " + runtime +
"s iterations " + iterations + " setConcurrency: " +
setConcurrency + ")");
if (spinTime > 0)
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks
Home