ZFFramework
 
Loading...
Searching...
No Matches
ZFCoreStatistic_ZFTime.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFCoreStatistic_ZFTime_h_
7#define _ZFI_ZFCoreStatistic_ZFTime_h_
8
9#include "ZFTime.h"
12
13// ============================================================
51 ZF_OUT zfstring &ret
52 , ZF_IN const zfstring &key
53 );
56 zfstring ret;
58 return ret;
59}
60
61// ============================================================
62zfclassLikePOD ZFLIB_ZFCore _ZFP_ZFCoreStatisticInvokeTimeLogger {
63public:
64 _ZFP_ZFCoreStatisticInvokeTimeLogger(ZF_IN const zfstring &key)
65 : key(key)
66 {
68 }
69 ~_ZFP_ZFCoreStatisticInvokeTimeLogger(void) {
71 }
72private:
73 zfstring key;
74};
76#define ZFCoreStatisticInvokeTimeLogger(key) \
77 ZFCoreStatistic::_ZFP_ZFCoreStatisticInvokeTimeLogger ZFUniqueName(ZFCoreStatisticInvokeTimeLogger_v)(key)
78
79// ============================================================
80zfclassLikePOD ZFLIB_ZFCore _ZFP_ZFCoreStatisticInvokeTimeLoggerOneTime {
81public:
82 _ZFP_ZFCoreStatisticInvokeTimeLoggerOneTime(
83 ZF_IN const zfstring &key
84 , ZF_IN const ZFOutput &output = ZFOutputDefault()
85 )
86 : key(key)
87 , output(output)
88 {
90 }
91 ~_ZFP_ZFCoreStatisticInvokeTimeLoggerOneTime(void) {
93 output << ZFCoreStatistic::invokeTimeGetSummary(key) << "\n";
95 }
96private:
97 zfstring key;
98 ZFOutput output;
99};
101#define ZFCoreStatisticInvokeTimeLoggerOneTime(key, ...) \
102 ZFCoreStatistic::_ZFP_ZFCoreStatisticInvokeTimeLoggerOneTime \
103 ZFUniqueName(ZFCoreStatisticInvokeTimeLoggerOneTime_v)(key, ##__VA_ARGS__)
104
107#endif // #ifndef _ZFI_ZFCoreStatistic_ZFTime_h_
108
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define zfclassLikePOD
shows the class is not a POD type, but you may use it like a POD except memset it to 0
Definition ZFCoreTypeDef_ClassType.h:41
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:188
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_END(NameSpace)
end namespace
Definition ZFNamespace.h:60
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define ZF_NAMESPACE_BEGIN(NameSpace)
begin namespace
Definition ZFNamespace.h:40
const ZFOutput & ZFOutputDefault(void)
default output callback, output source must be zfchar *string
time utility
general output callback
Definition ZFIOCallback_output.h:37
store a time value
Definition ZFTime.h:17
Definition ZFCoreStatistic.h:12
void invokeTimeGetSummary(zfstring &ret, const zfstring &key)
see ZFCoreStatistic::invokeTimeLogBegin
void invokeTimeRemoveAll(void)
see ZFCoreStatistic::invokeTimeLogBegin
void invokeTimeLogEnd(const zfstring &key)
see ZFCoreStatistic::invokeTimeLogBegin
void invokeTimeRemove(const zfstring &key)
see ZFCoreStatistic::invokeTimeLogBegin
ZFTimeValue invokeTimeGetTotalTime(const zfstring &key)
see ZFCoreStatistic::invokeTimeLogBegin
zfindex invokeTimeGetInvokeCount(const zfstring &key)
see ZFCoreStatistic::invokeTimeLogBegin
ZFTimeValue invokeTimeGetAverageTime(const zfstring &key)
see ZFCoreStatistic::invokeTimeLogBegin
void invokeTimeLogBegin(const zfstring &key)
util to log function's invoke time