ovis icon indicating copy to clipboard operation
ovis copied to clipboard

ldms_metric_by_name() needs improved implementation

Open morrone opened this issue 5 years ago • 1 comments

ldms_metric_by_name() currently employs a simple linear search. Because of this, it is currently forbidden for plugins to actually use ldms_metric_by_name() in the critical path. But plugins where a name-to-index number conversion is required by the nature of the data being sampled, ldms_metric_by_name() accomplishes exactly the task required, but the plugin is forbidden to use it and must implement its own more efficient lookup.

It would seem that improving the ldms_metric_by_name() implementation such that it is permitted to be used in the critical path (where required) would help plugins avoid re-implementing the same lookup code repeatedly.

morrone avatar Apr 30 '19 18:04 morrone

We can certainly do this. It would be relatively trivial to sort the metric names and use bsearch when the in-memory set data is constructed when lookup completes.

Doing it this way would also be backward compatible; newer versions would simply run faster.

tom95858 avatar Nov 11 '19 15:11 tom95858