1
1

Fix the printing and handling of sample times in stats objects

This commit was SVN r27681.
Этот коммит содержится в:
Ralph Castain 2012-12-18 03:45:09 +00:00
родитель ef49fcea25
Коммит 885fc8432d
3 изменённых файлов: 20 добавлений и 23 удалений

Просмотреть файл

@ -378,7 +378,7 @@ static int opal_dss_pack_float(opal_buffer_t *buffer, float val)
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp1, 1, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp1, 1, OPAL_INT32))) {
return ret; return ret;
} }
tmp2 = (int)(100.0 * (val - (int)val)); tmp2 = (int)(1000.0 * (val - (int)val));
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp2, 1, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp2, 1, OPAL_INT32))) {
return ret; return ret;
} }
@ -392,7 +392,8 @@ int opal_dss_pack_pstat(opal_buffer_t *buffer, const void *src,
int32_t num_vals, opal_data_type_t type) int32_t num_vals, opal_data_type_t type)
{ {
opal_pstats_t **ptr; opal_pstats_t **ptr;
int32_t i, tmp; int32_t i;
int64_t tmp;
int ret; int ret;
char *cptr; char *cptr;
@ -417,11 +418,11 @@ int opal_dss_pack_pstat(opal_buffer_t *buffer, const void *src,
return ret; return ret;
} }
tmp = ptr[i]->time.tv_sec; tmp = ptr[i]->time.tv_sec;
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT64))) {
return ret; return ret;
} }
tmp = ptr[i]->time.tv_usec; tmp = ptr[i]->time.tv_usec;
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT64))) {
return ret; return ret;
} }
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->priority, 1, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &ptr[i]->priority, 1, OPAL_INT32))) {
@ -443,11 +444,11 @@ int opal_dss_pack_pstat(opal_buffer_t *buffer, const void *src,
return ret; return ret;
} }
tmp = ptr[i]->sample_time.tv_sec; tmp = ptr[i]->sample_time.tv_sec;
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT64))) {
return ret; return ret;
} }
tmp = ptr[i]->sample_time.tv_usec; tmp = ptr[i]->sample_time.tv_usec;
if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_pack_buffer(buffer, &tmp, 1, OPAL_INT64))) {
return ret; return ret;
} }
} }

Просмотреть файл

@ -420,7 +420,6 @@ int opal_dss_print_byte_object(char **output, char *prefix, opal_byte_object_t *
int opal_dss_print_pstat(char **output, char *prefix, opal_pstats_t *src, opal_data_type_t type) int opal_dss_print_pstat(char **output, char *prefix, opal_pstats_t *src, opal_data_type_t type)
{ {
char *prefx; char *prefx;
float ftime, ftime1;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) asprintf(&prefx, " ");
@ -431,13 +430,11 @@ int opal_dss_print_pstat(char **output, char *prefix, opal_pstats_t *src, opal_d
asprintf(output, "%sData type: OPAL_PSTATS\tValue: NULL pointer", prefx); asprintf(output, "%sData type: OPAL_PSTATS\tValue: NULL pointer", prefx);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
ftime = (float)src->time.tv_sec + ((float)src->time.tv_usec / 1000000.0); asprintf(output, "%sOPAL_PSTATS SAMPLED AT: %ld.%ld\n%snode: %s rank: %d pid: %d cmd: %s state: %c pri: %d #threads: %d Processor: %d\n"
ftime1 = (float)src->sample_time.tv_sec + ((float)src->sample_time.tv_usec / 1000000.0); "%s\ttime: %ld.%ld cpu: %5.2f VMsize: %8.2f PeakVMSize: %8.2f RSS: %8.2f\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" prefx, (long)src->sample_time.tv_sec, (long)src->sample_time.tv_usec,
"%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, prefx, src->node, src->rank, src->pid, src->cmd, src->state[0], src->priority, src->num_threads, src->processor,
prefx, ftime, src->percent_cpu, src->vsize, src->peak_vsize, src->rss); prefx, (long)src->time.tv_sec, (long)src->time.tv_usec, src->percent_cpu, src->vsize, src->peak_vsize, src->rss);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
@ -448,7 +445,6 @@ int opal_dss_print_pstat(char **output, char *prefix, opal_pstats_t *src, opal_d
int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src, opal_data_type_t type) int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src, opal_data_type_t type)
{ {
char *prefx; char *prefx;
float ftime1;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) asprintf(&prefx, " ");
@ -459,11 +455,10 @@ int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src
asprintf(output, "%sData type: OPAL_NODE_STATS\tValue: NULL pointer", prefx); asprintf(output, "%sData type: OPAL_NODE_STATS\tValue: NULL pointer", prefx);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
ftime1 = (float)src->sample_time.tv_sec + ((float)src->sample_time.tv_usec / 1000000.0); asprintf(output, "%sOPAL_NODE_STATS SAMPLED AT: %ld.%ld\n%sTotal Mem: %5.2f Free Mem: %5.2f Buffers: %5.2f Cached: %5.2f\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" "%sSwapCached: %5.2f SwapTotal: %5.2f SwapFree: %5.2f Mapped: %5.2f\n"
"%s\tla: %5.2f\tla5: %5.2f\tla15: %5.2f\n", "%s\tla: %5.2f\tla5: %5.2f\tla15: %5.2f\n",
prefx, ftime1, prefx, (long)src->sample_time.tv_sec, (long)src->sample_time.tv_usec,
prefx, src->total_mem, src->free_mem, src->buffers, src->cached, 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->swap_cached, src->swap_total, src->swap_free, src->mapped,
prefx, src->la, src->la5, src->la15); prefx, src->la, src->la5, src->la15);

Просмотреть файл

@ -464,7 +464,7 @@ static int opal_dss_unpack_float(opal_buffer_t *buffer, float *value)
OPAL_ERROR_LOG(ret); OPAL_ERROR_LOG(ret);
return ret; return ret;
} }
*value = (float)tmp1 + (float)tmp2/100.0; *value = (float)tmp1 + (float)tmp2/1000.0;
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
@ -475,7 +475,8 @@ int opal_dss_unpack_pstat(opal_buffer_t *buffer, void *dest,
int32_t *num_vals, opal_data_type_t type) int32_t *num_vals, opal_data_type_t type)
{ {
opal_pstats_t **ptr; opal_pstats_t **ptr;
int32_t i, n, m, tmp1, tmp2; int32_t i, n, m;
int64_t tmp1, tmp2;
int ret; int ret;
char *cptr; char *cptr;
@ -518,12 +519,12 @@ int opal_dss_unpack_pstat(opal_buffer_t *buffer, void *dest,
return ret; return ret;
} }
m=1; m=1;
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT64))) {
OPAL_ERROR_LOG(ret); OPAL_ERROR_LOG(ret);
return ret; return ret;
} }
m=1; m=1;
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT64))) {
OPAL_ERROR_LOG(ret); OPAL_ERROR_LOG(ret);
return ret; return ret;
} }
@ -558,12 +559,12 @@ int opal_dss_unpack_pstat(opal_buffer_t *buffer, void *dest,
return ret; return ret;
} }
m=1; m=1;
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp1, &m, OPAL_INT64))) {
OPAL_ERROR_LOG(ret); OPAL_ERROR_LOG(ret);
return ret; return ret;
} }
m=1; m=1;
if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT32))) { if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, &tmp2, &m, OPAL_INT64))) {
OPAL_ERROR_LOG(ret); OPAL_ERROR_LOG(ret);
return ret; return ret;
} }