zfs_arc plugin: Introduce the single-valued "cache_eviction" type.
authorFlorian Forster <octo@collectd.org>
Tue, 20 Mar 2012 21:32:14 +0000 (22:32 +0100)
committerFlorian Forster <octo@collectd.org>
Tue, 20 Mar 2012 21:32:14 +0000 (22:32 +0100)
src/types.db
src/zfs_arc.c

index caf31e7..d818b93 100644 (file)
@@ -8,6 +8,7 @@ ath_nodes               value:GAUGE:0:65535
 ath_stat               value:DERIVE:0:U
 bitrate                        value:GAUGE:0:4294967295
 bytes                  value:GAUGE:0:U
+cache_eviction         value:DERIVE:0:U
 cache_operation                value:DERIVE:0:U
 cache_ratio            value:GAUGE:0:100
 cache_result           value:DERIVE:0:U
@@ -56,7 +57,6 @@ email_check           value:GAUGE:0:U
 email_count            value:GAUGE:0:U
 email_size             value:GAUGE:0:U
 entropy                        value:GAUGE:0:4294967295
-evict                   evict_l2_cached:COUNTER:0:U, evict_l2_eligible:COUNTER:0:U, evict_l2_ineligible:COUNTER:0:U
 fanspeed               value:GAUGE:0:U
 file_size              value:GAUGE:0:U
 files                  value:GAUGE:0:U
index a298706..8b4c788 100644 (file)
@@ -75,19 +75,7 @@ static void za_submit_ratio (const char* type_instance, gauge_t hits, gauge_t mi
        za_submit_gauge ("cache_ratio", type_instance, ratio);
 }
 
-static void za_submit_evict_counts (counter_t evict_l2_cached, counter_t evict_l2_eligible,
-       counter_t evict_l2_ineligible)
-{
-       value_t values[3];
-
-       values[0].counter = evict_l2_cached;
-       values[1].counter = evict_l2_eligible;
-       values[2].counter = evict_l2_ineligible;
-
-       za_submit ("evict", "counts", values, STATIC_ARRAY_SIZE(values));
-}
-
-static void za_submit_mutex_counts (counter_t mutex_miss)
+static void za_submit_mutex_counts (derive_t mutex_miss)
 {
        value_t values[1];
 
@@ -154,6 +142,10 @@ static int za_read (void)
        evict_l2_eligible        = get_kstat_value(ksp, "evict_l2_eligible");
        evict_l2_ineligible      = get_kstat_value(ksp, "evict_l2_ineligible");
        
+       za_submit_derive ("cache_eviction", "cached",     evict_l2_cached);
+       za_submit_derive ("cache_eviction", "eligible",   evict_l2_eligible);
+       za_submit_derive ("cache_eviction", "ineligible", evict_l2_ineligible);
+
        hash_collisions          = get_kstat_value(ksp, "hash_collisions");
 
        /* Hits / misses */
@@ -192,8 +184,6 @@ static int za_read (void)
 
        za_submit ("io_octets", "L2", l2_io, /* num values = */ 2);
 
-       za_submit_evict_counts (evict_l2_cached, evict_l2_eligible, evict_l2_ineligible);
-
        za_submit_mutex_counts (mutex_miss);
 
        za_submit_deleted_counts (deleted);