3 StatusApi
David Anderson edited this page 2023-08-10 03:26:12 -07:00

Startup and status data

Getting startup data

The following functions return startup data:

int boinc_get_init_data_p(APP_INIT_DATA*);
int boinc_get_init_data(APP_INIT_DATA&);

struct APP_INIT_DATA {
    int major_version;          // BOINC client version info
    int minor_version;
    int release;
    int app_version;
    char app_name[256];
    char symstore[256];         // symstore URL (Windows)
    char acct_mgr_url[256];
        // if client is using account manager, its URL
    char* project_preferences;
        // project prefs XML
    int userid;
        // project's DB ID for this user/team/host
    int teamid;
    int hostid;
    char user_name[256];
    char team_name[256];
    char project_dir[256];      // where project files are stored on host
    char boinc_dir[256];        // BOINC data directory
    char wu_name[256];          // workunit name
    char result_name[256];
    char authenticator[256];    // user's authenticator
    int slot;                   // the slot this job is running in (0, 1, ...)
    int client_pid;             // process ID of BOINC client
    double user_total_credit;
    double user_expavg_credit;
    double host_total_credit;
    double host_expavg_credit;
    double resource_share_fraction;     // this project's resource share frac
    HOST_INFO host_info;
    PROXY_INFO proxy_info;      // in case app wants to use network
    GLOBAL_PREFS global_prefs;
    double starting_elapsed_time;   // elapsed time, counting previous episodes
    bool using_sandbox;         // client is using account-based sandboxing

    // info about the WU
    double rsc_fpops_est;
    double rsc_fpops_bound;
    double rsc_memory_bound;
    double rsc_disk_bound;
    double computation_deadline;

    // the following are used for compound apps,
    // where each stage of the computation is a fixed fraction of the total.
    //
    double fraction_done_start;
    double fraction_done_end;

    // info for GPU apps
    //
    char gpu_type[64];
    int gpu_device_num;
    int gpu_opencl_dev_index;
    double gpu_usage;   // APP_VERSION.gpu_usage.usage

    // info for multicore apps: how many cores to use
    //
    double ncpus;

    // client configuration info
    //
    bool vbox_window;       // whether to open a console window for VM apps

    // Items used by the BOINC runtime system
    //
    double checkpoint_period;     // recommended checkpoint period
    SHMEM_SEG_NAME shmem_seg_name;
    double wu_cpu_time;       // cpu time from previous episodes
};

Getting runtime system status

The status of the runtime system is represented by the following structure:

typedef struct BOINC_STATUS {
    int no_heartbeat;
    int suspended;
    int quit_request;
    int reread_init_data_file;
    int abort_request;
    double working_set_size;
    double max_working_set_size;
    int network_suspended;
} BOINC_STATUS;
no_heartbeat

no heartbeat from client; clean up and exit(0).

suspended

the client has requested that we suspend ourself.

quit_request

the client has requested that we exit (will restart).

reread_init_data_file

project preferences have changed; reread them if needed.

abort_request

the client has request that we abort (no restart).

working_set_size

the apps' current working-set size.

max_working_set_size

the max working set size so far.

network_suspended

set if network activity is not currently allowed.

You can get the current status using

void boinc_get_status(BOINC_STATUS*);