diff --git a/NEWS.md b/NEWS.md index 6d74921c..b9f920fc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,8 @@ Red Panda C++ Version 2.6 - enhancement: Prevent error of "del" to stop make when rebuild project. - enhancement: Import FPS (free problem set) files. - enhancement: Show current problem's description in the problem list's mouse tip. - - enhancement: Show memory usage for problem cases. + - enhancement: Show memory usage for problem cases (windows only). + - enhancement: Show memory usage after console program exited. Red Panda C++ Version 2.5 diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index bd51e4f9..a871b471 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -2653,8 +2653,10 @@ static void setDebugOptions(Settings::PCompilerSet pSet) { bool Settings::CompilerSets::addSets(const QString &folder, const QString& cc_prog) { foreach (const PCompilerSet& set, mList) { - if (set->binDirs().contains(folder)) - return false; + if (set->binDirs().contains(folder)) { + if (extractFileName(set->cppCompiler())==cc_prog) + return false; + } } // Default, release profile PCompilerSet baseSet = addSet(folder,cc_prog); diff --git a/tools/consolepauser/main.windows.cpp b/tools/consolepauser/main.windows.cpp index d4ed90b3..fcaf6fc2 100644 --- a/tools/consolepauser/main.windows.cpp +++ b/tools/consolepauser/main.windows.cpp @@ -20,6 +20,7 @@ using std::string; #include #include +#include #include #ifndef WINBOOL @@ -114,7 +115,7 @@ string GetCommand(int argc,char** argv,bool &reInp,bool &pauseAfterExit) { return result; } -DWORD ExecuteCommand(string& command,bool reInp) { +DWORD ExecuteCommand(string& command,bool reInp, LONGLONG &peakMemory) { STARTUPINFOA si; PROCESS_INFORMATION pi; @@ -139,7 +140,13 @@ DWORD ExecuteCommand(string& command,bool reInp) { WaitForSingleObject(pi.hProcess, INFINITE); // Wait for it to finish - + peakMemory = 0; + PROCESS_MEMORY_COUNTERS counter; + counter.cb = sizeof(counter); + if (GetProcessMemoryInfo(pi.hProcess,&counter, + sizeof(counter))){ + peakMemory = counter.PeakWorkingSetSize/1024; + } DWORD result = 0; GetExitCodeProcess(pi.hProcess, &result); return result; @@ -225,8 +232,9 @@ int main(int argc, char** argv) { // Save starting timestamp LONGLONG starttime = GetClockTick(); + LONGLONG peakMemory=0; // Then execute said command - DWORD returnvalue = ExecuteCommand(command,reInp); + DWORD returnvalue = ExecuteCommand(command,reInp,peakMemory); // Get ending timestamp LONGLONG endtime = GetClockTick(); @@ -242,7 +250,7 @@ int main(int argc, char** argv) { // Done? Print return value of executed program printf("\n--------------------------------"); - printf("\nProcess exited after %.4g seconds with return value %lu\n",seconds,returnvalue); + printf("\nProcess exited after %.4g seconds with return value %lu, %d KB mem used.\n",seconds,returnvalue,peakMemory); if (pauseAfterExit) PauseExit(returnvalue,reInp); return 0;