[dpdk-dev] [RFC 1/2] telemetry: support some recursive data objects

Bruce Richardson bruce.richardson at intel.com
Fri Jun 12 15:14:03 CEST 2020


On Fri, Jun 12, 2020 at 02:07:06PM +0100, Bruce Richardson wrote:
> On Fri, Jun 12, 2020 at 11:53:43AM +0100, Ciara Power wrote:
> > Dict data objects now support uint64_t array data object values.
> > Only one level of recursion supported.
> > 
> > Signed-off-by: Ciara Power <ciara.power at intel.com>
> > ---
<snip>
> >  static void
> >  output_json(const char *cmd, const struct rte_tel_data *d, int s)
> >  {
> > @@ -166,6 +189,17 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
> >  						buf_len, used,
> >  						v->name, v->value.u64val);
> >  				break;
> > +			case RTE_TEL_DATA_VAL:
> > +			{
> > +				char temp[buf_len];
> > +				if (recursive_data_json(v->value.dataval,
> > +						temp, buf_len) != 0)
> > +					used = rte_tel_json_add_obj_json(
> > +							cb_data_buf,
> > +							buf_len, used,
> > +							v->name, temp);
> > +				free(v->value.dataval);

Are there cases where we want to preserve the structure across calls rather
than doing an alloc and free each time?


More information about the dev mailing list