use of jbe.BenchLift in project jop by jop-devel.
the class LiftBenchCMP method main.
public static void main(String[] args) {
// Initialization for benchmarking
int start = 0;
int stop = 0;
int time = 0;
System.out.println("Lift Benchmark:");
SysDevice sys = IOFactory.getFactory().getSysDevice();
bm_array = new BenchMark[sys.nrCpu];
loop_array = new int[sys.nrCpu];
// Calculates the number of loops for each CPU
int rest = cnt % sys.nrCpu;
for (int j = 0; j < sys.nrCpu; j++) {
if (rest != 0) {
loop_array[j] = cnt / sys.nrCpu + 1;
rest--;
} else
loop_array[j] = cnt / sys.nrCpu;
}
bm_array[0] = new BenchLift();
for (int i = 0; i < sys.nrCpu - 1; i++) {
bm_array[i + 1] = new BenchLift();
Runnable r = new LiftBenchCMP(i + 1, loop_array[i + 1], bm_array[i + 1]);
Startup.setRunnable(r, i);
}
// Insert for comparison with single CPU performance
//loop_array[0]=cnt;
// Start of measurement
start = LowLevel.timeMillis();
// Start of all other CPUs
sys.signal = 1;
// Start of CPU0
bm_array[0].test(loop_array[0]);
while (true) {
synchronized (lock) {
if (signal == sys.nrCpu - 1)
break;
}
}
// End of measurement
stop = LowLevel.timeMillis();
System.out.println("StartTime: " + start);
System.out.println("StopTime: " + stop);
time = stop - start;
System.out.println("TimeSpent: " + time);
for (int i = 0; i < sys.nrCpu; ++i) {
System.out.println("CPU " + i + " calculated " + loop_array[i] + " loops");
}
}
use of jbe.BenchLift in project jop by jop-devel.
the class LiftBenchCMP_RamCounter method main.
public static void main(String[] args) {
// Initialization for Ram access counter
int count0 = 0;
int count1 = 0;
int us0 = 0;
int us1 = 0;
int count_result = 0;
int us_result = 0;
System.out.println("Bandwidth:");
SysDevice sys = IOFactory.getFactory().getSysDevice();
bm_array = new BenchMark[sys.nrCpu];
loop_array = new int[sys.nrCpu];
// Calculates the number of loops for each CPU
int rest = cnt % sys.nrCpu;
for (int j = 0; j < sys.nrCpu; j++) {
if (rest != 0) {
loop_array[j] = cnt / sys.nrCpu + 1;
rest--;
} else
loop_array[j] = cnt / sys.nrCpu;
}
bm_array[0] = new BenchLift();
for (int i = 0; i < sys.nrCpu - 1; i++) {
bm_array[i + 1] = new BenchLift();
Runnable r = new LiftBenchCMP_RamCounter(i + 1, loop_array[i + 1], bm_array[i + 1]);
Startup.setRunnable(r, i);
}
// Startpoint of measuring
count0 = sys.deadLine;
//us0 = sys.uscntTimer;
// Clockcycles
us0 = Native.rdMem(Const.IO_CNT);
// Start of CPU0
bm_array[0].test(loop_array[0]);
// Start of all other CPUs
sys.signal = 1;
while (true) {
synchronized (lock) {
if (signal == sys.nrCpu - 1)
break;
}
}
// End of measurement
// Clockcycles
us1 = Native.rdMem(Const.IO_CNT);
count1 = sys.deadLine;
count_result = count1 - count0;
us_result = us1 - us0;
LowLevel.msg("RAM Accesses:", count_result);
LowLevel.lf();
LowLevel.msg("Time us:", us_result);
LowLevel.lf();
LowLevel.msg("in %:", count_result / (us_result / 100));
LowLevel.lf();
}