Please check this program...
Hi All,
> I have written a program that creates a child process and calculates the child process memory usage
> Please tell me what is an alternative for "Sleep(20000);" ( i need to wait till the child process finishes its execution)
> and i have no idea about the output, on my console (i,e output consists of numbers)
my Output:****************************
PagefileUsage : 0
PeakPagefileUsage : 3420160
cb : 40
PageFaultCount : 2665
PeakWorkingSetSize : 8192000
WorkingSetSize : 36864
Done.
my Code:*****************************
int main()
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
GetStartupInfo(&si);
CreateProcess ("E:\\MemoryUsageProgram.exe", // Name of app to launch
NULL,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi);
Sleep(20000);
PROCESS_MEMORY_COUNTERS PProcessMemoryCounters;
GetProcessMemoryInfo (pi.hProcess,
&PProcessMemoryCounters,
sizeof(PProcessMemoryCounters));
cout<<"\n"
<<"PagefileUsage: "<<PProcessMemoryCounters.PagefileUsage<<endl
<<"PeakPagefileUsage: "<<PProcessMemoryCounters.PeakPagefileUsage<<endl
<<"cb: "<<PProcessMemoryCounters.cb<<endl
<<"PageFaultCount: "<<PProcessMemoryCounters.PageFaultCount<<endl
<<"PeakWorkingSetSize: "<<PProcessMemoryCounters.PeakWorkingSetSize<<endl
<<"WorkingSetSize: "<<PProcessMemoryCounters.WorkingSetSize<<endl;
cout<<"\nDone.\n";
return 0;
}
>Please suggest me alternative instruction for "Sleep(20000);" (to wait till child process is finished)
> and about the output, currently I'm assuming the output (numerical values) are in BYTES.
THANK YOU IN ADVANCE...:)
John.
Re: Please check this program...
Re: Please check this program...
Re: Please check this program...
> thanks!! for the instruction alternative to "Sleep" :), it helped me a lot...
>could u please tell me about the output .... is it in BYTES [especially for PeakPagefileUsage ( PProcessMemoryCounters.PeakPagefileUsage ) for the code above]...