Code

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 caf31e721b984e432f44a32978afdd6deabab85c..d818b937a4f49ca1254c1db40a29354698ff2f70 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 a298706fbae77be6e3588774ca123c19f5e3f8b3..8b4c788562ba4c759bb897102836283e6fab409e 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);