From 6bbdc6d1d601380661cf48c505bc6e71402f2eeb Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 20 Mar 2012 22:32:14 +0100 Subject: [PATCH] zfs_arc plugin: Introduce the single-valued "cache_eviction" type. --- src/types.db | 2 +- src/zfs_arc.c | 20 +++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/types.db b/src/types.db index caf31e72..d818b937 100644 --- a/src/types.db +++ b/src/types.db @@ -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 diff --git a/src/zfs_arc.c b/src/zfs_arc.c index a298706f..8b4c7885 100644 --- a/src/zfs_arc.c +++ b/src/zfs_arc.c @@ -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); -- 2.11.0