📄 nodetrace.h
字号:
/* -*- Mode:C++; c-basic-offset:8; tab-width:8 -*- *//* */#ifndef ns_nodetrace_h#define ns_nodetrace_h#include <math.h> //floor#include "tcp.h"class NodeTrace : public TclObject {public: virtual int command(int argc, const char*const* argv); NodeTrace(); ~NodeTrace(); static int get_seqno(Packet *p); static void format (int tt, char* nodeaddress, Packet *p); static void dump(); static inline char* buffer() { return wrk_ ; } static inline Tcl_Channel channel() { return channel_; } static inline void channel(Tcl_Channel ch) {channel_ = ch; } void flush(Tcl_Channel channel) { Tcl_Flush(channel); } //Default rounding is to 6 digits after decimal#define PRECISION 1.0E+6 //According to freeBSD /usr/include/float.h 15 is the number of digits // in a double. We can specify all of them, because we're rounding to // 6 digits after the decimal and and %g removes trailing zeros.#define TIME_FORMAT "%.15g" // annoying way of tackling sprintf rounding platform // differences : // use round(Scheduler::instance().clock()) instead of // Scheduler::instance().clock(). static double round (double x, double precision=PRECISION) { return (double)floor(x*precision + 0.5)/precision; } static inline bool tagged() { return tagged_; } static inline void tagged(bool tag) { tagged_ = tag; } static NodeTrace& instance(); //returns the ref to this object static int trace_on_; // 1/0 == trace is on/off protected: static Tcl_Channel channel_; static char *wrk_; static bool tagged_; static NodeTrace *instance__; //Self referential static instance // (like stat collector)};#endif // NodeTrace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -