X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fzfs_arc.c;h=37a918b54bec75daa872ac1d40e1566af888d218;hb=edd9af8a874ebc9f2a7f02846807229a648917db;hp=1a7613c74a53cec15c7750395edd839220f2788c;hpb=b1b0aa549005c62b0e4651053198693e33ea84f0;p=collectd.git diff --git a/src/zfs_arc.c b/src/zfs_arc.c index 1a7613c7..37a918b5 100644 --- a/src/zfs_arc.c +++ b/src/zfs_arc.c @@ -71,7 +71,7 @@ static int put_zfs_value (kstat_t *ksp, char const *k, value_t v) return 0; } -static long long get_zfs_value(kstat_t *ksp, char *key) +static long long get_zfs_value(kstat_t *ksp, const char *key) { llentry_t *e; value_t *v; @@ -103,7 +103,7 @@ static void free_zfs_values (kstat_t *ksp) llist_destroy (ksp); } -#elif !defined(__FreeBSD__) // Solaris +#elif defined(KERNEL_SOLARIS) extern kstat_ctl_t *kc; static long long get_zfs_value(kstat_t *ksp, char *name) @@ -111,7 +111,7 @@ static long long get_zfs_value(kstat_t *ksp, char *name) return (get_kstat_value(ksp, name)); } -#else // FreeBSD +#elif defined(KERNEL_FREEBSD) #include #include @@ -219,7 +219,7 @@ static int za_read (void) value_t l2_io[2]; kstat_t *ksp = NULL; -#if KERNEL_LINUX +#if defined(KERNEL_LINUX) FILE *fh; char buffer[1024]; @@ -259,7 +259,7 @@ static int za_read (void) fclose (fh); -#elif !defined(__FreeBSD__) // Solaris +#elif defined(KERNEL_SOLARIS) get_kstat (&ksp, "zfs", 0, "arcstats"); if (ksp == NULL) { @@ -269,10 +269,19 @@ static int za_read (void) #endif /* Sizes */ - za_read_gauge (ksp, "size", "cache_size", "arc"); - za_read_gauge (ksp, "c", "cache_size", "c"); - za_read_gauge (ksp, "c_min", "cache_size", "c_min"); - za_read_gauge (ksp, "c_max", "cache_size", "c_max"); + za_read_gauge (ksp, "anon_size", "cache_size", "anon_size"); + za_read_gauge (ksp, "c", "cache_size", "c"); + za_read_gauge (ksp, "c_max", "cache_size", "c_max"); + za_read_gauge (ksp, "c_min", "cache_size", "c_min"); + za_read_gauge (ksp, "hdr_size", "cache_size", "hdr_size"); + za_read_gauge (ksp, "metadata_size", "cache_size", "metadata_size"); + za_read_gauge (ksp, "mfu_ghost_size", "cache_size", "mfu_ghost_size"); + za_read_gauge (ksp, "mfu_size", "cache_size", "mfu_size"); + za_read_gauge (ksp, "mru_ghost_size", "cache_size", "mru_ghost_size"); + za_read_gauge (ksp, "mru_size", "cache_size", "mru_size"); + za_read_gauge (ksp, "other_size", "cache_size", "other_size"); + za_read_gauge (ksp, "p", "cache_size", "p"); + za_read_gauge (ksp, "size", "cache_size", "arc"); /* The "l2_size" value has disappeared from Solaris some time in * early 2013, and has only reappeared recently in Solaris 11.2. @@ -284,14 +293,18 @@ static int za_read (void) /* Operations */ za_read_derive (ksp, "deleted", "cache_operation", "deleted"); -#if __FreeBSD__ +#if defined(KERNEL_FREEBSD) za_read_derive (ksp, "allocated","cache_operation", "allocated"); +#if __FreeBSD_version < 1002501 + /* stolen removed from sysctl kstat.zfs.misc.arcstats on FreeBSD 10.2+ */ za_read_derive (ksp, "stolen", "cache_operation", "stolen"); #endif +#endif /* Issue indicators */ za_read_derive (ksp, "mutex_miss", "mutex_operations", "miss"); za_read_derive (ksp, "hash_collisions", "hash_collisions", ""); + za_read_derive (ksp, "memory_throttle_count", "memory_throttle_count", ""); /* Evictions */ za_read_derive (ksp, "evict_l2_cached", "cache_eviction", "cached"); @@ -307,6 +320,11 @@ static int za_read (void) za_read_derive (ksp, "demand_metadata_misses", "cache_result", "demand_metadata-miss"); za_read_derive (ksp, "prefetch_data_misses", "cache_result", "prefetch_data-miss"); za_read_derive (ksp, "prefetch_metadata_misses", "cache_result", "prefetch_metadata-miss"); + za_read_derive (ksp, "mfu_hits", "cache_result", "mfu-hit"); + za_read_derive (ksp, "mfu_ghost_hits", "cache_result", "mfu_ghost-hit"); + za_read_derive (ksp, "mru_hits", "cache_result", "mru-hit"); + za_read_derive (ksp, "mru_ghost_hits", "cache_result", "mru_ghost-hit"); + za_read_derive (ksp, "prefetch_metadata_misses", "cache_result", "prefetch_metadata-miss"); /* Ratios */ arc_hits = (gauge_t) get_zfs_value(ksp, "hits"); @@ -332,7 +350,7 @@ static int za_read (void) static int za_init (void) /* {{{ */ { -#if !defined(__FreeBSD__) && !defined(KERNEL_LINUX) // Solaris +#if defined(KERNEL_SOLARIS) /* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */ if (kc == NULL) {