style: 整理远程桌面代码

This commit is contained in:
yuanyuanxiang
2019-09-07 10:47:50 +08:00
parent 5a7145a5ac
commit fa383037a4
9 changed files with 171 additions and 135 deletions

View File

@@ -5,6 +5,9 @@
#pragma once
// ʹ<><CAB9>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><E3B7A8><EFBFBD><EFBFBD><E3B7A8>Ҫ<EFBFBD><D2AA>clien<65><6E>stdafx.hƥ<68><C6A5>
#define USING_COMPRESS 1
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>ZLIB
#define USING_ZLIB 1
@@ -234,19 +237,25 @@ class auto_tick
{
private:
const char *func;
int threshold;
int span;
clock_t tick;
__inline clock_t now() const { return clock(); }
__inline int time() const { return now() - tick; }
public:
auto_tick(const char *func_name, int th=5) : func(func_name), threshold(th), tick(now()) { }
~auto_tick(){int s(this->time());if(s>threshold)TRACE("[%s]ִ<><D6B4>ʱ<EFBFBD><CAB1>: [%d]ms.\n", func, s);}
__inline int time() const { return now() - tick; }
auto_tick(const char *func_name, int th = 5) : func(func_name), span(th), tick(now()) { }
~auto_tick() { stop(); }
__inline void stop() {
if (span != 0) { int s(this->time()); if (s > span)TRACE("[%s]ִ<><D6B4>ʱ<EFBFBD><CAB1>: [%d]ms.\n", func, s); span = 0; }
}
};
#ifdef _DEBUG
// <20><><EFBFBD>ܼ<EFBFBD><DCBC>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ӡ
#define AUTO_TICK(thresh) auto_tick TICK(__FUNCTION__, thresh)
#define STOP_TICK TICK.stop()
#else
#define AUTO_TICK(thresh)
#define STOP_TICK
#endif