Thread: posix process handling

  1. #16
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Any1 no of any documentation that would help me do something similar to this on linux:
    Code:
    bool win32ProcPageCounters(HANDLE proc, PROC_PAGE_COUNTERS *pmem)
    {
        return (GetProcessMemoryInfo(proc, pmem, pmem->cb = sizeof(PROCESS_MEMORY_COUNTERS_EX)) == TRUE) ? 1 : 0;
    }
    // Page is same as virtual memory
    size_t win32ProcPageFullSize(PROC_PAGE_COUNTERS pmem) { return pmem.PrivateUsage; }
    size_t win32ProcPageFullPeak(PROC_PAGE_COUNTERS pmem) { return pmem.PeakPagefileUsage; }
    // ??? Must be the file
    size_t win32ProcPagePoolSize(PROC_PAGE_COUNTERS pmem) { return pmem.QuotaPagedPoolUsage; }
    size_t win32ProcPagePoolPeak(PROC_PAGE_COUNTERS pmem) { return pmem.QuotaPeakPagedPoolUsage; }
    // Not sure how this is useful
    int    win32ProcPageFaultCnt(PROC_PAGE_COUNTERS pmem) { return pmem.PageFaultCount; }
    // Working Set is same as physical memory (so should be smaller than pages)
    size_t win32ProcWorkFullSize(PROC_PAGE_COUNTERS pmem) { return pmem.WorkingSetSize; }
    size_t win32ProcWorkFullPeak(PROC_PAGE_COUNTERS pmem) { return pmem.PeakWorkingSetSize; }
    // ??? Must be the RAM
    size_t win32ProcWorkPoolSize(PROC_PAGE_COUNTERS pmem) { return pmem.QuotaNonPagedPoolUsage; }
    size_t win32ProcWorkPoolPeak(PROC_PAGE_COUNTERS pmem) { return pmem.QuotaPeakNonPagedPoolUsage; }
    I haven't found it yet so need help.

  2. #17
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Never mind, found a decent source:
    C/C++ tip: How to get the process resident set size (physical memory use) | Nadeau Software
    I'll get on with it monday as I have work tomorrow & sunday and I need sleep

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to get process info ( to extract process thread id )
    By umen242 in forum C++ Programming
    Replies: 4
    Last Post: 02-12-2009, 01:08 PM
  2. How to Use POSIX for IPC Message To Another Process?
    By dedham_ma_man in forum C Programming
    Replies: 4
    Last Post: 09-28-2007, 03:06 PM
  3. POSIX Signal Handling
    By nine-hundred in forum C Programming
    Replies: 8
    Last Post: 04-13-2007, 02:08 PM
  4. Process sending file descriptors to another process
    By Yasir_Malik in forum C Programming
    Replies: 4
    Last Post: 04-07-2005, 07:36 PM
  5. Child Process & Parent Process Data :: Win32
    By kuphryn in forum Windows Programming
    Replies: 5
    Last Post: 09-11-2002, 12:19 PM