+sub plugin_flush {
+ my %args = @_;
+
+ my $timeout = -1;
+
+ DEBUG ("Collectd::plugin_flush:"
+ . (defined ($args{'timeout'}) ? " timeout = $args{'timeout'}" : "")
+ . (defined ($args{'plugins'}) ? " plugins = $args{'plugins'}" : ""));
+
+ if (defined ($args{'timeout'}) && ($args{'timeout'} > 0)) {
+ $timeout = $args{'timeout'};
+ }
+
+ if (! defined $args{'plugins'}) {
+ plugin_flush_all ($timeout);
+ }
+ else {
+ if ("ARRAY" eq ref ($args{'plugins'})) {
+ foreach my $plugin (@{$args{'plugins'}}) {
+ plugin_flush_one ($timeout, $plugin);
+ }
+ }
+ else {
+ plugin_flush_one ($timeout, $args{'plugins'});
+ }
+ }
+}
+