diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-20 04:50:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-20 04:50:01 +0000 |
commit | cd4377fab21e0f500bef7f06543fa848a039c1e0 (patch) | |
tree | ba00a55e430c052d6bed0b61c0f8bbe8ebedd313 /libnetdata/worker_utilization/worker_utilization.c | |
parent | Releasing debian version 1.40.1-1. (diff) | |
download | netdata-cd4377fab21e0f500bef7f06543fa848a039c1e0.tar.xz netdata-cd4377fab21e0f500bef7f06543fa848a039c1e0.zip |
Merging upstream version 1.41.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | libnetdata/worker_utilization/worker_utilization.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/libnetdata/worker_utilization/worker_utilization.c b/libnetdata/worker_utilization/worker_utilization.c index d47d81c4e..ad45dbc7f 100644 --- a/libnetdata/worker_utilization/worker_utilization.c +++ b/libnetdata/worker_utilization/worker_utilization.c @@ -70,9 +70,9 @@ static inline usec_t worker_now_monotonic_usec(void) { } size_t workers_allocated_memory(void) { - netdata_spinlock_lock(&workers_globals.spinlock); + spinlock_lock(&workers_globals.spinlock); size_t memory = workers_globals.memory; - netdata_spinlock_unlock(&workers_globals.spinlock); + spinlock_unlock(&workers_globals.spinlock); return memory; } @@ -91,7 +91,7 @@ void worker_register(const char *name) { worker->last_action = WORKER_IDLE; size_t name_size = strlen(name) + 1; - netdata_spinlock_lock(&workers_globals.spinlock); + spinlock_lock(&workers_globals.spinlock); workers_globals.memory += sizeof(struct worker) + strlen(worker->tag) + 1 + strlen(worker->workname) + 1; @@ -100,25 +100,25 @@ void worker_register(const char *name) { struct workers_workname *workname = *PValue; if(!workname) { workname = mallocz(sizeof(struct workers_workname)); - netdata_spinlock_init(&workname->spinlock); + spinlock_init(&workname->spinlock); workname->base = NULL; *PValue = workname; workers_globals.memory += sizeof(struct workers_workname) + JUDYHS_INDEX_SIZE_ESTIMATE(name_size); } - netdata_spinlock_lock(&workname->spinlock); + spinlock_lock(&workname->spinlock); DOUBLE_LINKED_LIST_APPEND_ITEM_UNSAFE(workname->base, worker, prev, next); - netdata_spinlock_unlock(&workname->spinlock); + spinlock_unlock(&workname->spinlock); - netdata_spinlock_unlock(&workers_globals.spinlock); + spinlock_unlock(&workers_globals.spinlock); } void worker_register_job_custom_metric(size_t job_id, const char *name, const char *units, WORKER_METRIC_TYPE type) { if(unlikely(!worker)) return; if(unlikely(job_id >= WORKER_UTILIZATION_MAX_JOB_TYPES)) { - error("WORKER_UTILIZATION: job_id %zu is too big. Max is %zu", job_id, (size_t)(WORKER_UTILIZATION_MAX_JOB_TYPES - 1)); + netdata_log_error("WORKER_UTILIZATION: job_id %zu is too big. Max is %zu", job_id, (size_t)(WORKER_UTILIZATION_MAX_JOB_TYPES - 1)); return; } @@ -127,7 +127,7 @@ void worker_register_job_custom_metric(size_t job_id, const char *name, const ch if(worker->per_job_type[job_id].name) { if(strcmp(string2str(worker->per_job_type[job_id].name), name) != 0 || worker->per_job_type[job_id].type != type || strcmp(string2str(worker->per_job_type[job_id].units), units) != 0) - error("WORKER_UTILIZATION: duplicate job registration: worker '%s' job id %zu is '%s', ignoring the later '%s'", worker->workname, job_id, string2str(worker->per_job_type[job_id].name), name); + netdata_log_error("WORKER_UTILIZATION: duplicate job registration: worker '%s' job id %zu is '%s', ignoring the later '%s'", worker->workname, job_id, string2str(worker->per_job_type[job_id].name), name); return; } @@ -144,13 +144,13 @@ void worker_unregister(void) { if(unlikely(!worker)) return; size_t workname_size = strlen(worker->workname) + 1; - netdata_spinlock_lock(&workers_globals.spinlock); + spinlock_lock(&workers_globals.spinlock); Pvoid_t *PValue = JudyHSGet(workers_globals.worknames_JudyHS, (void *)worker->workname, workname_size); if(PValue) { struct workers_workname *workname = *PValue; - netdata_spinlock_lock(&workname->spinlock); + spinlock_lock(&workname->spinlock); DOUBLE_LINKED_LIST_REMOVE_ITEM_UNSAFE(workname->base, worker, prev, next); - netdata_spinlock_unlock(&workname->spinlock); + spinlock_unlock(&workname->spinlock); if(!workname->base) { JudyHSDel(&workers_globals.worknames_JudyHS, (void *) worker->workname, workname_size, PJE0); @@ -159,7 +159,7 @@ void worker_unregister(void) { } } workers_globals.memory -= sizeof(struct worker) + strlen(worker->tag) + 1 + strlen(worker->workname) + 1; - netdata_spinlock_unlock(&workers_globals.spinlock); + spinlock_unlock(&workers_globals.spinlock); for(int i = 0; i < WORKER_UTILIZATION_MAX_JOB_TYPES ;i++) { string_freez(worker->per_job_type[i].name); @@ -247,7 +247,7 @@ void workers_foreach(const char *name, void (*callback)( , NETDATA_DOUBLE *job_custom_values ) , void *data) { - netdata_spinlock_lock(&workers_globals.spinlock); + spinlock_lock(&workers_globals.spinlock); usec_t busy_time, delta; size_t i, jobs_started, jobs_running; @@ -256,12 +256,12 @@ void workers_foreach(const char *name, void (*callback)( Pvoid_t *PValue = JudyHSGet(workers_globals.worknames_JudyHS, (void *)name, workname_size); if(PValue) { workname = *PValue; - netdata_spinlock_lock(&workname->spinlock); + spinlock_lock(&workname->spinlock); } else workname = NULL; - netdata_spinlock_unlock(&workers_globals.spinlock); + spinlock_unlock(&workers_globals.spinlock); if(!workname) return; @@ -379,5 +379,5 @@ void workers_foreach(const char *name, void (*callback)( ); } - netdata_spinlock_unlock(&workname->spinlock); + spinlock_unlock(&workname->spinlock); } |