diff options
Diffstat (limited to 'collectors/proc.plugin/ipc.c')
-rw-r--r-- | collectors/proc.plugin/ipc.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/collectors/proc.plugin/ipc.c b/collectors/proc.plugin/ipc.c index b5c9ae5e..9185894e 100644 --- a/collectors/proc.plugin/ipc.c +++ b/collectors/proc.plugin/ipc.c @@ -281,7 +281,7 @@ int do_ipc(int update_every, usec_t dt) { static int read_limits_next = -1; static struct ipc_limits limits; static struct ipc_status status; - static RRDVAR *arrays_max = NULL, *semaphores_max = NULL; + static const RRDVAR_ACQUIRED *arrays_max = NULL, *semaphores_max = NULL; static RRDSET *st_semaphores = NULL, *st_arrays = NULL; static RRDDIM *rd_semaphores = NULL, *rd_arrays = NULL; static char *msg_filename = NULL; @@ -352,8 +352,8 @@ int do_ipc(int update_every, usec_t dt) { } // variables - semaphores_max = rrdvar_custom_host_variable_create(localhost, "ipc_semaphores_max"); - arrays_max = rrdvar_custom_host_variable_create(localhost, "ipc_semaphores_arrays_max"); + semaphores_max = rrdvar_custom_host_variable_add_and_acquire(localhost, "ipc_semaphores_max"); + arrays_max = rrdvar_custom_host_variable_add_and_acquire(localhost, "ipc_semaphores_arrays_max"); } struct stat stbuf; @@ -390,17 +390,13 @@ int do_ipc(int update_every, usec_t dt) { return 0; } - if(st_semaphores->counter_done) rrdset_next(st_semaphores); rrddim_set_by_pointer(st_semaphores, rd_semaphores, status.semaem); rrdset_done(st_semaphores); - if(st_arrays->counter_done) rrdset_next(st_arrays); rrddim_set_by_pointer(st_arrays, rd_arrays, status.semusz); rrdset_done(st_arrays); } - // -------------------------------------------------------------------- - if(likely(do_msg != CONFIG_BOOLEAN_NO)) { static RRDSET *st_msq_messages = NULL, *st_msq_bytes = NULL; @@ -422,8 +418,6 @@ int do_ipc(int update_every, usec_t dt) { , update_every , RRDSET_TYPE_STACKED ); - else - rrdset_next(st_msq_messages); if(unlikely(!st_msq_bytes)) st_msq_bytes = rrdset_create_localhost( @@ -440,8 +434,6 @@ int do_ipc(int update_every, usec_t dt) { , update_every , RRDSET_TYPE_STACKED ); - else - rrdset_next(st_msq_bytes); struct message_queue *msq = message_queue_root, *msq_prev = NULL; while(likely(msq)){ @@ -483,11 +475,7 @@ int do_ipc(int update_every, usec_t dt) { rrdset_done(st_msq_messages); rrdset_done(st_msq_bytes); - long long dimensions_num = 0; - RRDDIM *rd; - rrdset_rdlock(st_msq_messages); - rrddim_foreach_read(rd, st_msq_messages) dimensions_num++; - rrdset_unlock(st_msq_messages); + long long dimensions_num = rrdset_number_of_dimensions(st_msq_messages); if(unlikely(dimensions_num > dimensions_limit)) { info("Message queue statistics has been disabled"); @@ -499,19 +487,17 @@ int do_ipc(int update_every, usec_t dt) { do_msg = CONFIG_BOOLEAN_NO; } else if(unlikely(!message_queue_root)) { - info("Making chart %s (%s) obsolete since it does not have any dimensions", st_msq_messages->name, st_msq_messages->id); + info("Making chart %s (%s) obsolete since it does not have any dimensions", rrdset_name(st_msq_messages), rrdset_id(st_msq_messages)); rrdset_is_obsolete(st_msq_messages); st_msq_messages = NULL; - info("Making chart %s (%s) obsolete since it does not have any dimensions", st_msq_bytes->name, st_msq_bytes->id); + info("Making chart %s (%s) obsolete since it does not have any dimensions", rrdset_name(st_msq_bytes), rrdset_id(st_msq_bytes)); rrdset_is_obsolete(st_msq_bytes); st_msq_bytes = NULL; } } } - // -------------------------------------------------------------------- - if(likely(do_shm != CONFIG_BOOLEAN_NO)) { static RRDSET *st_shm_segments = NULL, *st_shm_bytes = NULL; static RRDDIM *rd_shm_segments = NULL, *rd_shm_bytes = NULL; @@ -536,15 +522,10 @@ int do_ipc(int update_every, usec_t dt) { rd_shm_segments = rrddim_add(st_shm_segments, "segments", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } - else - rrdset_next(st_shm_segments); rrddim_set_by_pointer(st_shm_segments, rd_shm_segments, shm.segments); - rrdset_done(st_shm_segments); - // -------------------------------------------------------------------- - if(unlikely(!st_shm_bytes)) { st_shm_bytes = rrdset_create_localhost( "system" @@ -563,11 +544,8 @@ int do_ipc(int update_every, usec_t dt) { rd_shm_bytes = rrddim_add(st_shm_bytes, "bytes", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } - else - rrdset_next(st_shm_bytes); rrddim_set_by_pointer(st_shm_bytes, rd_shm_bytes, shm.bytes); - rrdset_done(st_shm_bytes); } } |