Code

zfs_arc plugin: Fix the "hash collision" and "mutex miss" metrics.
authorFlorian Forster <octo@collectd.org>
Wed, 21 Mar 2012 06:41:38 +0000 (07:41 +0100)
committerFlorian Forster <octo@collectd.org>
Wed, 21 Mar 2012 06:41:38 +0000 (07:41 +0100)
src/types.db
src/zfs_arc.c

index 4d3951b1e4e0d47a5450c597b244674e608110b2..ed27b7854fb568a3a347fc2f9330dd23e6cc766b 100644 (file)
@@ -26,7 +26,6 @@ current_connections   value:GAUGE:0:U
 current_sessions       value:GAUGE:0:U
 current                        value:GAUGE:U:U
 delay                  value:GAUGE:-1000000:1000000
-deleted                 deleted:COUNTER:0:U
 derive                 value:DERIVE:0:U
 df_complex             value:GAUGE:0:U
 df_inodes              value:GAUGE:0:U
@@ -65,7 +64,7 @@ frequency             value:GAUGE:0:U
 frequency_offset       value:GAUGE:-1000000:1000000
 fscache_stat           value:DERIVE:0:U
 gauge                  value:GAUGE:U:U
-hash                    hash_collisions:COUNTER:0:U
+hash_collisions                value:DERIVE:0:U
 http_request_methods   value:DERIVE:0:U
 http_requests          value:DERIVE:0:U
 http_response_codes    value:DERIVE:0:U
index 584e11da2a60b410e88560b6a4ce78591c8e4ab8..4ee7f53eb8d4310c799c23141e7c806251abb254 100644 (file)
@@ -75,24 +75,6 @@ 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_deleted_counts (derive_t deleted)
-{
-       value_t values[1];
-
-       values[0].counter = deleted;
-
-       za_submit ("deleted", "counts", values, STATIC_ARRAY_SIZE(values));
-}
-
-static void za_submit_hash_counts (derive_t hash_collisions)
-{
-       value_t values[1];
-
-       values[0].counter = hash_collisions;
-
-       za_submit ("hash", "counts", values, STATIC_ARRAY_SIZE(values));
-}
-
 static int za_read (void)
 {
        gauge_t  arc_size, l2_size;
@@ -107,7 +89,7 @@ static int za_read (void)
        gauge_t  arc_hits, arc_misses, l2_hits, l2_misses;
        value_t  l2_io[2];
        derive_t mutex_miss;
-       derive_t deleted;
+       derive_t allocated, deleted, stolen;
        derive_t evict_l2_cached, evict_l2_eligible, evict_l2_ineligible;
        derive_t hash_collisions;
 
@@ -128,7 +110,15 @@ static int za_read (void)
        mutex_miss = get_kstat_value (ksp, "mutex_miss");
        za_submit_derive ("mutex_operation", "miss", mutex_miss);
 
-       deleted                  = get_kstat_value(ksp, "deleted");
+       allocated = get_kstat_value(ksp, "allocated");
+       deleted   = get_kstat_value(ksp, "deleted");
+       stolen    = get_kstat_value(ksp, "stolen");
+       za_submit_derive ("cache_operation", "allocated", allocated);
+       za_submit_derive ("cache_operation", "deleted",   deleted);
+       za_submit_derive ("cache_operation", "stolen",    stolen);
+
+       hash_collisions = get_kstat_value(ksp, "hash_collisions");
+       za_submit_derive ("hash_collisions", "", hash_collisions);
        
        evict_l2_cached          = get_kstat_value(ksp, "evict_l2_cached");
        evict_l2_eligible        = get_kstat_value(ksp, "evict_l2_eligible");
@@ -138,8 +128,6 @@ static int za_read (void)
        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 */
        demand_data_hits       = get_kstat_value(ksp, "demand_data_hits");
        demand_metadata_hits   = get_kstat_value(ksp, "demand_metadata_hits");
@@ -176,10 +164,6 @@ static int za_read (void)
 
        za_submit ("io_octets", "L2", l2_io, /* num values = */ 2);
 
-       za_submit_deleted_counts (deleted);
-
-       za_submit_hash_counts (hash_collisions);
-
        return (0);
 } /* int za_read */