コード例 #1
0
ファイル: perf_writer_mem.c プロジェクト: hef/samba
void init_memdata_desc(PERF_DATA_BLOCK *data)
{
    init_perf_counter(&(data->memInfo.memObjDesc),
                      &(data->memInfo.memObjDesc),
                      get_counter_id(data),
                      "Memory",
                      "The Memory performance object consists of counters that describe the behavior of physical and virtual memory on the computer.",
                      0,
                      PERF_OBJECT);
    init_perf_counter(&(data->memInfo.availPhysKb),
                      &(data->memInfo.memObjDesc),
                      get_counter_id(data),
                      "Available Physical Kilobytes",
                      "Available Physical Kilobytes is the number of free kilobytes in physical memory",
                      PERF_SIZE_DWORD | PERF_TYPE_NUMBER | PERF_NUMBER_DECIMAL | PERF_DISPLAY_NO_SUFFIX,
                      PERF_COUNTER);
    init_perf_counter(&(data->memInfo.availSwapKb),
                      &(data->memInfo.memObjDesc),
                      get_counter_id(data),
                      "Available Swap Kilobytes",
                      "Available Swap Kilobytes is the number of free kilobytes in swap space",
                      PERF_SIZE_DWORD | PERF_TYPE_NUMBER | PERF_NUMBER_DECIMAL | PERF_DISPLAY_NO_SUFFIX,
                      PERF_COUNTER);
    init_perf_counter(&(data->memInfo.totalPhysKb),
                      &(data->memInfo.memObjDesc),
                      get_counter_id(data),
                      "Total Physical Kilobytes",
                      "Total Physical Kilobytes is a base counter",
                      PERF_SIZE_DWORD | PERF_TYPE_NUMBER | PERF_NUMBER_DECIMAL | PERF_COUNTER_BASE | PERF_DISPLAY_NOSHOW,
                      PERF_COUNTER);
    init_perf_counter(&(data->memInfo.totalSwapKb),
                      &(data->memInfo.memObjDesc),
                      get_counter_id(data),
                      "Total Swap Kilobytes",
                      "Total Swap Kilobytes is a base counter",
                      PERF_SIZE_DWORD | PERF_TYPE_NUMBER | PERF_NUMBER_DECIMAL | PERF_COUNTER_BASE | PERF_DISPLAY_NOSHOW,
                      PERF_COUNTER);

    return;
}
コード例 #2
0
sgx_status_t pse_mc_create_sim(
    uint8_t *p_req_payload,
    uint8_t *p_resp_payload)
{
    UNUSED(p_req_payload);
    sgx_status_t ret = SGX_ERROR_UNEXPECTED;
    pse_mc_create_resp_t *p_create_resp
        = (pse_mc_create_resp_t *)p_resp_payload;

    //initial create_resp
    p_create_resp->resp_hdr.service_id = PSE_MC_SERVICE;
    p_create_resp->resp_hdr.service_cmd = PSE_MC_CREATE;
    p_create_resp->resp_hdr.status = PSE_ERROR_INTERNAL;
    memset(p_create_resp->counter_id, 0xFF, sizeof(p_create_resp->counter_id));
    memset(p_create_resp->nonce, 0xFF, sizeof(p_create_resp->nonce));

    vmc_sim_t temp_vmc = {{0}, {0}, 0};
    ret = get_counter_id(&temp_vmc);
    if(SGX_SUCCESS != ret){
        return ret;
    }
    ret = store_vmc_sim(&temp_vmc);
    if(SGX_SUCCESS != ret){
        return ret;
    }

    p_create_resp->resp_hdr.status = PSE_SUCCESS;
    if(memcpy_s(p_create_resp->counter_id,
                sizeof(p_create_resp->counter_id),
                temp_vmc.counter_id,
                sizeof(temp_vmc.counter_id))){
        return SGX_ERROR_UNEXPECTED;
    }
    if(memcpy_s(p_create_resp->nonce,
                sizeof(p_create_resp->nonce),
                temp_vmc.nonce,
                sizeof(temp_vmc.nonce))){
        return SGX_ERROR_UNEXPECTED;
    }

    return ret;
}