diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:54:32 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:54:32 +0200 |
commit | cbb59ba3fb48fb87065469eaa1b4a34a18851b9e (patch) | |
tree | 6f43ab99e0f22a33fccb941ab0441d1bee38adf9 /library/globalFunctions.h | |
parent | 1.11 (diff) | |
download | FreeFileSync-cbb59ba3fb48fb87065469eaa1b4a34a18851b9e.tar.gz FreeFileSync-cbb59ba3fb48fb87065469eaa1b4a34a18851b9e.tar.bz2 FreeFileSync-cbb59ba3fb48fb87065469eaa1b4a34a18851b9e.zip |
1.12
Diffstat (limited to 'library/globalFunctions.h')
-rw-r--r-- | library/globalFunctions.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/library/globalFunctions.h b/library/globalFunctions.h index 40eba94f..efbc42c7 100644 --- a/library/globalFunctions.h +++ b/library/globalFunctions.h @@ -3,12 +3,15 @@ #include <string> #include <algorithm> +#include <vector> #include <wx/string.h> #include <fstream> #include <wx/stream.h> +#include <wx/stopwatch.h> using namespace std; + namespace globalFunctions { int round(double d); //little rounding function @@ -40,9 +43,54 @@ namespace globalFunctions int readInt(wxInputStream& stream); //read int from file stream void writeInt(wxOutputStream& stream, const int number); //write int to filestream + + void startPerformance(); //helper method for quick performance measurement + void stopPerformance(); } +//############################################################################ +class Performance +{ +public: + wxDEPRECATED(Performance()); //generates compiler warnings as a reminder to remove code after measurements + ~Performance(); + void showResult(); + +private: + bool resultWasShown; + wxStopWatch timer; +}; + +//two macros for quick performance measurements +#define PERF_START Performance a; +#define PERF_STOP a.showResult(); + + +//############################################################################ +class wxFile; +class DebugLog +{ +public: + wxDEPRECATED(DebugLog()); + ~DebugLog(); + void write(const wxString& logText); + +private: + wxString assembleFileName(); + wxString logfileName; + int lineCount; + wxFile* logFile; //logFile.close(); <- not needed +}; +extern DebugLog logDebugInfo; +wxString getCodeLocation(const wxString file, const int line); + +//small macro for writing debug information into a logfile +#define WRITE_DEBUG_LOG(x) logDebugInfo.write(getCodeLocation(__TFILE__, __LINE__) + x); +//speed alternative: wxLogDebug(wxT("text")) + DebugView + + +//############################################################################ class RuntimeException //Exception class used to notify of general runtime exceptions { public: @@ -50,6 +98,7 @@ public: wxString show() const { + return errorMessage; } |