4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3  •  6.4  •  6.5

GetProcessInfo can give you information about the current Analytica or ADE process, such as user name, computer, name, memory in use, number of processors available, number of objects in the model, and a whole lot more. from the Windows operating system,

Types of information

GetProcessInfo returns information about the current Analytica or ADE process from the Windows operating system, according to which of these texts you pass as the «item» parameter:

"Process ID" -- returns the Process ID, or Pid, for the current process.
"Thread ID" -- returns the Id of the Analytica/ADE thread.
"Priority" -- returns the priority of the Analytica/ADE thread. The following values are possible (defined by the Windows operating system):
  • -15 : Idle only
  • -2 : lowest priority
  • -1 : below normal
  • 0 : normal priority
  • 1 : Above normal
  • 2 : Highest priority
  • 15: Critical priority
  • 31: Real-time priority
"Computer Name"
"User Name": Windows login name
"User Identity": User name in ACP, or Windows login name in DTA.
"Windows Version"
"Windows SP"
"Windows Build"
"Abort Event Object" { ADE 4.1 only }. Name of global Event object for ADE project that can be used to send ADE a break signal to abort the current computation.
"ENV:«name»": Retrieves the value for the environment variable «name»
"Environment Variables": List of all Environment variables
"Command Line"
"Analytica Path": Full file path to the Analytica.exe, Ade.exe, or Ade.dll file being run.
"Working Set Size"
"Working Set Max"
"Working Set Min"
"Working Set Flags"
"Working Set Peak"
"Private Bytes"
"Total RAM"
"Free RAM"
"Total Virtual"
"Max Address Space"
"Memory Load"
"Total Free Memory"
"Page Fault Count"
"Avail Virtual" (see note)
"Processor #": On a multi-core computer, the processor currently running the current evaluation. This changes with time.
"Affinity Mask": A list of which processors the operating system will allow Analytica's evaluation to run on.
"Num Processors": The number of processors the Analytica process is allowed to run on.
"Num Sys Processors": The total number of processors on this computer in the current processor group. Always <=64.
"Num cores": The total number of processors on this computer in all processor groups. (Typically the same as "Num Sys Processors" on computers with 64 cores or less, but can be greater than 64 on very high-end servers).
"User Objects": Number of objects in use (variable nodes, local indexes, etc) by a model
"Total Objects": Number of objects in use including both user objects and built-in system objects.
"Free Objects": Number of free "slots" still available for additional objects.


Process ID

Knowing the Process ID makes it possible to differentiate between multiple instances of Analytica or ADE in the Windows Task Manager.

GetProcessInfo("Process ID") → 4117

Reading the command line

GetProcessInfo("Command Line") → '"C:\Program Files\Lumina\Analytica.exe" "C:\My Models\Costs.ana"'

See Analytica Command Line for a list of valid command line parameters recognized by Analytica.

Reading Environment Variables

Obtain a list of all environment variables:

Index EnvVarName := GetProcessInfo("Environment Variables");

Getting PID from ADE (C#)

CAEngine ade = new CAEngine();
CAObject V = ade.CreateObject("V", "variable");
V.SetAttribute("definition", "GetProcessInfo(\"Process ID\")");
string pInfoResult = V.Result().ToString();

Aborting an in-progress evaluation in ADE

To abort a computation in ADE, your program must obtain a HANDLE to the abort event object. In order to obtain this, you need to obtain the name of this object from ADE. You get this by calling GetProcessInfo("Abort Event Object"). You then use the Windows Platform SDK routine OpenEvent to get the handle to this object. When you want to abort an in-process computation, you set this event. Generally your application that uses ADE will need to be multi-threaded, so that one thread calls ADE, the other thread detects the signal to abort the computation (the signal might be a user pressing Ctrl+Break, for example).

C++ example:

    /* From first application thread, which uses ADE: */
    #include <windows.h>
    #import "ADE.exe"
    using namespace ADE4;
    void main() 
        CAEngine* pAde = new CAEngine();
        pAde->SendCommand("GetProcessInfo('Abort Event Object')");
        _bstr_t abortObjName = pAde->get_OutputBuffer();
        hAbort = OpenEvent(EVENT_MODIFY_STATE,/*bInherit*/FALSE,abortObjName);
        CreateThread(..., MonitorForBreak,... );
        CTable* pResult = pAde->Get("X")->ResultTable();  /* Initiate a very long computation */
        if (pAde->get_ErrorCode() == 78) {
             /* The computation was aborted before completion */
    DWORD WINAPI MonitorForBreak( LPVOID )
         /* This routine detects a signal to break the computation.  Maybe it is a user-keypress,
          * or other UI interaction. */
         if (DetectUserWantsToAbort()) {
             SetEvent(hAbort);                   /* Causes the abort */

Memory Information

The Analytica process that evaluates your model may end up using a lot of memory. The operating system keeps some of that memory in RAM, and swaps some of it out to virtual memory. Accessing RAM is fast, while accessing virtual memory is much slower. Windows makes various tradeoffs with what other programs are running on your computer to decide how much of the Analytica process to keep in RAM. The amount of RAM to devote to Analytica is called its working set. When the working set is much smaller that the available RAM, other applications on your computer will respond well (since they can use that RAM), but Analytica may run slowly. If the working set is close to the amount of available RAM, then Analytica gets to make more use of fast RAM, but other applications, and the Windows UI, may get very slow, since they will then need to switch in and out of memory.

GetProcessInfo("Working Set Max") and GetProcessInfo("Working set Min") return the minimum and maximum working set size, in bytes, currently imposed by Windows on the Analytica process. GetProcessInfo("Working Set Flags") returns an integer containing flags, indicating whether Windows is allowed to alter these limits as the process uses more or less memory. The flags are the following numbers added together:

  • 1 = Analytica is guaranteed at least the minimum working set.
  • 2 = Windows may reduce Analytica's working set below the minimum value when memory demands are high
  • 4 = Windows will not allocate more than the indicated working set max.
  • 8 = Windows may give Analytica more than the Working Set Max when memory demands from other applications is low.

The "Avail Virtual" option returns the number that Windows reports as the theoretical maximum amount of memory available to all processes running on the operating system, including both RAM and page file space. However, the number isn't very meaningful or reliable, as Windows often reports a number that far exceeds the amount of available hard disk space (for example, in Windows x64, a number of 8.8 TeraBytes is reported), and in 32-bit processes on Windows x64, the huge number seems to be wrap at 4GB, resulting in a nonesense (and often very small) number.


This function was introduced in Analytica 4.0.

See Also


You are not allowed to post comments.