[ RCOS.java Home | RCOS Home | David's Home ]

Statistics CRC

Name:

Statistics

Comment:

The following class defines the statistics that are to be kept about Nachos behavior -- how much time (ticks) elapsed, how many user instructions executed, etc.

The fields in this class are public to make it easier to update.

Collaborators:

Responsibilities:

class Statistics {
  public:
    int totalTicks;             // Total time running Nachos
    int idleTicks;              // Time spent idle (no threads to run)
    int systemTicks;            // Time spent executing system code
    int userTicks;              // Time spent executing user code
                                // (this is also equal to # of
                                // user instructions executed)

    int numDiskReads;           // number of disk read requests
    int numDiskWrites;          // number of disk write requests
    int numConsoleCharsRead;    // number of characters read from the keyboard
    int numConsoleCharsWritten; // number of characters written to the display
    int numPageFaults;          // number of virtual memory page faults
    int numPacketsSent;         // number of packets sent over the network
    int numPacketsRecvd;        // number of packets received over the network

    Statistics();               // initialize everything to zero

    void Print();               // print collected statistics
};