Source
static int vmware_service_process_perf_entity_data(zbx_vmware_perf_data_t *perfdata, xmlDoc *xdoc, xmlNode *node)
/*
** Copyright (C) 2001-2024 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
ZBX_VECTOR_IMPL(uint16, uint16_t)
ZBX_PTR_VECTOR_IMPL(perf_available_ptr, zbx_vmware_perf_available_t *)
ZBX_PTR_VECTOR_IMPL(vmware_perf_value_ptr, zbx_vmware_perf_value_t *)
ZBX_PTR_VECTOR_IMPL(vmware_counter_ptr, zbx_vmware_counter_t *)
/******************************************************************************
* *
* performance counter hashset support functions *
* *
******************************************************************************/
zbx_hash_t vmware_counter_hash_func(const void *data)
{
const zbx_vmware_counter_t *counter = (const zbx_vmware_counter_t *)data;
return ZBX_DEFAULT_STRING_HASH_ALGO(counter->path, strlen(counter->path), ZBX_DEFAULT_HASH_SEED);
}
int vmware_counter_compare_func(const void *d1, const void *d2)
{
const zbx_vmware_counter_t *c1 = (const zbx_vmware_counter_t *)d1;
const zbx_vmware_counter_t *c2 = (const zbx_vmware_counter_t *)d2;
return strcmp(c1->path, c2->path);
}
/******************************************************************************
* *
* performance entities hashset support functions *
* *
******************************************************************************/
zbx_hash_t vmware_perf_entity_hash_func(const void *data)
{
zbx_hash_t seed;
const zbx_vmware_perf_entity_t *entity = (const zbx_vmware_perf_entity_t *)data;
seed = ZBX_DEFAULT_STRING_HASH_ALGO(entity->type, strlen(entity->type), ZBX_DEFAULT_HASH_SEED);
return ZBX_DEFAULT_STRING_HASH_ALGO(entity->id, strlen(entity->id), seed);
}
int vmware_perf_entity_compare_func(const void *d1, const void *d2)
{
int ret;
const zbx_vmware_perf_entity_t *e1 = (const zbx_vmware_perf_entity_t *)d1;
const zbx_vmware_perf_entity_t *e2 = (const zbx_vmware_perf_entity_t *)d2;
if (0 == (ret = strcmp(e1->type, e2->type)))
ret = strcmp(e1->id, e2->id);
return ret;
}
/******************************************************************************
* *
* performance counter availability list support functions *
* *
******************************************************************************/
static int vmware_perf_available_compare(const void *d1, const void *d2)