Index: src/libchcore/ITimestampProvider.h =================================================================== diff -u -r9b8cccbee0fcfeca28a112cc0253a7641f73f74f -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/ITimestampProvider.h (.../ITimestampProvider.h) (revision 9b8cccbee0fcfeca28a112cc0253a7641f73f74f) +++ src/libchcore/ITimestampProvider.h (.../ITimestampProvider.h) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -19,9 +19,11 @@ #ifndef __ITIMESTAMPPROVIDER_H__ #define __ITIMESTAMPPROVIDER_H__ +#include "libchcore.h" + BEGIN_CHCORE_NAMESPACE -class ITimestampProvider +class LIBCHCORE_API ITimestampProvider { public: virtual ~ITimestampProvider() {} Index: src/libchcore/SerializerTrace.h =================================================================== diff -u -r5693271a6736f524997e3951fc7b7b6323bc6447 -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/SerializerTrace.h (.../SerializerTrace.h) (revision 5693271a6736f524997e3951fc7b7b6323bc6447) +++ src/libchcore/SerializerTrace.h (.../SerializerTrace.h) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -20,31 +20,81 @@ #define __SERIALIZERTRACE_H__ #include +#include +// enables tracing +#define ENABLE_TRACE + +// general tracking +#define TRACK_GENERAL + +// db-related tracking #define TRACK_DB_QUERIES //#define TRACK_DB_QUERIES_DETAILED +#ifdef ENABLE_TRACE + inline void trace0(PCTSTR pszFmt) + { + OutputDebugString(pszFmt); + } + + template + inline void trace1(PCTSTR pszFmt, const T& tData) + { + CString strVal; + strVal.Format(pszFmt, tData); + OutputDebugString((PCTSTR)strVal); + } + + template + inline void trace2(PCTSTR pszFmt, const T1& tData1, const T2& tData2) + { + CString strVal; + strVal.Format(pszFmt, tData1, tData2); + OutputDebugString((PCTSTR)strVal); + } + + #define MYTRACE0 trace0 + #define MYTRACE1 trace1 + #define MYTRACE2 trace2 +#else + #define MYTRACE0(fmt) __noop + #define MYTRACE1(fmt, val) __noop + #define MYTRACE2(fmt, val1, val2) __noop +#endif + +#ifdef TRACK_GENERAL + #define GTRACE0 MYTRACE0 + #define GTRACE1 MYTRACE1 + #define GTRACE2 MYTRACE2 +#else + #define GTRACE0(fmt) __noop + #define GTRACE1(fmt, val) __noop + #define GTRACE2(fmt, val1, val2) __noop +#endif + + #ifdef TRACK_DB_QUERIES - #define DBTRACE(fmt, val) ATLTRACE(fmt, val) - #define DBTRACE0(fmt) ATLTRACE(fmt) - #define DBTRACE2(fmt, val1, val2) ATLTRACE(fmt, val1, val2) + #define DBTRACE0 MYTRACE0 + #define DBTRACE1 MYTRACE1 + #define DBTRACE2 MYTRACE2 #ifdef TRACK_DB_QUERIES_DETAILED - #define DBTRACE_D(fmt, val) ATLTRACE(fmt, val) - #define DBTRACE0_D(fmt) ATLTRACE(fmt) - #define DBTRACE2_D(fmt, val1, val2) ATLTRACE(fmt, val1, val2) + #define DBTRACE0_D MYTRACE0 + #define DBTRACE1_D MYTRACE1 + #define DBTRACE2_D MYTRACE2 #else - #define DBTRACE_D(fmt, val) __noop; #define DBTRACE0_D(fmt) __noop - #define DBTRACE2_D(fmt, val1, val2) __noop; + #define DBTRACE1_D(fmt, val) __noop + #define DBTRACE2_D(fmt, val1, val2) __noop #endif #else - #define DBTRACE(fmt, val) __noop; #define DBTRACE0(fmt) __noop - #define DBTRACE2(fmt, val1, val2) __noop; - #define DBTRACE_D(fmt, val) __noop; + #define DBTRACE1(fmt, val) __noop + #define DBTRACE2(fmt, val1, val2) __noop #define DBTRACE0_D(fmt) __noop - #define DBTRACE2_D(fmt, val1, val2) __noop; + #define DBTRACE1_D(fmt, val) __noop + #define DBTRACE2_D(fmt, val1, val2) __noop #endif #endif Index: src/libchcore/TSQLiteSerializer.cpp =================================================================== diff -u -r5693271a6736f524997e3951fc7b7b6323bc6447 -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/TSQLiteSerializer.cpp (.../TSQLiteSerializer.cpp) (revision 5693271a6736f524997e3951fc7b7b6323bc6447) +++ src/libchcore/TSQLiteSerializer.cpp (.../TSQLiteSerializer.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -81,8 +81,8 @@ m_mapContainers.clear(); - unsigned long long ullFlushClearTime = timer.Stop(); ullFlushClearTime; - DBTRACE(_T(" ## Serializer::Flush() - container clearing: %I64u ms\n"), ullFlushClearTime); + unsigned long long ullFlushClearTime = timer.Checkpoint(); ullFlushClearTime; + DBTRACE1(_T(" ## Serializer::Flush() - container clearing: %I64u ms\n"), ullFlushClearTime); } void TSQLiteSerializer::SetupDBOptions() Index: src/libchcore/TSQLiteSerializerContainer.cpp =================================================================== diff -u -r5693271a6736f524997e3951fc7b7b6323bc6447 -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/TSQLiteSerializerContainer.cpp (.../TSQLiteSerializerContainer.cpp) (revision 5693271a6736f524997e3951fc7b7b6323bc6447) +++ src/libchcore/TSQLiteSerializerContainer.cpp (.../TSQLiteSerializerContainer.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -24,7 +24,6 @@ #include #include "TSQLiteStatement.h" #include "TSQLiteSerializerRowReader.h" -#include #include "TRemovedObjects.h" #include "SerializerTrace.h" @@ -164,7 +163,7 @@ TString strQuery = boost::str(boost::wformat(L"DELETE FROM %1% WHERE id IN (%2%)") % m_strName % strItemsToRemove).c_str(); tStatement.Prepare(strQuery); - ATLTRACE(_T("Executing query: %s\n"), (PCTSTR)strQuery); + DBTRACE1_D(_T("Executing query: %s\n"), (PCTSTR)strQuery); tStatement.Step(); } } Index: src/libchcore/TSQLiteSerializerRowData.cpp =================================================================== diff -u -r5693271a6736f524997e3951fc7b7b6323bc6447 -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision 5693271a6736f524997e3951fc7b7b6323bc6447) +++ src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -20,7 +20,6 @@ #include "TSQLiteSerializerRowData.h" #include "TSQLiteStatement.h" #include -#include #include "TSerializerException.h" #include "ErrorCodes.h" #include "SerializerTrace.h" @@ -39,73 +38,73 @@ void operator()(bool value) const { - DBTRACE_D(_T("- param(bool): %ld\n"), value ? 1l : 0l); + DBTRACE1_D(_T("- param(bool): %ld\n"), value ? 1l : 0l); m_rStatement.BindValue(m_rColumn++, value); } void operator()(short value) const { - DBTRACE_D(_T("- param(short): %d\n"), value); + DBTRACE1_D(_T("- param(short): %d\n"), value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(unsigned short value) const { - DBTRACE_D(_T("- param(ushort): %u\n"), value); + DBTRACE1_D(_T("- param(ushort): %u\n"), value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(int value) const { - DBTRACE_D(_T("- param(int): %ld\n"), value); + DBTRACE1_D(_T("- param(int): %ld\n"), value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(unsigned int value) const { - DBTRACE_D(_T("- param(uint): %lu\n"), value); + DBTRACE1_D(_T("- param(uint): %lu\n"), value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(long value) const { - DBTRACE_D(_T("- param(long): %ld\n"), value); + DBTRACE1_D(_T("- param(long): %ld\n"), value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(unsigned long value) const { - DBTRACE_D(_T("- param(ulong): %lu\n"), value); + DBTRACE1_D(_T("- param(ulong): %lu\n"), value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(long long value) const { - DBTRACE_D(_T("- param(longlong): %I64d\n"), value); + DBTRACE1_D(_T("- param(longlong): %I64d\n"), value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(unsigned long long value) const { - DBTRACE_D(_T("- param(ulonglong): %I64u\n"), value); + DBTRACE1_D(_T("- param(ulonglong): %I64u\n"), value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(double value) const { - DBTRACE_D(_T("- param(double): %f\n"), value); + DBTRACE1_D(_T("- param(double): %f\n"), value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(const TString& value) const { - DBTRACE_D(_T("- param(string): '%s'\n"), (PCTSTR)value); + DBTRACE1_D(_T("- param(string): '%s'\n"), (PCTSTR)value); m_rStatement.BindValue(m_rColumn++, value); } void operator()(const TSmartPath& value) const { - DBTRACE_D(_T("- param(path): %s\n"), value.ToString()); + DBTRACE1_D(_T("- param(path): %s\n"), value.ToString()); m_rStatement.BindValue(m_rColumn++, value); } Index: src/libchcore/TSQLiteSerializerRowReader.cpp =================================================================== diff -u -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/TSQLiteSerializerRowReader.cpp (.../TSQLiteSerializerRowReader.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) +++ src/libchcore/TSQLiteSerializerRowReader.cpp (.../TSQLiteSerializerRowReader.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -23,7 +23,7 @@ #include "ErrorCodes.h" #include #include "TSQLiteStatement.h" -#include +#include "SerializerTrace.h" BEGIN_CHCORE_NAMESPACE @@ -52,7 +52,7 @@ TString strQuery; strQuery = boost::str(boost::wformat(L"SELECT %1% FROM %2% ORDER BY id") % (PCTSTR)m_spColumns->GetCommaSeparatedColumns() % (PCTSTR)m_strContainerName).c_str(); - ATLTRACE(_T("Executing query: %s\n"), (PCTSTR)strQuery); + DBTRACE1_D(_T("Executing query: %s\n"), (PCTSTR)strQuery); m_spStatement->Prepare(strQuery); m_bInitialized = true; } Index: src/libchcore/TSimpleTimer.h =================================================================== diff -u -r5693271a6736f524997e3951fc7b7b6323bc6447 -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/TSimpleTimer.h (.../TSimpleTimer.h) (revision 5693271a6736f524997e3951fc7b7b6323bc6447) +++ src/libchcore/TSimpleTimer.h (.../TSimpleTimer.h) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -24,7 +24,7 @@ BEGIN_CHCORE_NAMESPACE -class TSimpleTimer +class LIBCHCORE_API TSimpleTimer { public: TSimpleTimer(bool bAutostart = false, const ITimestampProviderPtr& spTimestampProvider = ITimestampProviderPtr()); @@ -45,7 +45,10 @@ unsigned long long GetLastTimestamp() const { return m_ullLastTime; } private: +#pragma warning(push) +#pragma warning(disable: 4251) ITimestampProviderPtr m_spTimestampProvider; +#pragma warning(pop) bool m_bStarted; unsigned long long m_ullTotalTime; // total time measured Index: src/libchcore/TSubTaskArray.cpp =================================================================== diff -u -rd0bc3c187684f54894c7280a936d5507a5e49f35 -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision d0bc3c187684f54894c7280a936d5507a5e49f35) +++ src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -208,11 +208,9 @@ for(size_t stSubOperationIndex = 0; stSubOperationIndex < m_vSubTasks.size(); ++stSubOperationIndex) { - if(bAdded) - spRow = spContainer->AddRow(stSubOperationIndex); - const std::pair& rCurrentSubTask = m_vSubTasks[stSubOperationIndex]; + spRow = spContainer->AddRow(stSubOperationIndex); *spRow % TRowData(_T("type"), rCurrentSubTask.first->GetSubOperationType()) % TRowData(_T("is_current"), false) Index: src/libchcore/TTask.cpp =================================================================== diff -u -r5693271a6736f524997e3951fc7b7b6323bc6447 -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/TTask.cpp (.../TTask.cpp) (revision 5693271a6736f524997e3951fc7b7b6323bc6447) +++ src/libchcore/TTask.cpp (.../TTask.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -37,6 +37,7 @@ #include "TRowData.h" #include "ISerializerRowData.h" #include "TStringSet.h" +#include "SerializerTrace.h" BEGIN_CHCORE_NAMESPACE @@ -163,7 +164,7 @@ void TTask::Store() { TSimpleTimer timer(true); - ATLTRACE(_T("###### Task::Store() - starting\n")); + DBTRACE0(_T("###### Task::Store() - starting\n")); using namespace chcore; @@ -197,7 +198,7 @@ m_spSerializer->Flush(); unsigned long long ullFlushTime = timer.Stop(); ullFlushTime; - ATLTRACE(_T("###### Task::Store() - finished - gather: %I64u ms, flush: %I64u ms\n"), ullGatherTime, ullFlushTime); + DBTRACE2(_T("###### Task::Store() - finished - gather: %I64u ms, flush: %I64u ms\n"), ullGatherTime, ullFlushTime); } void TTask::KillThread() Index: src/libchcore/TTaskManager.cpp =================================================================== diff -u -r5693271a6736f524997e3951fc7b7b6323bc6447 -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 --- src/libchcore/TTaskManager.cpp (.../TTaskManager.cpp) (revision 5693271a6736f524997e3951fc7b7b6323bc6447) +++ src/libchcore/TTaskManager.cpp (.../TTaskManager.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) @@ -26,6 +26,7 @@ #include "ErrorCodes.h" #include "TTaskInfo.h" #include +#include "SerializerTrace.h" BEGIN_CHCORE_NAMESPACE @@ -453,7 +454,7 @@ m_spSerializer->Flush(); unsigned long long ullFlushTime = timer.Stop(); ullFlushTime; - ATLTRACE(_T("TaskManager::Store() - gather: %I64u ms, flush: %I64u ms\n"), ullGatherTime, ullFlushTime); + DBTRACE2(_T("TaskManager::Store() - gather: %I64u ms, flush: %I64u ms\n"), ullGatherTime, ullFlushTime); } void TTaskManager::Load()