- 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: 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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
using std::string;
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <conio.h>
|
||||
|
||||
#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;
|
||||
|
|
Loading…
Reference in New Issue