mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
util: Introduce virResctrlMonitorFreeStats
The call of virResctrlMonitorGetStats will allocate the memory for holding cache occupancy or memory bandwidth statistics. This patch adds the function virResctrlMonitorFreeStats as the opposing action of virResctrlMonitorGetStats to free the memory. Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
ef0027ceb6
commit
a60b7d7582
@ -2692,6 +2692,7 @@ virResctrlInfoNew;
|
||||
virResctrlMonitorAddPID;
|
||||
virResctrlMonitorCreate;
|
||||
virResctrlMonitorDeterminePath;
|
||||
virResctrlMonitorFreeStats;
|
||||
virResctrlMonitorGetCacheOccupancy;
|
||||
virResctrlMonitorGetID;
|
||||
virResctrlMonitorNew;
|
||||
|
@ -2747,6 +2747,22 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr *stats,
|
||||
size_t nstats)
|
||||
{
|
||||
size_t i = 0;
|
||||
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
for (i = 0; i < nstats; i++)
|
||||
VIR_FREE(stats[i]);
|
||||
|
||||
VIR_FREE(stats);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* virResctrlMonitorGetCacheOccupancy
|
||||
*
|
||||
|
@ -231,4 +231,8 @@ int
|
||||
virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor,
|
||||
virResctrlMonitorStatsPtr **stats,
|
||||
size_t *nstats);
|
||||
|
||||
void
|
||||
virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr *stats,
|
||||
size_t nstats);
|
||||
#endif /* __VIR_RESCTRL_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user