You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
889 B
39 lines
889 B
package generic;
|
|
|
|
import java.io.PrintWriter;
|
|
|
|
public class Statistics {
|
|
|
|
// TODO add your statistics here
|
|
static int numberOfInstructions;
|
|
static int numberOfCycles;
|
|
|
|
|
|
public static void printStatistics(String statFile)
|
|
{
|
|
try
|
|
{
|
|
PrintWriter writer = new PrintWriter(statFile);
|
|
|
|
writer.println("Number of instructions executed = " + numberOfInstructions);
|
|
writer.println("Number of cycles taken = " + numberOfCycles);
|
|
|
|
// TODO add code here to print statistics in the output file
|
|
|
|
writer.close();
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
Misc.printErrorAndExit(e.getMessage());
|
|
}
|
|
}
|
|
|
|
// TODO write functions to update statistics
|
|
public void setNumberOfInstructions(int numberOfInstructions) {
|
|
Statistics.numberOfInstructions = numberOfInstructions;
|
|
}
|
|
|
|
public void setNumberOfCycles(int numberOfCycles) {
|
|
Statistics.numberOfCycles = numberOfCycles;
|
|
}
|
|
}
|
|
|