From: Bert Hubert Date: Thu, 3 Feb 2011 14:54:06 +0000 (+0000) Subject: add udiffNoReset for running time measurements X-Git-Tag: auth-3.0~279 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=62c3a7b83150b599052907fb61fc1393ce001777;p=thirdparty%2Fpdns.git add udiffNoReset for running time measurements git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1968 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/misc.hh b/pdns/misc.hh index b39c59d0e4..4c6169ca2c 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -203,6 +203,7 @@ public: time_t time(); inline void set(); //!< Reset the timer inline int udiff(); //!< Return the number of microseconds since the timer was last set. + inline int udiffNoReset(); //!< Return the number of microseconds since the timer was last set. void setTimeval(const struct timeval& tv) { d_set=tv; @@ -223,15 +224,22 @@ inline void DTime::set() } inline int DTime::udiff() +{ + int res=udiffNoReset(); + Utility::gettimeofday(&d_set,0); + return res; +} + +inline int DTime::udiffNoReset() { struct timeval now; Utility::gettimeofday(&now,0); int ret=1000000*(now.tv_sec-d_set.tv_sec)+(now.tv_usec-d_set.tv_usec); - d_set=now; return ret; } + inline bool dns_isspace(char c) { return c==' ' || c=='\t' || c=='\r' || c=='\n';