profile.c

来自「一个用在mips体系结构中的操作系统」· C语言 代码 · 共 87 行

C
87
字号
/* * Copyright (C) 1996-1998 by the Board of Trustees *    of Leland Stanford Junior University. *  * This file is part of the SimOS distribution.  * See LICENSE file for terms of the license.  * *//***************************************************************** * profile.c *  * Profiling support for simos. You must use a special "prof" to * view the results generated here. We currently only support * profiling on the SGI platform.  * * $Author: bosch $ * $Date: 1998/02/10 00:29:46 $ *****************************************************************/#include <sys/types.h> #include <sys/time.h>#include <fcntl.h>#include <stdlib.h>#include "simutil.h"#include "sim_error.h"#include "profile.h"#ifdef PROFILING#if defined(sgi)#include <cmplrs/prof_header.h>#include <sys/profil.h>extern int monitor(int, int, void *, void *);extern void moncontrol(int);extern _ftext[];extern etext[]; extern int errno;#endifvoidStartProfile(void){#ifdef sgi    int err = 0;    err = monitor(0, 1, _ftext, etext);    if (err < 0) {       CPUWarning("Error enabling profiling, errno = %d\n", errno);       return;    }    CPUWarning("SIMOS: Starting profile\n");#else    CPUWarning("SIMOS: Profiling only available on SGI's\n");#endif}void StopProfile(void){#ifdef sgi   moncontrol(3);   CPUWarning("SIMOS: Stopping profile\n");   return;#else    CPUWarning("SIMOS: Profiling only available on SGI's\n");#endif}#else/* PROFILING IS NOT DEFINED */void StartProfile(void){   CPUWarning("SIMOS: Must define PROFILING to use profiling\n");}void StopProfile(void){   CPUWarning("SIMOS: Must define PROFILING to use profiling\n");}#endif

⌨️ 快捷键说明

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