Extend node stats to include additional memory info. Change "darwin" pstat module to "test" as we don't really know how to get all the stat info for darwin.
Add a new OPAL_ERROR_LOG macro similar to the ORTE_ERROR_LOG one. This commit was SVN r24692.
Этот коммит содержится в:
родитель
c160f5d5a2
Коммит
a3e43594a4
@ -163,6 +163,12 @@ static void opal_node_stats_construct(opal_node_stats_t *obj)
|
||||
obj->la15 = 0.0;
|
||||
obj->total_mem = 0;
|
||||
obj->free_mem = 0.0;
|
||||
obj->buffers = 0.0;
|
||||
obj->cached = 0.0;
|
||||
obj->swap_cached = 0.0;
|
||||
obj->swap_total = 0.0;
|
||||
obj->swap_free = 0.0;
|
||||
obj->mapped = 0.0;
|
||||
obj->sample_time.tv_sec = 0;
|
||||
obj->sample_time.tv_usec = 0;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -19,6 +20,7 @@
|
||||
#include "opal_config.h"
|
||||
|
||||
#include "opal/types.h"
|
||||
#include "opal/util/error.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/dss/dss_internal.h"
|
||||
|
||||
@ -418,6 +420,22 @@ int opal_dss_pack_byte_object(opal_buffer_t *buffer, const void *src, int32_t nu
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int opal_dss_pack_float(opal_buffer_t *buffer, float val)
|
||||
{
|
||||
int32_t tmp1, tmp2;
|
||||
int ret;
|
||||
|
||||
tmp1 = (int)val;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp1, 1, OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
tmp2 = (int)((100.0 * val) - ((int)val));
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp2, 1, OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* OPAL_PSTAT
|
||||
*/
|
||||
@ -463,28 +481,13 @@ int opal_dss_pack_pstat(opal_buffer_t *buffer, const void *src,
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->num_threads, 1, OPAL_INT16))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)ptr[i]->vsize;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->vsize))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)((100.0 * ptr[i]->vsize) - ((int)ptr[i]->vsize));
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->rss))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)ptr[i]->rss;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)((100.0 * ptr[i]->rss) - ((int)ptr[i]->rss));
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)ptr[i]->peak_vsize;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)((100.0 * ptr[i]->peak_vsize) - ((int)ptr[i]->peak_vsize));
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->peak_vsize))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->processor, 1, OPAL_INT16))) {
|
||||
@ -516,34 +519,37 @@ int opal_dss_pack_node_stat(opal_buffer_t *buffer, const void *src,
|
||||
ptr = (opal_node_stats_t **) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
tmp = (int)ptr[i]->la;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->la))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)((100.0 * ptr[i]->la) - ((int)ptr[i]->la));
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->la5))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)ptr[i]->la5;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->la15))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)((100.0 * ptr[i]->la5) - ((int)ptr[i]->la5));
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->total_mem))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)ptr[i]->la15;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->free_mem))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = (int)((100.0 * ptr[i]->la15) - ((int)ptr[i]->la15));
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->buffers))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->total_mem, 1, OPAL_UINT64))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->cached))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->free_mem, 1, OPAL_UINT64))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->swap_cached))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->swap_total))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->swap_free))) {
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_pack_float(buffer, ptr[i]->mapped))) {
|
||||
return ret;
|
||||
}
|
||||
tmp = ptr[i]->sample_time.tv_sec;
|
||||
|
@ -480,7 +480,7 @@ int opal_dss_print_pstat(char **output, char *prefix, opal_pstats_t *src, opal_d
|
||||
}
|
||||
ftime = (float)src->time.tv_sec + ((float)src->time.tv_usec / 1000000.0);
|
||||
ftime1 = (float)src->sample_time.tv_sec + ((float)src->sample_time.tv_usec / 1000000.0);
|
||||
asprintf(output, "%sSAMPLED AT: %f\n%snode: %s rank: %d pid: %d cmd: %s state: %c pri: %d #threads: %d Processor: %d\n"
|
||||
asprintf(output, "%sOPAL_PSTATS SAMPLED AT: %f\n%snode: %s rank: %d pid: %d cmd: %s state: %c pri: %d #threads: %d Processor: %d\n"
|
||||
"%s\ttime: %f cpu: %5.2f VMsize: %8.2f PeakVMSize: %8.2f RSS: %8.2f\n",
|
||||
prefx, ftime1,
|
||||
prefx, src->node, src->rank, src->pid, src->cmd, src->state[0], src->priority, src->num_threads, src->processor,
|
||||
@ -507,10 +507,12 @@ int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
ftime1 = (float)src->sample_time.tv_sec + ((float)src->sample_time.tv_usec / 1000000.0);
|
||||
asprintf(output, "%sSAMPLED AT: %f\n%sTotal Mem: %" PRIu64 "Free Mem: %" PRIu64 "\n"
|
||||
asprintf(output, "%sOPAL_NODE_STATS SAMPLED AT: %f\n%sTotal Mem: %5.2f Free Mem: %5.2f Buffers: %5.2f Cached: %5.2f\n"
|
||||
"%sSwapCached: %5.2f SwapTotal: %5.2f SwapFree: %5.2f Mapped: %5.2f\n"
|
||||
"%s\tla: %5.2f\tla5: %5.2f\tla15: %5.2f\n",
|
||||
prefx, ftime1,
|
||||
prefx, src->total_mem, src->free_mem,
|
||||
prefx, src->total_mem, src->free_mem, src->buffers, src->cached,
|
||||
prefx, src->swap_cached, src->swap_total, src->swap_free, src->mapped,
|
||||
prefx, src->la, src->la5, src->la15);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
|
@ -10,7 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -119,8 +119,14 @@ typedef struct {
|
||||
float la5;
|
||||
float la15;
|
||||
/* memory usage */
|
||||
uint32_t total_mem; /* in MBytes */
|
||||
float total_mem; /* in MBytes */
|
||||
float free_mem; /* in MBytes */
|
||||
float buffers; /* in MBytes */
|
||||
float cached; /* in MBytes */
|
||||
float swap_cached; /* in MBytes */
|
||||
float swap_total; /* in MBytes */
|
||||
float swap_free; /* in MBytes */
|
||||
float mapped; /* in MBytes */
|
||||
/* time at which sample was taken */
|
||||
struct timeval sample_time;
|
||||
} opal_node_stats_t;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/types.h"
|
||||
#include "opal/util/error.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/dss/dss_internal.h"
|
||||
|
||||
@ -511,6 +512,26 @@ int opal_dss_unpack_byte_object(opal_buffer_t *buffer, void *dest, int32_t *num,
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int opal_dss_unpack_float(opal_buffer_t *buffer, float *value)
|
||||
{
|
||||
int32_t m, tmp1, tmp2;
|
||||
int ret;
|
||||
|
||||
*value = 0.0;
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
*value = (float)tmp1 + (float)tmp2/100.0;
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* OPAL_PSTAT
|
||||
*/
|
||||
@ -533,83 +554,81 @@ int opal_dss_unpack_pstat(opal_buffer_t *buffer, void *dest,
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &cptr, &m, OPAL_STRING))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
memmove(ptr[i]->node, cptr, strlen(cptr));
|
||||
free(cptr);
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &ptr[i]->rank, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &ptr[i]->pid, &m, OPAL_PID))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &cptr, &m, OPAL_STRING))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
memmove(ptr[i]->cmd, cptr, strlen(cptr));
|
||||
free(cptr);
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &ptr[i]->state[0], &m, OPAL_BYTE))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
ptr[i]->time.tv_sec = tmp1;
|
||||
ptr[i]->time.tv_usec = tmp2;
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &ptr[i]->priority, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &ptr[i]->num_threads, &m, OPAL_INT16))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->vsize))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->rss))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
ptr[i]->vsize = (float)tmp1 + (float)tmp2/100.0;
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->peak_vsize))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
ptr[i]->rss = (float)tmp1 + (float)tmp2/100.0;
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
return ret;
|
||||
}
|
||||
ptr[i]->peak_vsize = (float)tmp1 + (float)tmp2/100.0;
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &ptr[i]->processor, &m, OPAL_INT16))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
ptr[i]->sample_time.tv_sec = tmp1;
|
||||
@ -638,47 +657,58 @@ int opal_dss_unpack_node_stat(opal_buffer_t *buffer, void *dest,
|
||||
if (NULL == ptr[i]) {
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->la))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->la5))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
ptr[i]->la = (float)tmp1 + (float)tmp2/100.0;
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->la15))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->total_mem))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
ptr[i]->la5 = (float)tmp1 + (float)tmp2/100.0;
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->free_mem))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->buffers))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
ptr[i]->la15 = (float)tmp1 + (float)tmp2/100.0;
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &ptr[i]->total_mem, &m, OPAL_UINT64))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->cached))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &ptr[i]->free_mem, &m, OPAL_UINT64))) {
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->swap_cached))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->swap_total))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->swap_free))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_float(buffer, &ptr[i]->mapped))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
m=1;
|
||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) {
|
||||
OPAL_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
ptr[i]->sample_time.tv_sec = tmp1;
|
||||
|
@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
|
||||
/* This component will only be compiled on Mac OSX, where we are
|
||||
guaranteed to have these headers */
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
#include "opal/mca/pstat/pstat.h"
|
||||
#include "opal/mca/pstat/base/base.h"
|
||||
|
||||
#include "pstat_darwin.h"
|
||||
|
||||
static int init(void);
|
||||
static int query(pid_t pid,
|
||||
opal_pstats_t *stats,
|
||||
opal_node_stats_t *nstats);
|
||||
static int fini(void);
|
||||
|
||||
/*
|
||||
* Darwin pstat module
|
||||
*/
|
||||
const opal_pstat_base_module_t opal_pstat_darwin_module = {
|
||||
init,
|
||||
query,
|
||||
fini
|
||||
};
|
||||
|
||||
static int init(void)
|
||||
{
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int fini(void)
|
||||
{
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
/* Trivial helper function to convert system error codes to OPAL_ERR_*
|
||||
codes */
|
||||
static int convert(int ret)
|
||||
{
|
||||
switch(ret) {
|
||||
case 0:
|
||||
return OPAL_SUCCESS;
|
||||
case ENOSYS:
|
||||
return OPAL_ERR_NOT_SUPPORTED;
|
||||
case EINVAL:
|
||||
return OPAL_ERR_BAD_PARAM;
|
||||
default:
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mac OSX does things a little differently than Linux
|
||||
* by providing process stats via an API. This means we
|
||||
* don't have to parse files that could change!
|
||||
*/
|
||||
static int query(pid_t pid,
|
||||
opal_pstats_t *stats,
|
||||
opal_node_stats_t *nstats)
|
||||
{
|
||||
struct kinfo_proc *procs;
|
||||
int kprocinfo[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, 0, 0 };
|
||||
size_t length;
|
||||
size_t cnt;
|
||||
double dtime;
|
||||
|
||||
if (NULL != stats) {
|
||||
/* record the time of this sample */
|
||||
gettimeofday(&stats->sample_time, NULL);
|
||||
/* check the nstats - don't do gettimeofday twice
|
||||
* as it is expensive
|
||||
*/
|
||||
if (NULL != nstats) {
|
||||
nstats->sample_time.tv_sec = stats->sample_time.tv_sec;
|
||||
nstats->sample_time.tv_usec = stats->sample_time.tv_usec;
|
||||
}
|
||||
} else if (NULL != nstats) {
|
||||
/* record the time of this sample */
|
||||
gettimeofday(&nstats->sample_time, NULL);
|
||||
}
|
||||
|
||||
if (NULL != stats) {
|
||||
kprocinfo[3] = pid;
|
||||
|
||||
/* Call sysctl with a NULL buffer to find out how much memory the
|
||||
* eventual data will consume
|
||||
*/
|
||||
|
||||
length = 0;
|
||||
if (0 != sysctl(kprocinfo, (sizeof(kprocinfo) / sizeof(*kprocinfo)) - 1,
|
||||
NULL, &length, NULL, 0)) {
|
||||
/* something went wrong */
|
||||
return convert(errno);
|
||||
}
|
||||
|
||||
/* Allocate an appropriately sized buffer based on the results
|
||||
* from the previous call.
|
||||
*/
|
||||
|
||||
if (NULL == (procs = malloc(length))) {
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/* Call sysctl again with the new buffer to get the info */
|
||||
|
||||
if (0 != sysctl(kprocinfo, (sizeof(kprocinfo) / sizeof(*kprocinfo)) - 1,
|
||||
procs, &length,
|
||||
NULL, 0)) {
|
||||
/* something went wrong */
|
||||
free(procs);
|
||||
return convert(errno);
|
||||
}
|
||||
|
||||
/* figure out how many results we got */
|
||||
cnt = length / sizeof(struct kinfo_proc);
|
||||
if (1 < cnt) {
|
||||
/* if we got more than one, something is wrong */
|
||||
free(procs);
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
|
||||
stats->pid = pid;
|
||||
if (MAXCOMLEN < OPAL_PSTAT_MAX_STRING_LEN) {
|
||||
memcpy(stats->cmd, procs->kp_proc.p_comm, MAXCOMLEN);
|
||||
} else {
|
||||
/* leave the trailing NULL to end the string */
|
||||
memcpy(stats->cmd, procs->kp_proc.p_comm, OPAL_PSTAT_MAX_STRING_LEN-1);
|
||||
}
|
||||
/* we aren't getting anything useful back on state, so just leave it
|
||||
* as undefined
|
||||
* stats->state = procs->kp_proc.p_stat;
|
||||
*/
|
||||
/* convert to time in seconds */
|
||||
dtime = (double)procs->kp_proc.p_cpticks / (double)CLOCKS_PER_SEC;
|
||||
stats->time.tv_sec = (int)dtime;
|
||||
stats->time.tv_usec = (int)(1000000.0 * (dtime - stats->time.tv_sec));
|
||||
stats->priority = procs->kp_proc.p_priority;
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
@ -102,6 +102,19 @@ static char *next_field(char *ptr, int barrier)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static float convert_value(char *value)
|
||||
{
|
||||
char *ptr;
|
||||
float fval;
|
||||
|
||||
/* compute base value */
|
||||
fval = (float)strtoul(value, &ptr, 10);
|
||||
/* get the unit multiplier */
|
||||
if (NULL != ptr && NULL != strstr(ptr, "kB")) {
|
||||
fval /= 1024.0;
|
||||
}
|
||||
return fval;
|
||||
}
|
||||
|
||||
static int query(pid_t pid,
|
||||
opal_pstats_t *stats,
|
||||
@ -291,29 +304,20 @@ static int query(pid_t pid,
|
||||
if (NULL != (ptr = strstr(data, "VmPeak:"))) {
|
||||
/* found it - step past colon */
|
||||
ptr += 8;
|
||||
eptr = strchr(ptr, 'k');
|
||||
*eptr = '\0';
|
||||
stats->peak_vsize = (float)strtoul(ptr, NULL, 10) / 1024.0; /* convert to MBytes */
|
||||
eptr++;
|
||||
stats->peak_vsize = convert_value(ptr);
|
||||
}
|
||||
/* look for VmSize */
|
||||
if (NULL != (ptr = strstr(eptr, "VmSize:"))) {
|
||||
if (NULL != (ptr = strstr(ptr, "VmSize:"))) {
|
||||
/* found it - step past colon */
|
||||
ptr += 8;
|
||||
eptr = strchr(ptr, 'k');
|
||||
*eptr = '\0';
|
||||
stats->vsize = (float)strtoul(ptr, NULL, 10) / 1024.0; /* convert to MBytes*/
|
||||
eptr++;
|
||||
stats->vsize = convert_value(ptr); /* convert to MBytes*/
|
||||
}
|
||||
|
||||
/* look for RSS */
|
||||
if (NULL != (ptr = strstr(eptr, "VmRSS:"))) {
|
||||
if (NULL != (ptr = strstr(ptr, "VmRSS:"))) {
|
||||
/* found it - step past colon */
|
||||
ptr += 8;
|
||||
eptr = strchr(ptr, 'k');
|
||||
*eptr = '\0';
|
||||
stats->rss = (float)strtoul(ptr, NULL, 10) / 1024.0; /* convert to MBytes */
|
||||
eptr++;
|
||||
stats->rss = convert_value(ptr); /* convert to MBytes */
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,25 +358,21 @@ static int query(pid_t pid,
|
||||
continue;
|
||||
}
|
||||
if (0 == strcmp(dptr, "MemTotal")) {
|
||||
/* find units */
|
||||
ptr = &value[strlen(value)-2];
|
||||
value[strlen(value)-3] = '\0';
|
||||
/* compute base value */
|
||||
nstats->total_mem = strtol(value, NULL, 10);
|
||||
/* get the unit multiplier */
|
||||
if (0 == strcmp(ptr, "kB")) {
|
||||
nstats->total_mem /= 1024;
|
||||
}
|
||||
nstats->total_mem = convert_value(value);
|
||||
} else if (0 == strcmp(dptr, "MemFree")) {
|
||||
/* find units */
|
||||
ptr = &value[strlen(value)-2];
|
||||
value[strlen(value)-3] = '\0';
|
||||
/* compute base value */
|
||||
nstats->free_mem = strtol(value, NULL, 10);
|
||||
/* get the unit multiplier */
|
||||
if (0 == strcmp(ptr, "kB")) {
|
||||
nstats->free_mem /= 1024;
|
||||
}
|
||||
nstats->free_mem = convert_value(value);
|
||||
} else if (0 == strcmp(dptr, "Buffers")) {
|
||||
nstats->buffers = convert_value(value);
|
||||
} else if (0 == strcmp(dptr, "Cached")) {
|
||||
nstats->cached = convert_value(value);
|
||||
} else if (0 == strcmp(dptr, "SwapCached")) {
|
||||
nstats->swap_cached = convert_value(value);
|
||||
} else if (0 == strcmp(dptr, "SwapTotal")) {
|
||||
nstats->swap_total = convert_value(value);
|
||||
} else if (0 == strcmp(dptr, "SwapFree")) {
|
||||
nstats->swap_free = convert_value(value);
|
||||
} else if (0 == strcmp(dptr, "Mapped")) {
|
||||
nstats->mapped = convert_value(value);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
@ -9,7 +9,7 @@
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
@ -18,27 +18,27 @@
|
||||
#
|
||||
|
||||
sources = \
|
||||
pstat_darwin.h \
|
||||
pstat_darwin_component.c \
|
||||
pstat_darwin_module.c
|
||||
pstat_test.h \
|
||||
pstat_test_component.c \
|
||||
pstat_test.c
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
# (for static builds).
|
||||
|
||||
if MCA_BUILD_opal_pstat_darwin_DSO
|
||||
if MCA_BUILD_opal_pstat_test_DSO
|
||||
component_noinst =
|
||||
component_install = mca_pstat_darwin.la
|
||||
component_install = mca_pstat_test.la
|
||||
else
|
||||
component_noinst = libmca_pstat_darwin.la
|
||||
component_noinst = libmca_pstat_test.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
mcacomponentdir = $(pkglibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_pstat_darwin_la_SOURCES = $(sources)
|
||||
mca_pstat_darwin_la_LDFLAGS = -module -avoid-version
|
||||
mca_pstat_test_la_SOURCES = $(sources)
|
||||
mca_pstat_test_la_LDFLAGS = -module -avoid-version
|
||||
|
||||
noinst_LTLIBRARIES = $(component_noinst)
|
||||
libmca_pstat_darwin_la_SOURCES =$(sources)
|
||||
libmca_pstat_darwin_la_LDFLAGS = -module -avoid-version
|
||||
libmca_pstat_test_la_SOURCES =$(sources)
|
||||
libmca_pstat_test_la_LDFLAGS = -module -avoid-version
|
@ -10,27 +10,23 @@
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
AC_DEFUN([MCA_opal_pstat_darwin_PRIORITY], [50])
|
||||
AC_DEFUN([MCA_opal_pstat_test_PRIORITY], [10])
|
||||
|
||||
# MCA_pstat_darwin_CONFIG([action-if-found], [action-if-not-found])
|
||||
# -----------------------------------------------------------
|
||||
AC_DEFUN([MCA_opal_pstat_darwin_CONFIG],[
|
||||
AC_CONFIG_FILES([opal/mca/pstat/darwin/Makefile])
|
||||
|
||||
OPAL_VAR_SCOPE_PUSH([paff_darwin_happy])
|
||||
# check to see if we have <mach/mach_host.h>
|
||||
# as this is a Darwin-specific thing
|
||||
AC_CHECK_HEADER([mach/mach_host.h], [paff_darwin_happy=yes], [paff_darwin_happy=no])
|
||||
|
||||
AS_IF([test "$paff_darwin_happy" = "yes"], [$1], [$2])
|
||||
OPAL_VAR_SCOPE_POP
|
||||
])dnl
|
||||
# MCA_pstat_test_CONFIG(action-if-can-compile,
|
||||
# [action-if-cant-compile])
|
||||
# ------------------------------------------------
|
||||
AC_DEFUN([MCA_opal_pstat_test_CONFIG],[
|
||||
AC_CONFIG_FILES([opal/mca/pstat/test/Makefile])
|
||||
|
||||
pstat_test_happy="yes"
|
||||
AS_IF([test "$pstat_test_happy" = "yes"],
|
||||
[$1],
|
||||
[$2])
|
||||
])
|
127
opal/mca/pstat/test/pstat_test.c
Обычный файл
127
opal/mca/pstat/test/pstat_test.c
Обычный файл
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
#include "opal/mca/pstat/pstat.h"
|
||||
#include "opal/mca/pstat/base/base.h"
|
||||
|
||||
#include "pstat_test.h"
|
||||
|
||||
static int init(void);
|
||||
static int query(pid_t pid,
|
||||
opal_pstats_t *stats,
|
||||
opal_node_stats_t *nstats);
|
||||
static int fini(void);
|
||||
|
||||
/*
|
||||
* Test pstat module
|
||||
*/
|
||||
const opal_pstat_base_module_t opal_pstat_test_module = {
|
||||
init,
|
||||
query,
|
||||
fini
|
||||
};
|
||||
|
||||
static int init(void)
|
||||
{
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int fini(void)
|
||||
{
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int query(pid_t pid,
|
||||
opal_pstats_t *stats,
|
||||
opal_node_stats_t *nstats)
|
||||
{
|
||||
double dtime;
|
||||
char hostname[128];
|
||||
|
||||
if (NULL != stats) {
|
||||
/* record the time of this sample */
|
||||
gettimeofday(&stats->sample_time, NULL);
|
||||
/* check the nstats - don't do gettimeofday twice
|
||||
* as it is expensive
|
||||
*/
|
||||
if (NULL != nstats) {
|
||||
nstats->sample_time.tv_sec = stats->sample_time.tv_sec;
|
||||
nstats->sample_time.tv_usec = stats->sample_time.tv_usec;
|
||||
}
|
||||
} else if (NULL != nstats) {
|
||||
/* record the time of this sample */
|
||||
gettimeofday(&nstats->sample_time, NULL);
|
||||
}
|
||||
|
||||
if (NULL != stats) {
|
||||
gethostname(hostname, 128);
|
||||
strncpy(stats->node, hostname, OPAL_PSTAT_MAX_STRING_LEN);
|
||||
|
||||
stats->pid = pid;
|
||||
strncpy(stats->cmd, "UNKNOWN", OPAL_PSTAT_MAX_STRING_LEN);
|
||||
stats->state[0] = 'R';
|
||||
stats->priority = 2;
|
||||
stats->num_threads = 1;
|
||||
|
||||
/* set the values to something identifiable for testing */
|
||||
stats->vsize = 1.75;
|
||||
stats->rss = 1.23;
|
||||
stats->peak_vsize = 7.89;
|
||||
|
||||
/* convert to time in seconds */
|
||||
dtime = 12345.678;
|
||||
stats->time.tv_sec = (int)dtime;
|
||||
stats->time.tv_usec = (int)(1000000.0 * (dtime - stats->time.tv_sec));
|
||||
stats->priority = 2;
|
||||
}
|
||||
|
||||
if (NULL != nstats) {
|
||||
/* set the memory values to something identifiable for testing */
|
||||
nstats->total_mem = 123.45;
|
||||
nstats->free_mem = 0.45;
|
||||
nstats->buffers = 1.33;
|
||||
nstats->cached = 0.56;
|
||||
nstats->swap_cached = 0.95;
|
||||
nstats->swap_total = 11.45;
|
||||
nstats->swap_free = 1.26;
|
||||
nstats->mapped = 12.98;
|
||||
/* set the load averages */
|
||||
nstats->la = 0.52;
|
||||
nstats->la5 = 1.03;
|
||||
nstats->la15 = 0.12;
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -17,8 +17,8 @@
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_PSTAT_DARWIN_EXPORT_H
|
||||
#define MCA_PSTAT_DARWIN_EXPORT_H
|
||||
#ifndef MCA_PSTAT_TEST_EXPORT_H
|
||||
#define MCA_PSTAT_TEST_EXPORT_H
|
||||
|
||||
#include "opal_config.h"
|
||||
|
||||
@ -31,10 +31,10 @@ BEGIN_C_DECLS
|
||||
* Globally exported variable
|
||||
*/
|
||||
|
||||
OPAL_DECLSPEC extern const opal_pstat_base_component_t mca_pstat_darwin_component;
|
||||
OPAL_DECLSPEC extern const opal_pstat_base_component_t mca_pstat_test_component;
|
||||
|
||||
OPAL_DECLSPEC extern const opal_pstat_base_module_t opal_pstat_darwin_module;
|
||||
OPAL_DECLSPEC extern const opal_pstat_base_module_t opal_pstat_test_module;
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_PSTAT_DARWIN_EXPORT_H */
|
||||
#endif /* MCA_PSTAT_TEST_EXPORT_H */
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -27,18 +27,18 @@
|
||||
|
||||
#include "opal/constants.h"
|
||||
#include "opal/mca/pstat/pstat.h"
|
||||
#include "pstat_darwin.h"
|
||||
#include "pstat_test.h"
|
||||
|
||||
/*
|
||||
* Public string showing the pstat ompi_darwin component version number
|
||||
* Public string showing the pstat ompi_test component version number
|
||||
*/
|
||||
const char *opal_pstat_darwin_component_version_string =
|
||||
"OPAL darwin pstat MCA component version " OPAL_VERSION;
|
||||
const char *opal_pstat_test_component_version_string =
|
||||
"OPAL test pstat MCA component version " OPAL_VERSION;
|
||||
|
||||
/*
|
||||
* Local function
|
||||
*/
|
||||
static int pstat_darwin_component_query(mca_base_module_t **module, int *priority);
|
||||
static int pstat_test_component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
|
||||
/*
|
||||
@ -46,7 +46,7 @@ static int pstat_darwin_component_query(mca_base_module_t **module, int *priorit
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
|
||||
const opal_pstat_base_component_t mca_pstat_darwin_component = {
|
||||
const opal_pstat_base_component_t mca_pstat_test_component = {
|
||||
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
@ -59,7 +59,7 @@ const opal_pstat_base_component_t mca_pstat_darwin_component = {
|
||||
|
||||
/* Component name and version */
|
||||
|
||||
"darwin",
|
||||
"test",
|
||||
OPAL_MAJOR_VERSION,
|
||||
OPAL_MINOR_VERSION,
|
||||
OPAL_RELEASE_VERSION,
|
||||
@ -68,7 +68,7 @@ const opal_pstat_base_component_t mca_pstat_darwin_component = {
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
pstat_darwin_component_query,
|
||||
pstat_test_component_query,
|
||||
NULL
|
||||
},
|
||||
/* Next the MCA v1.0.0 component meta data */
|
||||
@ -79,10 +79,10 @@ const opal_pstat_base_component_t mca_pstat_darwin_component = {
|
||||
};
|
||||
|
||||
|
||||
static int pstat_darwin_component_query(mca_base_module_t **module, int *priority)
|
||||
static int pstat_test_component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
*priority = 20;
|
||||
*module = (mca_base_module_t *)&opal_pstat_darwin_module;
|
||||
*module = (mca_base_module_t *)&opal_pstat_test_module;
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
@ -21,8 +21,15 @@
|
||||
|
||||
#include "opal_config.h"
|
||||
|
||||
#include "opal/util/output.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
#define OPAL_ERROR_LOG(r) \
|
||||
opal_output(0, "OPAL ERROR: %s in file %s at line %d", \
|
||||
opal_strerror((r)), __FILE__, __LINE__);
|
||||
|
||||
|
||||
/**
|
||||
* Prints error message for errnum on stderr
|
||||
*
|
||||
|
@ -273,6 +273,12 @@ static void copy_node_stats(opal_node_stats_t *dest, opal_node_stats_t *src)
|
||||
{
|
||||
dest->total_mem = src->total_mem;
|
||||
dest->free_mem = src->free_mem;
|
||||
dest->buffers = src->buffers;
|
||||
dest->cached = src->cached;
|
||||
dest->swap_cached = src->swap_cached;
|
||||
dest->swap_total = src->swap_total;
|
||||
dest->swap_free = src->swap_free;
|
||||
dest->mapped = src->mapped;
|
||||
dest->la = src->la;
|
||||
dest->la5 = src->la5;
|
||||
dest->la15 = src->la15;
|
||||
@ -358,6 +364,8 @@ static void send_heartbeat(int fd, short event, void *arg)
|
||||
ORTE_ERROR_LOG(rc);
|
||||
OBJ_DESTRUCT(&stats);
|
||||
OBJ_DESTRUCT(&nstats);
|
||||
/* turn off the stats as it won't work */
|
||||
mca_sensor_heartbeat_component.include_stats = false;
|
||||
goto BEAT;
|
||||
}
|
||||
/* pack the node stats first */
|
||||
@ -532,6 +540,8 @@ static void recv_beats(int status,
|
||||
n=1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss.unpack(buf, &nstats, &n, OPAL_NODE_STAT))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
/* turn off the stats */
|
||||
mca_sensor_heartbeat_component.include_stats = false;
|
||||
goto DEPART;
|
||||
}
|
||||
/* since we already have the daemon's proc object, store this data */
|
||||
@ -545,6 +555,8 @@ static void recv_beats(int status,
|
||||
n=1;
|
||||
if (ORTE_SUCCESS != (rc = opal_dss.unpack(buf, &stats, &n, OPAL_PSTAT))) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
/* turn off the stats */
|
||||
mca_sensor_heartbeat_component.include_stats = false;
|
||||
goto DEPART;
|
||||
}
|
||||
copy_proc_stats(&proc->stats, stats);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user