Commit 204f6a8c authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

lib: objagg: add root count to stats

Count number of roots and add it to stats. It is handy for the library
user to have this stats available as it can act upon it without
counting roots itself.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9069a381
...@@ -42,6 +42,7 @@ struct objagg_obj_stats_info { ...@@ -42,6 +42,7 @@ struct objagg_obj_stats_info {
}; };
struct objagg_stats { struct objagg_stats {
unsigned int root_count;
unsigned int stats_info_count; unsigned int stats_info_count;
struct objagg_obj_stats_info stats_info[]; struct objagg_obj_stats_info stats_info[];
}; };
......
...@@ -621,6 +621,8 @@ const struct objagg_stats *objagg_stats_get(struct objagg *objagg) ...@@ -621,6 +621,8 @@ const struct objagg_stats *objagg_stats_get(struct objagg *objagg)
objagg_stats->stats_info[i].objagg_obj = objagg_obj; objagg_stats->stats_info[i].objagg_obj = objagg_obj;
objagg_stats->stats_info[i].is_root = objagg_stats->stats_info[i].is_root =
objagg_obj_is_root(objagg_obj); objagg_obj_is_root(objagg_obj);
if (objagg_stats->stats_info[i].is_root)
objagg_stats->root_count++;
i++; i++;
} }
objagg_stats->stats_info_count = i; objagg_stats->stats_info_count = i;
...@@ -1031,6 +1033,8 @@ objagg_hints_stats_get(struct objagg_hints *objagg_hints) ...@@ -1031,6 +1033,8 @@ objagg_hints_stats_get(struct objagg_hints *objagg_hints)
list_for_each_entry(hnode, &objagg_hints->node_list, list) { list_for_each_entry(hnode, &objagg_hints->node_list, list) {
memcpy(&objagg_stats->stats_info[i], &hnode->stats_info, memcpy(&objagg_stats->stats_info[i], &hnode->stats_info,
sizeof(objagg_stats->stats_info[0])); sizeof(objagg_stats->stats_info[0]));
if (objagg_stats->stats_info[i].is_root)
objagg_stats->root_count++;
i++; i++;
} }
objagg_stats->stats_info_count = i; objagg_stats->stats_info_count = i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment