# HG changeset patch # User marci # Date 1081951068 0 # Node ID 58bc28afea631c941c6039344c9f065e8e2bdce3 # Parent a42dacfd0e3e885f75b000b6b2ecaea256de01e8 gw, kiszedtem ami nem kell diff -r a42dacfd0e3e -r 58bc28afea63 src/work/marci/graph_wrapper.h --- a/src/work/marci/graph_wrapper.h Wed Apr 14 13:30:05 2004 +0000 +++ b/src/work/marci/graph_wrapper.h Wed Apr 14 13:57:48 2004 +0000 @@ -462,19 +462,27 @@ return i; } - - Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); } - Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); } - Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); } - Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); } - // template I& next(I &i) const { // graph->next(i); // // while (graph->valid(i) && !filter_map-get(i)) { graph->next(i); } // while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); } // return i; -// } - +// } + + Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); } + Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); } + Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); } + Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); } + + void hide(const Node& n) const { node_filter_map->set(n, false); } + void hide(const Edge& e) const { edge_filter_map->set(e, false); } + + void unHide(const Node& n) const { node_filter_map->set(n, true); } + void unHide(const Edge& e) const { edge_filter_map->set(e, true); } + + bool hidden(const Node& n) const { return (*node_filter_map)[n]; } + bool hidden(const Edge& e) const { return (*edge_filter_map)[e]; } + template< typename It > It first() const { It e; this->first(e); return e; } diff -r a42dacfd0e3e -r 58bc28afea63 src/work/marci/time_measure.h --- a/src/work/marci/time_measure.h Wed Apr 14 13:30:05 2004 +0000 +++ b/src/work/marci/time_measure.h Wed Apr 14 13:57:48 2004 +0000 @@ -8,123 +8,127 @@ #include #include -double currTime() { - timeval tv; - //timezone tz; - gettimeofday(&tv, 0); - return double(tv.tv_sec)+double(tv.tv_usec)/1000000.0; -} +namespace hugo { -class TimeStamp -{ - tms ts; - double real_time; +// double currTime() { +// timeval tv; +// //timezone tz; +// gettimeofday(&tv, 0); +// return double(tv.tv_sec)+double(tv.tv_usec)/1000000.0; +// } + + class TimeStamp + { + tms ts; + double real_time; -public: + public: - tms &getTms() {return ts;} - const tms &getTms() const {return ts;} - double getRealTime() const {return real_time;} - void stamp() + tms &getTms() {return ts;} + const tms &getTms() const {return ts;} + double getRealTime() const {return real_time;} + void stamp() + { + timeval tv; + times(&ts); + gettimeofday(&tv, 0);real_time=tv.tv_sec+double(tv.tv_usec)/1e6; + } + + TimeStamp() + { ts.tms_utime=ts.tms_stime=ts.tms_cutime=ts.tms_cstime=0; real_time=0;} + + TimeStamp(void *) { stamp();} + + TimeStamp &operator+=(const TimeStamp &b) + { + ts.tms_utime+=b.ts.tms_utime; + ts.tms_stime+=b.ts.tms_stime; + ts.tms_cutime+=b.ts.tms_cutime; + ts.tms_cstime+=b.ts.tms_cstime; + real_time+=b.real_time; + return *this; + } + TimeStamp operator+(const TimeStamp &b) const + { + TimeStamp t(*this); + return t+=b; + } + TimeStamp &operator-=(const TimeStamp &b) + { + ts.tms_utime-=b.ts.tms_utime; + ts.tms_stime-=b.ts.tms_stime; + ts.tms_cutime-=b.ts.tms_cutime; + ts.tms_cstime-=b.ts.tms_cstime; + real_time-=b.real_time; + return *this; + } + TimeStamp operator-(const TimeStamp &b) const + { + TimeStamp t(*this); + return t-=b; + } + + TimeStamp Ellapsed() const + { + TimeStamp t(NULL); + return t-*this; + } + + friend std::ostream& operator<<(std::ostream& os,const TimeStamp &t); + + double getUserTime() const + { + return double(ts.tms_utime)/sysconf(_SC_CLK_TCK); + } + double getSystemTime() const + { + return double(ts.tms_stime)/sysconf(_SC_CLK_TCK); + } + double getCUserTime() const + { + return double(ts.tms_cutime)/sysconf(_SC_CLK_TCK); + } + double getCSystemTime() const + { + return double(ts.tms_cstime)/sysconf(_SC_CLK_TCK); + } + }; + + class Timer { - timeval tv; - times(&ts); - gettimeofday(&tv, 0);real_time=tv.tv_sec+double(tv.tv_usec)/1e6; - } + TimeStamp start_time; + + void _reset() {start_time.stamp();} - TimeStamp() - { ts.tms_utime=ts.tms_stime=ts.tms_cutime=ts.tms_cstime=0; real_time=0;} - - TimeStamp(void *) { stamp();} - - TimeStamp &operator+=(const TimeStamp &b) + public: + Timer() {_reset();} + + operator TimeStamp () + { + TimeStamp t; + t.stamp(); + return t-start_time; + } + + TimeStamp reset() + { + TimeStamp t(start_time); + _reset(); + return start_time-t; + } + }; + + inline std::ostream& operator<<(std::ostream& os,const TimeStamp &t) { - ts.tms_utime+=b.ts.tms_utime; - ts.tms_stime+=b.ts.tms_stime; - ts.tms_cutime+=b.ts.tms_cutime; - ts.tms_cstime+=b.ts.tms_cstime; - real_time+=b.real_time; - return *this; - } - TimeStamp operator+(const TimeStamp &b) const - { - TimeStamp t(*this); - return t+=b; - } - TimeStamp &operator-=(const TimeStamp &b) - { - ts.tms_utime-=b.ts.tms_utime; - ts.tms_stime-=b.ts.tms_stime; - ts.tms_cutime-=b.ts.tms_cutime; - ts.tms_cstime-=b.ts.tms_cstime; - real_time-=b.real_time; - return *this; - } - TimeStamp operator-(const TimeStamp &b) const - { - TimeStamp t(*this); - return t-=b; + long cls = sysconf(_SC_CLK_TCK); + os << "u: " << double(t.getTms().tms_utime)/cls << + "s, s: " << double(t.getTms().tms_stime)/cls << + "s, cu: " << double(t.getTms().tms_cutime)/cls << + "s, cs: " << double(t.getTms().tms_cstime)/cls << + "s, real: " << t.getRealTime() << "s"; + return os; } - TimeStamp Ellapsed() const - { - TimeStamp t(NULL); - return t-*this; - } - - friend std::ostream& operator<<(std::ostream& os,const TimeStamp &t); - - double getUserTime() const - { - return double(ts.tms_utime)/sysconf(_SC_CLK_TCK); - } - double getSystemTime() const - { - return double(ts.tms_stime)/sysconf(_SC_CLK_TCK); - } - double getCUserTime() const - { - return double(ts.tms_cutime)/sysconf(_SC_CLK_TCK); - } - double getCSystemTime() const - { - return double(ts.tms_cstime)/sysconf(_SC_CLK_TCK); - } -}; - -class Timer -{ - TimeStamp start_time; - - void _reset() {start_time.stamp();} - -public: - Timer() {_reset();} - - operator TimeStamp () - { - TimeStamp t; - t.stamp(); - return t-start_time; - } - - TimeStamp reset() - { - TimeStamp t(start_time); - _reset(); - return start_time-t; - } -}; - -inline std::ostream& operator<<(std::ostream& os,const TimeStamp &t) -{ - long cls = sysconf(_SC_CLK_TCK); - os << "u: " << double(t.getTms().tms_utime)/cls << - "s, s: " << double(t.getTms().tms_stime)/cls << - "s, cu: " << double(t.getTms().tms_cutime)/cls << - "s, cs: " << double(t.getTms().tms_cstime)/cls << - "s, real: " << t.getRealTime() << "s"; - return os; -} +} //namespace hugo #endif //HUGO_TIME_MEASURE_H