- enhancement: Show memory usage after console program exited.
- fix: If clang and g++ are in the same folder, only the compiler sets for gcc are auto generated.
This commit is contained in:
parent
e37759b977
commit
ea3b4ea8e5
3
NEWS.md
3
NEWS.md
|
@ -11,7 +11,8 @@ Red Panda C++ Version 2.6
|
||||||
- enhancement: Prevent error of "del" to stop make when rebuild project.
|
- enhancement: Prevent error of "del" to stop make when rebuild project.
|
||||||
- enhancement: Import FPS (free problem set) files.
|
- enhancement: Import FPS (free problem set) files.
|
||||||
- enhancement: Show current problem's description in the problem list's mouse tip.
|
- 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
|
Red Panda C++ Version 2.5
|
||||||
|
|
||||||
|
|
|
@ -2653,8 +2653,10 @@ static void setDebugOptions(Settings::PCompilerSet pSet) {
|
||||||
|
|
||||||
bool Settings::CompilerSets::addSets(const QString &folder, const QString& cc_prog) {
|
bool Settings::CompilerSets::addSets(const QString &folder, const QString& cc_prog) {
|
||||||
foreach (const PCompilerSet& set, mList) {
|
foreach (const PCompilerSet& set, mList) {
|
||||||
if (set->binDirs().contains(folder))
|
if (set->binDirs().contains(folder)) {
|
||||||
return false;
|
if (extractFileName(set->cppCompiler())==cc_prog)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Default, release profile
|
// Default, release profile
|
||||||
PCompilerSet baseSet = addSet(folder,cc_prog);
|
PCompilerSet baseSet = addSet(folder,cc_prog);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
using std::string;
|
using std::string;
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <psapi.h>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
|
||||||
#ifndef WINBOOL
|
#ifndef WINBOOL
|
||||||
|
@ -114,7 +115,7 @@ string GetCommand(int argc,char** argv,bool &reInp,bool &pauseAfterExit) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD ExecuteCommand(string& command,bool reInp) {
|
DWORD ExecuteCommand(string& command,bool reInp, LONGLONG &peakMemory) {
|
||||||
STARTUPINFOA si;
|
STARTUPINFOA si;
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
|
|
||||||
|
@ -139,7 +140,13 @@ DWORD ExecuteCommand(string& command,bool reInp) {
|
||||||
|
|
||||||
WaitForSingleObject(pi.hProcess, INFINITE); // Wait for it to finish
|
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;
|
DWORD result = 0;
|
||||||
GetExitCodeProcess(pi.hProcess, &result);
|
GetExitCodeProcess(pi.hProcess, &result);
|
||||||
return result;
|
return result;
|
||||||
|
@ -225,8 +232,9 @@ int main(int argc, char** argv) {
|
||||||
// Save starting timestamp
|
// Save starting timestamp
|
||||||
LONGLONG starttime = GetClockTick();
|
LONGLONG starttime = GetClockTick();
|
||||||
|
|
||||||
|
LONGLONG peakMemory=0;
|
||||||
// Then execute said command
|
// Then execute said command
|
||||||
DWORD returnvalue = ExecuteCommand(command,reInp);
|
DWORD returnvalue = ExecuteCommand(command,reInp,peakMemory);
|
||||||
|
|
||||||
// Get ending timestamp
|
// Get ending timestamp
|
||||||
LONGLONG endtime = GetClockTick();
|
LONGLONG endtime = GetClockTick();
|
||||||
|
@ -242,7 +250,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
// Done? Print return value of executed program
|
// Done? Print return value of executed program
|
||||||
printf("\n--------------------------------");
|
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)
|
if (pauseAfterExit)
|
||||||
PauseExit(returnvalue,reInp);
|
PauseExit(returnvalue,reInp);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue