Using Win32 functions in Visual FoxPro Image Gallery
Performance Monitoring
..msdn
CreateToolhelp32Snapshot
EnumDeviceDrivers
EnumProcesses
EnumProcessModules
GetDeviceDriverBaseName
GetDeviceDriverFileName
GetModuleBaseName
GetModuleFileNameEx
GetPerformanceInfo
GetProcessMemoryInfo
Process32First
Process32Next
Code examples:
Obtaining OS memory performance information
Obtaining OS memory performance information

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
Before you begin:
Memory performance information is available from the memory manager through the system performance counters and through functions such as GetPerformanceInfo, GetProcessMemoryInfo, and GlobalMemoryStatusEx.

See also:
  • Memory usage info for current VFP session
  • Enumerating processes

  •  
    *!*    typedef struct _PERFORMANCE_INFORMATION {
    *!*      DWORD  cb;                 0:4
    *!*      SIZE_T CommitTotal;        4:4
    *!*      SIZE_T CommitLimit;        8:4
    *!*      SIZE_T CommitPeak;        12:4
    *!*      SIZE_T PhysicalTotal;     16:4
    *!*      SIZE_T PhysicalAvailable; 20:4
    *!*      SIZE_T SystemCache;       24:4
    *!*      SIZE_T KernelTotal;       28:4
    *!*      SIZE_T KernelPaged;       32:4
    *!*      SIZE_T KernelNonpaged;    36:4
    *!*      SIZE_T PageSize;          40:4
    *!*      DWORD  HandleCount;       44:4
    *!*      DWORD  ProcessCount;      48:4
    *!*      DWORD  ThreadCount;       52:4
    *!*    } PERFORMANCE_INFORMATION,
    *!*        *PPERFORMANCE_INFORMATION;
     
    #DEFINE PERFORMANCE_INFORMATION_SIZE 56
     
    DECLARE INTEGER GetPerformanceInfo in psapi;
        STRING @pPerfInfo, INTEGER cb
     
    LOCAL cBuffer, nPageSize
    cBuffer = PADR(CHR(PERFORMANCE_INFORMATION_SIZE),;
        PERFORMANCE_INFORMATION_SIZE, CHR(0))
     
    = GetPerformanceInfo(@cBuffer,;
        PERFORMANCE_INFORMATION_SIZE)
     
    nPageSize = buf2dword(SUBSTR(cBuffer, 41, 4))
     
    ? "Physical Total (Bytes):",;
        TRANSFORM(buf2dword(SUBSTR(cBuffer, 17, 4)) *;
        nPageSize, "999,999,999,999")
     
    ? "Physical Available (Bytes):",;
        TRANSFORM(buf2dword(SUBSTR(cBuffer, 21, 4)) *;
        nPageSize, "999,999,999,999")
     
    ? "Handle Count:",;
        buf2dword(SUBSTR(cBuffer, 45, 4))
     
    ? "Process Count:",;
        buf2dword(SUBSTR(cBuffer, 49, 4))
     
    ? "Thread Count:",;
        buf2dword(SUBSTR(cBuffer, 53, 4))
     
    FUNCTION buf2dword(cBuffer)
    RETURN Asc(SUBSTR(cBuffer, 1,1)) + ;
        BitLShift(Asc(SUBSTR(cBuffer, 2,1)),  8) +;
        BitLShift(Asc(SUBSTR(cBuffer, 3,1)), 16) +;
        BitLShift(Asc(SUBSTR(cBuffer, 4,1)), 24)
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1618 bytes  
    Created: 2010-07-12 02:45:58  
    Modified: 2011-02-16 07:05:36  
    Visits in 7 days: 93  
    Listed functions:
    GetPerformanceInfo
    Printer friendly API declarations
    My comment:
    System information obtained through call to GetPerformanceInfo, includes counts for running processes and threads, handles, amount of available and allocated memory.
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.226.5.29)
    5.57 hrs.Function: 'IsValidSid'
     Example: 'Using mailslots to send messages on the network'
     Function: 'SearchPath'
    Function group: 'File Management'
    5.72 hrs.Example: 'Converting strings between ANSI and OEM'
     Function: 'FindFirstChangeNotification'
    8.79 hrs.Example: 'Using FlashWindowEx to flash the taskbar button of the VFP application'
    8.8 hrs.Function: 'FindWindowEx'
    Function group: 'Window'
    10.27 hrs.Example: 'Retrieving names for the registered clipboard formats'
     Example: 'GDI+: printing vertical text on VFP reports via generated images (VFP9)'
    11.65 hrs.Function: 'CeDeleteFile'
    Google
    Advertise here!