author | Matthias Bethke <matthias.bethke@financial.com> | |
Wed, 10 Sep 2014 17:34:50 +0000 (19:34 +0200) | ||
committer | Matthias Bethke <matthias.bethke@financial.com> | |
Wed, 10 Sep 2014 17:34:50 +0000 (19:34 +0200) | ||
commit | baf396c9088643cfd6578edc5c6fb3012750c685 | |
tree | 21c4d008110db83277f1e1c78ecdc11d2d6cb0e9 | tree | snapshot |
parent | 04c92d78fd2077b812f1b757a2744b83bdec75d8 | commit | diff |
add listval_filter method and corresponding tests
Rationale:
A frequent use case for LISTVAL is to retrieve a list of resources for a certain
host or host group that is not known in advance, such as when the hosts have
different disks installed. Using the existing listval() method,
Collectd::Unixsock retrieves the entire list, parses each entry into a hash and
returns the list, only to have the caller throw away the vast majority of
entries immediately. listval_filter() allows the caller to pass any attribute
that can be passed to getval() and filters the list of resources retrieved from
the socket before parsing it, resulting in a large speedup.
The current implemntation has some code duplication, although listval() could be
implemented as a small wrapper around listval_filter() with just a few percent
speed penalty due to the extra dynamically built regexp.
Rationale:
A frequent use case for LISTVAL is to retrieve a list of resources for a certain
host or host group that is not known in advance, such as when the hosts have
different disks installed. Using the existing listval() method,
Collectd::Unixsock retrieves the entire list, parses each entry into a hash and
returns the list, only to have the caller throw away the vast majority of
entries immediately. listval_filter() allows the caller to pass any attribute
that can be passed to getval() and filters the list of resources retrieved from
the socket before parsing it, resulting in a large speedup.
The current implemntation has some code duplication, although listval() could be
implemented as a small wrapper around listval_filter() with just a few percent
speed penalty due to the extra dynamically built regexp.
bindings/perl/lib/Collectd/Unixsock.pm | diff | blob | history | |
bindings/perl/t/01_methods.t | diff | blob | history |