stats.cc

来自「nachos test nachos 有关实验」· CC 代码 · 共 45 行

CC
45
字号
// stats.h //	Routines for managing statistics about Nachos performance.//// DO NOT CHANGE -- these stats are maintained by the machine emulation.//// Copyright (c) 1992-1993 The Regents of the University of California.// All rights reserved.  See copyright.h for copyright notice and limitation // of liability and disclaimer of warranty provisions.#include "copyright.h"#include "utility.h"#include "stats.h"//----------------------------------------------------------------------// Statistics::Statistics// 	Initialize performance metrics to zero, at system startup.//----------------------------------------------------------------------Statistics::Statistics(){    totalTicks = idleTicks = systemTicks = userTicks = 0;    numDiskReads = numDiskWrites = 0;    numConsoleCharsRead = numConsoleCharsWritten = 0;    numPageFaults = numPacketsSent = numPacketsRecvd = 0;}//----------------------------------------------------------------------// Statistics::Print// 	Print performance metrics, when we've finished everything//	at system shutdown.//----------------------------------------------------------------------voidStatistics::Print(){    printf("Ticks: total %d, idle %d, system %d, user %d\n", totalTicks, 	idleTicks, systemTicks, userTicks);    printf("Disk I/O: reads %d, writes %d\n", numDiskReads, numDiskWrites);    printf("Console I/O: reads %d, writes %d\n", numConsoleCharsRead, 	numConsoleCharsWritten);    printf("Paging: faults %d\n", numPageFaults);    printf("Network I/O: packets received %d, sent %d\n", numPacketsRecvd, 	numPacketsSent);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?