⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logger.h

📁 浙江大学的悟空嵌入式系统模拟器
💻 H
字号:
/**
 *  Copyright (c) 2005 Zhejiang University, P.R.China
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */ 

///==================================================
/**
 * @file        Logger.h
 * @brief       Log facility
 *
 * @author      Chenfeng Zhou <ini_autumn@163.com> 
 *
 * Created    : <2005-04-04 19:22:41 by Cheney Chow>
 * Last update: <2005-04-04 20:35:54 by Cheney Chow>
 *
 * $Id: Logger.h,v 1.1 2005/06/16 06:06:36 qilj Exp $
 */
///==================================================

#ifndef _LOGGER_H_
#define _LOGGER_H_

#include <string>
#include <fstream>

#include "Utils/Singleton.h"
#include "PPC.h"

namespace PPC {
    
    class PPC_API S_Logger {
    public:
        //enum {DISABLE = 0x0, STDOUT = 0x1, FILE = 0x2};
    
    public:
        S_Logger ();
        ~S_Logger ();

        void set_flag (size_t flag) {flag_ = flag;}

        int init_logfile (std::string file);

        void dump_cpu_state ();

		void dump_mem(Core::u32 start, Core::u32 end);

		/// Trace switch;
		void enable_trace () {enable_trace_ = true;}

		void disable_trace () {enable_trace_ = false;}

		bool is_tracing () {return enable_trace_;}
        
    private:
		bool enable_trace_;

        size_t flag_;
        FILE *log_;
    };

    typedef PPC_Singleton<S_Logger> Logger;
}
#endif  // _LOGGER_H_

⌨️ 快捷键说明

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