nashie Posted July 22, 2009 Share Posted July 22, 2009 Okay, firstly I'm not a coder! So why am I in this forum you may ask? Well, I need an app that will calculate how much memory a particular application is using (such as pslist.exe etc.) when running in volatile memory. I have looked all over the place and found some C# code which I tried in vain to compile only to receive millions (okay 10) errors. I'm not expecting anyone to write it for me but just to point me in the right direction please. Any ideas on the subject would be gratefully received. Apologies if I shouldn't be asking this of you... Thanks in advance. Quote Link to comment Share on other sites More sharing options...
SomethingToChatWith Posted July 23, 2009 Share Posted July 23, 2009 Task manager can show you how much memory a proccess is using. Quote Link to comment Share on other sites More sharing options...
nashie Posted July 25, 2009 Author Share Posted July 25, 2009 Task manager can show you how much memory a proccess is using. Thanks SomethingToChatWith. I did consider this but as I need to test memory usage by pslist, tlist and a host of other apps, either they simply don't show up in process manager or appear so quicly, I can't screen print the details which I need for a paper. I am using XP rather than Vista. The latter shows much more in Task Manager but again it is not always possible to capture the data. I have code for a Process Memory Counter, but it will not complie correctly and unfortunately I don't know enough to figure out what the problems are. This is the code I have: #include <windows.h> #include <stdio.h> #include <psapi.h> void PrintMemoryInfo( DWORD processID ) { HANDLE hProcess; PROCESS_MEMORY_COUNTERS pmc; // Print the process identifier. printf( "\nProcess ID: %u\n", processID ); // Print information about the memory usage of the process. hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID ); if (NULL == hProcess) return; if ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) ) { printf( "\tPageFaultCount: 0x%08X\n", pmc.PageFaultCount ); printf( "\tPeakWorkingSetSize: 0x%08X\n", pmc.PeakWorkingSetSize ); printf( "\tWorkingSetSize: 0x%08X\n", pmc.WorkingSetSize ); printf( "\tQuotaPeakPagedPoolUsage: 0x%08X\n", pmc.QuotaPeakPagedPoolUsage ); printf( "\tQuotaPagedPoolUsage: 0x%08X\n", pmc.QuotaPagedPoolUsage ); printf( "\tQuotaPeakNonPagedPoolUsage: 0x%08X\n", pmc.QuotaPeakNonPagedPoolUsage ); printf( "\tQuotaNonPagedPoolUsage: 0x%08X\n", pmc.QuotaNonPagedPoolUsage ); printf( "\tPagefileUsage: 0x%08X\n", pmc.PagefileUsage ); printf( "\tPeakPagefileUsage: 0x%08X\n", pmc.PeakPagefileUsage ); } CloseHandle( hProcess ); } int main( ) { // Get the list of process identifiers. DWORD aProcesses[1024], cbNeeded, cProcesses; unsigned int i; if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) ) return 1; // Calculate how many process identifiers were returned. cProcesses = cbNeeded / sizeof(DWORD); // Print the memory usage for each process for ( i = 0; i < cProcesses; i++ ) PrintMemoryInfo( aProcesses ); return 0; } Anyone have any ideas please? Thanks for looking... Quote Link to comment Share on other sites More sharing options...
H@L0_F00 Posted July 28, 2009 Share Posted July 28, 2009 Process Explorer from Microsoft Sysinternals might be exactly what you need. http://technet.microsoft.com/en-us/sysinte...s/bb896653.aspx Right click on a process and the "Performance" or "Performance Graph" tabs should have what you're looking for. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.