[Accel-config] Re: [PATCH 2/2] accel-config: Add occupancy attribute to json wq object

Dave Jiang <dave.jiang at intel.com> Wed, 11 Aug 2021 08:28:17 -0700
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
On 8/10/2021 7:57 PM, ramesh.thomas(a)intel.com wrote:
> From: Ramesh Thomas <ramesh.thomas(a)intel.com>
>
> Add a json object for occupancy attribute in wq properties.

Not sure if we should bother. This value is only useful in the moment. 
There's not much value to display the stale output.


>
> Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
> ---
>   util/json.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/util/json.c b/util/json.c
> index 09d3a10..bd3f1ba 100644
> --- a/util/json.c
> +++ b/util/json.c
> @@ -461,6 +461,13 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,
>   	if (jobj)
>   		json_object_object_add(jaccfg, "ats_disable", jobj);
>   
> +	int_val = accfg_wq_get_occupancy(wq);
> +	if (int_val >= 0) {
> +		jobj = json_object_new_int(int_val);
> +		if (jobj)
> +			json_object_object_add(jaccfg, "occupancy", jobj);
> +	}
> +
>   	if (!(flags & UTIL_JSON_SAVE)) {
>   
>   		switch (wq_state) {