Code

write_prometheus plugin: Optimize metric_family_get_metric().
authorFlorian Forster <octo@collectd.org>
Sat, 1 Oct 2016 08:12:41 +0000 (10:12 +0200)
committerFlorian Forster <octo@collectd.org>
Fri, 11 Nov 2016 13:42:03 +0000 (14:42 +0100)
commit649a826ba0792bf4f48968c879011c6e1bcbc64a
tree0d21d3f4f9190ea5712593ffbd3247ba31775c2a
parentcc893903f8453dc96a797b319bdd4e294052de6f
write_prometheus plugin: Optimize metric_family_get_metric().

Profiling showed that prom_write() spent 73% of its time in this
function. 36% of time was spent in metric_create() and 19% was spent in
metric_destroy().

This patch replaces these two calls by a stack allocation, reducing the
time prom_write() spends in metric_family_get_metric() to 42%.
src/write_prometheus.c