📄 debug.cc
字号:
/* Copyright (c) University of Maryland, Baltimore County, 2003. * Original Authors: Ramakrishna Shenai, Sunil Gowda and Krishna Sivalingam. * * This software is developed at the University of Maryland, Baltimore County under * grants from Cisco Systems Inc and the University of Maryland, Baltimore County. * * Permission to use, copy, modify, and distribute this software and its * documentation in source and binary forms for non-commercial purposes * and without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both the copyright notice and * this permission notice appear in supporting documentation. and that * any documentation, advertising materials, and other materials related * to such distribution and use acknowledge that the software was * developed by the University of Maryland, Baltimore County. The name of * the University may not be used to endorse or promote products derived from * this software without specific prior written permission. * * Copyright (C) 2000-2003 Washington State University. All rights reserved. * This software was originally developed at Alcatel USA and subsequently modified * at Washington State University, Pullman, WA through research work which was * supported by Alcatel USA, Inc and Cisco Systems Inc. * The following notice is in adherence to the Washington State University * copyright policy follows. * * License is granted to copy, to use, and to make and to use derivative * works for research and evaluation purposes, provided that Washington * State University is acknowledged in all documentation pertaining to any such * copy or derivative work. Washington State University grants no other * licenses expressed or implied. The Washington State University name * should not be used in any advertising without its written permission. * * WASHINGTON STATE UNIVERSITY MAKES NO REPRESENTATIONS CONCERNING EITHER * THE MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE * FOR ANY PARTICULAR PURPOSE. The software is provided "as is" * without express or implied warranty of any kind. These notices must * be retained in any copies of any part of this software. */#include "debug.h"#ifndef DEBUG#define DEBUG#endifvoid Debug::debug( char * message ) { if( message == NULL ) return; char s[440]; sprintf( s, "(%lf): %s", Scheduler::instance().clock() * 1000., message ); Debug::debug_( s );}void Debug::markTr( int value, Packet *p ) { if( p == NULL ) return; hdr_cmn *ch = hdr_cmn::access( p ); hdr_ip *iph = hdr_ip::access( p ); if( ch->ptype() == PT_IPKT ) { char s[100]; hdr_IPKT *ipkth = hdr_IPKT::access( p ); unsigned long key = ipkth->C_burst_id_; if( iph->prio_ == 2 ) sprintf( s, "(%d) DB=== %ld", value, key ); else if( iph->prio_ == 1 ) sprintf( s, "(%d) BHP== %ld", value, key ); else { debug( "Error" ); exit (-1); } // Turn of trace marking for now . need to build custom traces for nam later TODO:: // debug( s ); return; }}// the name of the source file and the line number with messagevoid Debug::debug( char *filename, int line_num, char *message ) { if( filename == NULL || message == NULL ) return; else { char s[400]; sprintf( s, "%s: %d = > %s", filename, line_num, message ); Debug::debug( s ); }}void Debug::debug_(char *message) { if( message == NULL ) return;#ifdef DEBUG char out[1000] = "puts \" "; // GMG -- changed length of out from 120 to // 1000, to accommodate longer messages char trail[4] = " \" "; strcat(out,message); strcat( out, trail ); Tcl::instance().evalc(out);#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -