Skip to content

Commit

Permalink
Improve ldms_ls output for records and lists
Browse files Browse the repository at this point in the history
  • Loading branch information
tom95858 committed Aug 9, 2023
1 parent cb547a3 commit c2e31f0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/4.3.3-compat-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ jobs:
[[ "${D2}" = "ovis-4.3.3/meminfo" ]] || error "unexpected ldms_ls(4.3.3) agg-4 result"
# ldms_ls-4 to agg-4.3.3 -l
echo -n "ldms_ls -l agg-4.3.3 ... "
D0=$( ./ldms_ls.sh -l -x sock -p 10001 | grep MemTotal )
D0=$( ./ldms_ls.sh -l -x sock -p 10001 | grep MemTotal | sed 's/\s\+/ /g' )
echo "${D0}"
[[ -n "${D0}" ]] || error "cannot get MemTotal from ldms_ls -l"
# ldms_ls-4 to agg-4 -l
echo -n "ldms_ls -l agg-4 ... "
D1=$( ./ldms_ls.sh -l -x sock -p 10002 | grep MemTotal )
D1=$( ./ldms_ls.sh -l -x sock -p 10002 | grep MemTotal | sed 's/\s\+/ /g' )
echo "${D1}"
[[ -n "${D1}" ]] || error "cannot get MemTotal from ldms_ls -l"
# ldms_ls-4.3.3 to agg-4 -l
echo -n "ldms_ls-4.3.3 -l agg-4 ... "
D2=$( ./ldms_ls-4.3.3.sh -l -x sock -p 10002 | grep MemTotal )
D2=$( ./ldms_ls-4.3.3.sh -l -x sock -p 10002 | grep MemTotal | sed 's/\s\+/ /g' )
echo "${D2}"
[[ -n "${D2}" ]] || error "cannot get MemTotal from ldms_ls -l"
# check if they're the same
Expand Down Expand Up @@ -276,17 +276,17 @@ jobs:
[[ "${D2}" = "ovis-4.3.3/meminfo" ]] || error "unexpected ldms_ls(4.3.3) agg-4 result"
# ldms_ls-4 to agg-4.3.3 -l
echo -n "ldms_ls -l agg-4.3.3 -a munge ... "
D0=$( ./ldms_ls.sh -l -x sock -p 10001 -a munge | grep MemTotal )
D0=$( ./ldms_ls.sh -l -x sock -p 10001 -a munge | grep MemTotal | sed 's/\s\+/ /g' )
echo "${D0}"
[[ -n "${D0}" ]] || error "cannot get MemTotal from ldms_ls -l"
# ldms_ls-4 to agg-4 -l
echo -n "ldms_ls -l agg-4 -a munge ... "
D1=$( ./ldms_ls.sh -l -x sock -p 10002 -a munge | grep MemTotal )
D1=$( ./ldms_ls.sh -l -x sock -p 10002 -a munge | grep MemTotal | sed 's/\s\+/ /g' )
echo "${D1}"
[[ -n "${D1}" ]] || error "cannot get MemTotal from ldms_ls -l"
# ldms_ls-4.3.3 to agg-4 -l
echo -n "ldms_ls-4.3.3 -l agg-4 -a munge ... "
D2=$( ./ldms_ls-4.3.3.sh -l -x sock -p 10002 -a munge | grep MemTotal )
D2=$( ./ldms_ls-4.3.3.sh -l -x sock -p 10002 -a munge | grep MemTotal | sed 's/\s\+/ /g' )
echo "${D2}"
[[ -n "${D2}" ]] || error "cannot get MemTotal from ldms_ls -l"
# check if they're the same
Expand Down
6 changes: 4 additions & 2 deletions ldms/python/ldms.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,10 @@ LDMS_VALUE_TYPE_TBL = {
"double[]" : LDMS_V_D64_ARRAY,
"d[]" : LDMS_V_D64_ARRAY,
"d64[]" : LDMS_V_D64_ARRAY,
"record[]" : LDMS_V_RECORD_ARRAY,

"list" : LDMS_V_LIST,
"list<>" : LDMS_V_LIST,

"char_array" : LDMS_V_CHAR_ARRAY,
"s8_array" : LDMS_V_S8_ARRAY,
Expand All @@ -1263,6 +1265,7 @@ LDMS_VALUE_TYPE_TBL = {
"double_array" : LDMS_V_D64_ARRAY,
"d_array" : LDMS_V_D64_ARRAY,
"d64_array" : LDMS_V_D64_ARRAY,
"record_array" : LDMS_V_RECORD_ARRAY,

LDMS_V_CHAR : LDMS_V_CHAR,
LDMS_V_S8 : LDMS_V_S8,
Expand Down Expand Up @@ -1314,8 +1317,7 @@ LDMS_VALUE_TYPE_TBL = {

LDMS_V_LIST : LDMS_V_LIST,

LDMS_V_RECORD_ARRAY : LDMS_V_RECORD_ARRAY,
"record_array" : LDMS_V_RECORD_ARRAY,
LDMS_V_RECORD_ARRAY : LDMS_V_RECORD_ARRAY
}

cdef ldms_value_type LDMS_VALUE_TYPE(t):
Expand Down
5 changes: 3 additions & 2 deletions ldms/src/core/ldms.c
Original file line number Diff line number Diff line change
Expand Up @@ -1905,7 +1905,7 @@ static char *type_names[] = {
[LDMS_V_LIST_ENTRY] = "entry",
[LDMS_V_RECORD_TYPE] = "record_type",
[LDMS_V_RECORD_INST] = "record_inst",
[LDMS_V_RECORD_ARRAY] = "record_array",
[LDMS_V_RECORD_ARRAY] = "record[]",
[LDMS_V_TIMESTAMP] = "timestamp",
};

Expand Down Expand Up @@ -2147,7 +2147,8 @@ static struct _ldms_type_name_map {
{ "list<>", LDMS_V_LIST },
{ "none", LDMS_V_NONE },
{ "record", LDMS_V_RECORD_INST },
{ "record_array",LDMS_V_RECORD_ARRAY },
{ "record[]", LDMS_V_RECORD_ARRAY },
{ "record_array", LDMS_V_RECORD_ARRAY },
{ "record_type",LDMS_V_RECORD_TYPE },
{ "s16", LDMS_V_S16 },
{ "s16[]", LDMS_V_S16_ARRAY },
Expand Down
9 changes: 6 additions & 3 deletions ldms/src/ldmsd/ldms_ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,13 @@ void list_record_format(ldms_set_t s, ldms_mval_t lh)
printf("\n");

/* Print record values */
i = 0;
for (lval = ldms_list_first(s, lh, &ltype, &count); lval;
lval = ldms_list_next(s, lval, &ltype, &count)) {
if (i++)
printf("\n");
printf(" ");
record_format(lval, card, cw);
printf("\n");
}
}

Expand All @@ -450,10 +452,11 @@ void record_array_format(ldms_set_t s, ldms_mval_t rh)
printf("\n");

for (i = 0; i < len; i++) {
if (i)
printf("\n");
rec = ldms_record_array_get_inst(rh, i);
printf(" ");
record_format(rec, card, width);
printf("\n");
}
}

Expand Down Expand Up @@ -639,7 +642,7 @@ void metric_printer(ldms_set_t s, int i)
metunit = NULL;
}

printf("%c %-10s %-42s ",
printf("%c %-12s %-42s ",
(ldms_metric_flags_get(s, i) & LDMS_MDESC_F_DATA ? 'D' : 'M'),
ldms_metric_type_to_str(type), metname);
if (user_data)
Expand Down

0 comments on commit c2e31f0

Please sign in to comment.