diff options
-rw-r--r-- | src/debug.cpp | 4 | ||||
-rw-r--r-- | src/doxygen.cpp | 33 | ||||
-rw-r--r-- | src/portable.cpp | 36 | ||||
-rw-r--r-- | src/pyscanner.l | 3 | ||||
-rw-r--r-- | src/vhdljjparser.cpp | 4 |
5 files changed, 34 insertions, 46 deletions
diff --git a/src/debug.cpp b/src/debug.cpp index f56ef3a..c270b47 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -118,8 +118,8 @@ class Timer double elapsedTimeS() { return (std::chrono::duration_cast< - std::chrono::milliseconds>( - std::chrono::system_clock::now() - m_startTime).count()) / 1000.0; + std::chrono::microseconds>( + std::chrono::system_clock::now() - m_startTime).count()) / 1000000.0; } private: std::chrono::time_point<std::chrono::system_clock> m_startTime; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index b7076d7..483426f 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -13,6 +13,7 @@ * */ +#include <chrono> #include <locale.h> #include <qfileinfo.h> @@ -199,17 +200,18 @@ void clearAll() class Statistics { public: - Statistics() { stats.setAutoDelete(TRUE); } + Statistics() {} void begin(const char *name) { msg("%s", name); - stat *entry= new stat(name,0); - stats.append(entry); - time.restart(); + stats.emplace_back(name,0); + startTime = std::chrono::steady_clock::now(); } void end() { - stats.getLast()->elapsed=((double)time.elapsed())/1000.0; + std::chrono::steady_clock::time_point endTime = std::chrono::steady_clock::now(); + stats.back().elapsed = std::chrono::duration_cast< + std::chrono::microseconds>(endTime - startTime).count()/1000000.0; } void print() { @@ -220,11 +222,9 @@ class Statistics restore=TRUE; } msg("----------------------\n"); - QListIterator<stat> sli(stats); - stat *s; - for ( sli.toFirst(); (s=sli.current()); ++sli ) + for (const auto &s : stats) { - msg("Spent %.3f seconds in %s",s->elapsed,s->name); + msg("Spent %.6f seconds in %s",s.elapsed,s.name); } if (restore) Debug::setFlag("time"); } @@ -233,18 +233,14 @@ class Statistics { const char *name; double elapsed; - stat() : name(NULL),elapsed(0) {} + //stat() : name(NULL),elapsed(0) {} stat(const char *n, double el) : name(n),elapsed(el) {} }; - QList<stat> stats; - QTime time; + std::vector<stat> stats; + std::chrono::steady_clock::time_point startTime; } g_s; -void statistics() -{ -} - static void addMemberDocs(const Entry *root,MemberDefMutable *md, const char *funcDecl, const ArgumentList *al,bool over_load,uint64 spec); static void findMember(const Entry *root, @@ -1781,9 +1777,6 @@ static void findUsingDirectives(const Entry *root) nd->setMetaData(root->metaData); nd->setInline((root->spec&Entry::Inline)!=0); - //QListIterator<Grouping> gli(*root->groups); - //Grouping *g; - //for (;(g=gli.current());++gli) for (const Grouping &g : root->groups) { GroupDef *gd=0; @@ -11890,7 +11883,7 @@ void generateOutput() if (Debug::isFlagSet(Debug::Time)) { - msg("Total elapsed time: %.3f seconds\n(of which %.3f seconds waiting for external tools to finish)\n", + msg("Total elapsed time: %.6f seconds\n(of which %.6f seconds waiting for external tools to finish)\n", ((double)Debug::elapsedTime()), Portable::getSysElapsedTime() ); diff --git a/src/portable.cpp b/src/portable.cpp index 0ffbd49..85a6718 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -2,6 +2,7 @@ #include <stdlib.h> #include <stdio.h> +#include <chrono> #if defined(_WIN32) && !defined(__CYGWIN__) #undef UNICODE @@ -17,7 +18,6 @@ extern char **environ; #include <ctype.h> #include <qglobal.h> -#include <qdatetime.h> #include <qglobal.h> #include <qdir.h> #include <map> @@ -34,7 +34,7 @@ static std::map<std::string,std::string> proc_env = std::map<std::string,std::st #endif static double g_sysElapsedTime; -static QTime g_time; +static std::chrono::steady_clock::time_point g_startTime; int Portable::system(const char *command,const char *args,bool commandHasConsole) @@ -69,7 +69,7 @@ int Portable::system(const char *command,const char *args,bool commandHasConsole // on Solaris fork() duplicates the memory usage // so we use vfork instead - + // spawn shell if ((pid=vfork())<0) { @@ -138,11 +138,11 @@ int Portable::system(const char *command,const char *args,bool commandHasConsole } else { - // Because ShellExecuteEx can delegate execution to Shell extensions - // (data sources, context menu handlers, verb implementations) that - // are activated using Component Object Model (COM), COM should be - // initialized before ShellExecuteEx is called. Some Shell extensions - // require the COM single-threaded apartment (STA) type. + // Because ShellExecuteEx can delegate execution to Shell extensions + // (data sources, context menu handlers, verb implementations) that + // are activated using Component Object Model (COM), COM should be + // initialized before ShellExecuteEx is called. Some Shell extensions + // require the COM single-threaded apartment (STA) type. // For that case COM is initialized as follows CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); @@ -156,13 +156,13 @@ int Portable::system(const char *command,const char *args,bool commandHasConsole SHELLEXECUTEINFOW sInfo = { sizeof(SHELLEXECUTEINFOW), /* structure size */ SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI, /* tell us the process - * handle so we can wait till it's done | - * do not display msg box if error + * handle so we can wait till it's done | + * do not display msg box if error */ NULL, /* window handle */ NULL, /* action to perform: open */ (LPCWSTR)commandw.ucs2(), /* file to execute */ - (LPCWSTR)argsw.ucs2(), /* argument list */ + (LPCWSTR)argsw.ucs2(), /* argument list */ NULL, /* use current working dir */ SW_HIDE, /* minimize on start-up */ 0, /* application instance handle */ @@ -180,7 +180,7 @@ int Portable::system(const char *command,const char *args,bool commandHasConsole } else if (sInfo.hProcess) /* executable was launched, wait for it to finish */ { - WaitForSingleObject(sInfo.hProcess,INFINITE); + WaitForSingleObject(sInfo.hProcess,INFINITE); /* get process exit code */ DWORD exitCode; if (!GetExitCodeProcess(sInfo.hProcess,&exitCode)) @@ -269,7 +269,7 @@ void Portable::unsetenv(const char *variable) } const char *Portable::getenv(const char *variable) -{ +{ #if defined(_WIN32) && !defined(__CYGWIN__) return ::getenv(variable); #else @@ -303,7 +303,7 @@ portable_off_t Portable::fseek(FILE *f,portable_off_t offset, int whence) portable_off_t Portable::ftell(FILE *f) { #if defined(__MINGW32__) - return ftello64(f); + return ftello64(f); #elif defined(_WIN32) && !defined(__CYGWIN__) return _ftelli64(f); #else @@ -448,12 +448,14 @@ int Portable::pclose(FILE *stream) void Portable::sysTimerStart() { - g_time.start(); + g_startTime = std::chrono::steady_clock::now(); } void Portable::sysTimerStop() { - g_sysElapsedTime+=((double)g_time.elapsed())/1000.0; + std::chrono::steady_clock::time_point endTime = std::chrono::steady_clock::now(); + g_sysElapsedTime+= std::chrono::duration_cast< + std::chrono::microseconds>(endTime - g_startTime).count()/1000000.0; } double Portable::getSysElapsedTime() @@ -561,7 +563,7 @@ static const char * portable_memmem (const char *haystack, size_t haystack_len, const char *Portable::strnstr(const char *haystack, const char *needle, size_t haystack_len) { size_t needle_len = strnlen(needle, haystack_len); - if (needle_len < haystack_len || !needle[needle_len]) + if (needle_len < haystack_len || !needle[needle_len]) { const char *x = portable_memmem(haystack, haystack_len, needle, needle_len); if (x && !memchr(haystack, 0, x - haystack)) diff --git a/src/pyscanner.l b/src/pyscanner.l index 56e8dc8..403b400 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -1141,9 +1141,6 @@ STARTDOCSYMS "##" // do something based on the type of the IDENTIFIER if (yyextra->current->type.isEmpty()) { - //QListIterator<Entry> eli(*(yyextra->current_root->children())); - //Entry *child; - //for (eli.toFirst();(child=eli.yyextra->current());++eli) for (const auto &child : yyextra->current_root->children()) { if (child->name == QCString(yytext)) diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index 4ca4bbe..2d67ec6 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -656,10 +656,6 @@ void VHDLOutlineParser::addProto(const char *s1,const char *s2,const char *s3, */ void VHDLOutlineParser::mapLibPackage( Entry* root) { - //QList<Entry> epp=libUse; - //EntryListIterator eli(epp); - //Entry *rt; - //for (;(rt=eli.current());++eli) for (const auto &rt : p->libUse) { if (addLibUseClause(rt->name)) |