diff options
author | Richard Braun <rbraun@sceen.net> | 2017-03-15 21:43:41 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-03-15 21:56:42 +0100 |
commit | 196eae0d9ee0d2d8ca42e96e49d6988313d39f6d (patch) | |
tree | 81d20378edede1e02d8f8f578331848715667877 /kern | |
parent | 0f8c14517212dfd03c5cafcab56ffc7dead18209 (diff) |
kern/syscnt: replace the evcnt module
The syscnt module supports more generic counters, in addition to atomic
access from any context on any architecture.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/evcnt.c | 76 | ||||
-rw-r--r-- | kern/evcnt.h | 101 | ||||
-rw-r--r-- | kern/llsync.c | 14 | ||||
-rw-r--r-- | kern/llsync_i.h | 8 | ||||
-rw-r--r-- | kern/macros.h | 3 | ||||
-rw-r--r-- | kern/sref.c | 42 | ||||
-rw-r--r-- | kern/syscnt.c | 84 | ||||
-rw-r--r-- | kern/syscnt.h | 121 | ||||
-rw-r--r-- | kern/syscnt_types.h | 43 | ||||
-rw-r--r-- | kern/thread.c | 16 | ||||
-rw-r--r-- | kern/work.c | 10 |
11 files changed, 296 insertions, 222 deletions
diff --git a/kern/evcnt.c b/kern/evcnt.c deleted file mode 100644 index e993edd..0000000 --- a/kern/evcnt.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2014 Richard Braun. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <string.h> - -#include <kern/evcnt.h> -#include <kern/init.h> -#include <kern/list.h> -#include <kern/mutex.h> -#include <kern/printk.h> - -/* - * Global list of all registered counters. - */ -static struct list evcnt_list; -static struct mutex evcnt_mutex; - -void __init -evcnt_setup(void) -{ - list_init(&evcnt_list); - mutex_init(&evcnt_mutex); -} - -void -evcnt_register(struct evcnt *evcnt, const char *name) -{ - evcnt->count = 0; - strlcpy(evcnt->name, name, sizeof(evcnt->name)); - - mutex_lock(&evcnt_mutex); - list_insert_tail(&evcnt_list, &evcnt->node); - mutex_unlock(&evcnt_mutex); -} - -void -evcnt_info(const char *pattern) -{ - struct evcnt *evcnt; - size_t length, pattern_length; - - pattern_length = (pattern == NULL) ? 0 : strlen(pattern); - - printk("evcnt: name count\n"); - - mutex_lock(&evcnt_mutex); - - list_for_each_entry(&evcnt_list, evcnt, node) { - if (pattern_length != 0) { - length = strlen(evcnt->name); - - if ((length < pattern_length) - || (memcmp(evcnt->name, pattern, pattern_length) != 0)) { - continue; - } - } - - printk("evcnt: %-30s %17llu\n", evcnt->name, evcnt->count); - } - - mutex_unlock(&evcnt_mutex); -} diff --git a/kern/evcnt.h b/kern/evcnt.h deleted file mode 100644 index ae01403..0000000 --- a/kern/evcnt.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2014 Richard Braun. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - * - * Generic event counters. - */ - -#ifndef _KERN_EVCNT_H -#define _KERN_EVCNT_H - -#include <kern/list_types.h> - -/* - * Size of the buffer storing an event counter name. - */ -#define EVCNT_NAME_SIZE 32 - -/* - * Event counter structure. - * - * Event counters are guaranteed to be 64-bits wide. - */ -struct evcnt { - unsigned long long count; - struct list node; - char name[EVCNT_NAME_SIZE]; -}; - -/* - * Initialize the evcnt module. - * - * This module is initialized by architecture-specific code. It is normally - * safe to call this function very early at boot time. - */ -void evcnt_setup(void); - -/* - * Register the given counter. - */ -void evcnt_register(struct evcnt *evcnt, const char *name); - -/* - * Increment the given counter. - * - * It is the responsibility of the caller to synchronize access to the - * counter. - */ -static inline void -evcnt_inc(struct evcnt *evcnt) -{ - evcnt->count++; -} - -/* - * Batched increment. - * - * It is the responsibility of the caller to synchronize access to the - * counter. - */ -static inline void -evcnt_add(struct evcnt *evcnt, unsigned long long delta) -{ - evcnt->count += delta; -} - -/* - * Obtain the current value of the given counter. - * - * Since counters are 64-bits wide, retrieving them on 32-bits systems might - * return invalid values, although this should be very rare. As long as users - * don't rely on them for critical operations, this is completely harmless. - */ -static inline unsigned long long -evcnt_read(const struct evcnt *evcnt) -{ - return evcnt->count; -} - -/* - * Display the registered event counters. - * - * A pattern can be used to filter the output. The result will only include - * counters for which the beginning of their name matches the pattern. - * If NULL, all counters are reported. - */ -void evcnt_info(const char *pattern); - -#endif /* _KERN_EVCNT_H */ diff --git a/kern/llsync.c b/kern/llsync.c index 059773f..0cee270 100644 --- a/kern/llsync.c +++ b/kern/llsync.c @@ -38,7 +38,6 @@ #include <kern/assert.h> #include <kern/condition.h> #include <kern/cpumap.h> -#include <kern/evcnt.h> #include <kern/init.h> #include <kern/list.h> #include <kern/llsync.h> @@ -50,6 +49,7 @@ #include <kern/printk.h> #include <kern/spinlock.h> #include <kern/sprintf.h> +#include <kern/syscnt.h> #include <kern/work.h> #include <machine/cpu.h> @@ -92,11 +92,11 @@ llsync_setup(void) spinlock_init(&llsync_data.lock); work_queue_init(&llsync_data.queue0); work_queue_init(&llsync_data.queue1); - evcnt_register(&llsync_data.ev_global_checkpoint, + syscnt_register(&llsync_data.sc_global_checkpoint, "llsync_global_checkpoint"); - evcnt_register(&llsync_data.ev_periodic_checkin, + syscnt_register(&llsync_data.sc_periodic_checkin, "llsync_periodic_checkin"); - evcnt_register(&llsync_data.ev_failed_periodic_checkin, + syscnt_register(&llsync_data.sc_failed_periodic_checkin, "llsync_failed_periodic_checkin"); llsync_data.gcid.value = LLSYNC_INITIAL_GCID; @@ -143,7 +143,7 @@ llsync_process_global_checkpoint(void) } llsync_data.gcid.value++; - evcnt_inc(&llsync_data.ev_global_checkpoint); + syscnt_inc(&llsync_data.sc_global_checkpoint); } static void @@ -273,10 +273,10 @@ llsync_report_periodic_event(void) llsync_commit_checkpoint(cpu_id()); } else { if (thread_llsync_in_read_cs()) { - evcnt_inc(&llsync_data.ev_failed_periodic_checkin); + syscnt_inc(&llsync_data.sc_failed_periodic_checkin); } else { cpu_data->gcid = gcid; - evcnt_inc(&llsync_data.ev_periodic_checkin); + syscnt_inc(&llsync_data.sc_periodic_checkin); llsync_commit_checkpoint(cpu_id()); } } diff --git a/kern/llsync_i.h b/kern/llsync_i.h index 4297230..10dec94 100644 --- a/kern/llsync_i.h +++ b/kern/llsync_i.h @@ -20,10 +20,10 @@ #include <kern/assert.h> #include <kern/cpumap.h> -#include <kern/evcnt.h> #include <kern/macros.h> #include <kern/param.h> #include <kern/spinlock.h> +#include <kern/syscnt.h> #include <kern/work.h> #include <machine/cpu.h> @@ -45,9 +45,9 @@ struct llsync_data { int no_warning; struct work_queue queue0; struct work_queue queue1; - struct evcnt ev_global_checkpoint; - struct evcnt ev_periodic_checkin; - struct evcnt ev_failed_periodic_checkin; + struct syscnt sc_global_checkpoint; + struct syscnt sc_periodic_checkin; + struct syscnt sc_failed_periodic_checkin; /* * Global checkpoint ID. diff --git a/kern/macros.h b/kern/macros.h index a5b7b03..f3eb107 100644 --- a/kern/macros.h +++ b/kern/macros.h @@ -55,6 +55,9 @@ #define structof(ptr, type, member) \ ((type *)((char *)(ptr) - offsetof(type, member))) +#define read_once(x) (*(volatile typeof(x) *)&(x)) +#define write_once(x, v) (read_once(x) = (v)) + #define alignof(x) __alignof__(x) #define likely(expr) __builtin_expect(!!(expr), 1) diff --git a/kern/sref.c b/kern/sref.c index 3172bbe..59d07da 100644 --- a/kern/sref.c +++ b/kern/sref.c @@ -48,7 +48,6 @@ #include <kern/condition.h> #include <kern/cpumap.h> #include <kern/error.h> -#include <kern/evcnt.h> #include <kern/init.h> #include <kern/macros.h> #include <kern/mutex.h> @@ -59,6 +58,7 @@ #include <kern/sprintf.h> #include <kern/sref.h> #include <kern/sref_i.h> +#include <kern/syscnt.h> #include <kern/thread.h> #include <machine/cpu.h> @@ -104,10 +104,10 @@ struct sref_data { unsigned int nr_pending_flushes; struct sref_queue queue0; struct sref_queue queue1; - struct evcnt ev_epoch; - struct evcnt ev_dirty_zero; - struct evcnt ev_revive; - struct evcnt ev_true_zero; + struct syscnt sc_epoch; + struct syscnt sc_dirty_zero; + struct syscnt sc_revive; + struct syscnt sc_true_zero; int no_warning; }; @@ -159,8 +159,8 @@ struct sref_delta { struct sref_cache { struct mutex lock; struct sref_delta deltas[SREF_MAX_DELTAS]; - struct evcnt ev_collision; - struct evcnt ev_flush; + struct syscnt sc_collision; + struct syscnt sc_flush; struct thread *manager; int registered; int dirty; @@ -514,7 +514,7 @@ sref_end_epoch(struct sref_queue *queue) sref_queue_transfer(queue, &sref_data.queue1); sref_queue_transfer(&sref_data.queue1, &sref_data.queue0); sref_queue_init(&sref_data.queue0); - evcnt_inc(&sref_data.ev_epoch); + syscnt_inc(&sref_data.sc_epoch); sref_reset_pending_flushes(); } @@ -528,7 +528,7 @@ sref_cache_delta(struct sref_cache *cache, unsigned long i) static void __init sref_cache_init(struct sref_cache *cache, unsigned int cpu) { - char name[EVCNT_NAME_SIZE]; + char name[SYSCNT_NAME_SIZE]; struct sref_delta *delta; unsigned long i; @@ -540,9 +540,9 @@ sref_cache_init(struct sref_cache *cache, unsigned int cpu) } snprintf(name, sizeof(name), "sref_collision/%u", cpu); - evcnt_register(&cache->ev_collision, name); + syscnt_register(&cache->sc_collision, name); snprintf(name, sizeof(name), "sref_flush/%u", cpu); - evcnt_register(&cache->ev_flush, name); + syscnt_register(&cache->sc_flush, name); cache->manager = NULL; cache->registered = 0; cache->dirty = 0; @@ -621,7 +621,7 @@ sref_cache_get_delta(struct sref_cache *cache, struct sref_counter *counter) } else if (sref_delta_counter(delta) != counter) { sref_delta_flush(delta); sref_delta_set_counter(delta, counter); - evcnt_inc(&cache->ev_collision); + syscnt_inc(&cache->sc_collision); } return delta; @@ -667,7 +667,7 @@ sref_cache_flush(struct sref_cache *cache, struct sref_queue *queue) spinlock_unlock(&sref_data.lock); sref_cache_clear_dirty(cache); - evcnt_inc(&cache->ev_flush); + syscnt_inc(&cache->sc_flush); mutex_unlock(&cache->lock); } @@ -720,7 +720,7 @@ sref_noref(struct work *work) static void sref_review(struct sref_queue *queue) { - unsigned long nr_dirty, nr_revive, nr_true; + int64_t nr_dirty, nr_revive, nr_true; struct sref_counter *counter; struct work_queue works; bool requeue; @@ -782,9 +782,9 @@ sref_review(struct sref_queue *queue) if ((nr_dirty + nr_revive + nr_true) != 0) { spinlock_lock(&sref_data.lock); - evcnt_add(&sref_data.ev_dirty_zero, nr_dirty); - evcnt_add(&sref_data.ev_revive, nr_revive); - evcnt_add(&sref_data.ev_true_zero, nr_true); + syscnt_add(&sref_data.sc_dirty_zero, nr_dirty); + syscnt_add(&sref_data.sc_revive, nr_revive); + syscnt_add(&sref_data.sc_true_zero, nr_true); spinlock_unlock(&sref_data.lock); } } @@ -822,10 +822,10 @@ sref_bootstrap(void) spinlock_init(&sref_data.lock); sref_queue_init(&sref_data.queue0); sref_queue_init(&sref_data.queue1); - evcnt_register(&sref_data.ev_epoch, "sref_epoch"); - evcnt_register(&sref_data.ev_dirty_zero, "sref_dirty_zero"); - evcnt_register(&sref_data.ev_revive, "sref_revive"); - evcnt_register(&sref_data.ev_true_zero, "sref_true_zero"); + syscnt_register(&sref_data.sc_epoch, "sref_epoch"); + syscnt_register(&sref_data.sc_dirty_zero, "sref_dirty_zero"); + syscnt_register(&sref_data.sc_revive, "sref_revive"); + syscnt_register(&sref_data.sc_true_zero, "sref_true_zero"); sref_cache_init(sref_cache_get(), 0); } diff --git a/kern/syscnt.c b/kern/syscnt.c new file mode 100644 index 0000000..907f226 --- /dev/null +++ b/kern/syscnt.c @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2014-2017 Richard Braun. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <string.h> + +#include <kern/init.h> +#include <kern/list.h> +#include <kern/mutex.h> +#include <kern/printk.h> +#include <kern/spinlock.h> +#include <kern/syscnt.h> + +/* + * Global list of all registered counters. + */ +static struct list syscnt_list; +static struct mutex syscnt_lock; + +void __init +syscnt_setup(void) +{ + list_init(&syscnt_list); + mutex_init(&syscnt_lock); +} + +void __init +syscnt_register(struct syscnt *syscnt, const char *name) +{ +#ifndef __LP64__ + spinlock_init(&syscnt->lock); +#endif /* __LP64__ */ + syscnt->value = 0; + strlcpy(syscnt->name, name, sizeof(syscnt->name)); + + mutex_lock(&syscnt_lock); + list_insert_tail(&syscnt_list, &syscnt->node); + mutex_unlock(&syscnt_lock); +} + +void +syscnt_info(const char *prefix) +{ + struct syscnt *syscnt; + size_t length, prefix_length; + uint64_t value; + + prefix_length = (prefix == NULL) ? 0 : strlen(prefix); + + printk("syscnt: name count\n"); + + mutex_lock(&syscnt_lock); + + list_for_each_entry(&syscnt_list, syscnt, node) { + if (prefix_length != 0) { + length = strlen(syscnt->name); + + if ((length < prefix_length) + || (memcmp(syscnt->name, prefix, prefix_length) != 0)) { + continue; + } + } + + value = syscnt_read(syscnt); + + printk("syscnt: %-30s %17llu\n", syscnt->name, + (unsigned long long)value); + } + + mutex_unlock(&syscnt_lock); +} diff --git a/kern/syscnt.h b/kern/syscnt.h new file mode 100644 index 0000000..ff9cedb --- /dev/null +++ b/kern/syscnt.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2014-2017 Richard Braun. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * + * System counters. + * + * This module provides 64-bits general-purpose counters that can be + * accessed and modified atomically from any context. + */ + +#ifndef _KERN_SYSCNT_H +#define _KERN_SYSCNT_H + +#include <stdint.h> + +#include <kern/macros.h> +#include <kern/spinlock.h> +#include <machine/atomic.h> + +/* + * Size of the buffer storing a system counter name. + */ +#define SYSCNT_NAME_SIZE 32 + +#include <kern/syscnt_types.h> + +/* + * System counter. + */ +struct syscnt; + +/* + * Initialize the syscnt module. + * + * This module is initialized by architecture-specific code. It is normally + * safe to call this function very early at boot time. + */ +void syscnt_setup(void); + +/* + * Initialize and register the given counter. + * + * The counter is set to 0. + */ +void syscnt_register(struct syscnt *syscnt, const char *name); + +#ifdef __LP64__ + +static inline void +syscnt_add(struct syscnt *syscnt, int64_t delta) +{ + atomic_add_ulong(&syscnt->value, delta); +} + +static inline uint64_t +syscnt_read(const struct syscnt *syscnt) +{ + return read_once(syscnt->value); +} + +#else /* __LP64__ */ + +static inline void +syscnt_add(struct syscnt *syscnt, int64_t delta) +{ + unsigned long flags; + + spinlock_lock_intr_save(&syscnt->lock, &flags); + syscnt->value += delta; + spinlock_unlock_intr_restore(&syscnt->lock, flags); +} + +static inline uint64_t +syscnt_read(const struct syscnt *syscnt) +{ + unsigned long flags; + uint64_t value; + + spinlock_lock_intr_save(&syscnt->lock, &flags); + value = syscnt->value; + spinlock_unlock_intr_restore(&syscnt->lock, flags); + + return value; +} + +#endif /* __LP64__ */ + +static inline void +syscnt_inc(struct syscnt *syscnt) +{ + syscnt_add(syscnt, 1); +} + +static inline void +syscnt_dec(struct syscnt *syscnt) +{ + syscnt_add(syscnt, -1); +} + +/* + * Display system counters. + * + * A prefix can be used to filter the output, where only counters with the + * given prefix are displayed. If NULL, all counters are reported. + */ +void syscnt_info(const char *prefix); + +#endif /* _KERN_SYSCNT_H */ diff --git a/kern/syscnt_types.h b/kern/syscnt_types.h new file mode 100644 index 0000000..5b429b7 --- /dev/null +++ b/kern/syscnt_types.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2017 Richard Braun. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * + * Isolated type definition used to avoid inclusion circular dependencies. + */ + +#ifndef _KERN_SYSCNT_TYPES_H +#define _KERN_SYSCNT_TYPES_H + +#include <stdint.h> + +#include <kern/list_types.h> +#include <kern/spinlock_types.h> + +/* + * Use atomic access on 64-bits systems, spinlock based critical sections + * on 32-bits ones. + */ +struct syscnt { +#ifndef __LP64__ + struct spinlock lock; +#endif /* __LP64__ */ + + uint64_t value; + struct list node; + char name[SYSCNT_NAME_SIZE]; +}; + +#endif /* _KERN_SYSCNT_TYPES_H */ diff --git a/kern/thread.c b/kern/thread.c index 59669a3..28d0176 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -89,7 +89,6 @@ #include <kern/condition.h> #include <kern/cpumap.h> #include <kern/error.h> -#include <kern/evcnt.h> #include <kern/init.h> #include <kern/kmem.h> #include <kern/list.h> @@ -103,6 +102,7 @@ #include <kern/spinlock.h> #include <kern/sprintf.h> #include <kern/sref.h> +#include <kern/syscnt.h> #include <kern/task.h> #include <kern/thread.h> #include <kern/turnstile.h> @@ -254,8 +254,8 @@ struct thread_runq { /* Ticks before the next balancing attempt when a run queue is idle */ unsigned int idle_balance_ticks; - struct evcnt ev_schedule_intr; - struct evcnt ev_tick_intr; + struct syscnt sc_schedule_intr; + struct syscnt sc_tick_intr; } __aligned(CPU_L1_SIZE); /* @@ -439,7 +439,7 @@ static void __init thread_runq_init(struct thread_runq *runq, unsigned int cpu, struct thread *booter) { - char name[EVCNT_NAME_SIZE]; + char name[SYSCNT_NAME_SIZE]; spinlock_init(&runq->lock); runq->cpu = cpu; @@ -451,9 +451,9 @@ thread_runq_init(struct thread_runq *runq, unsigned int cpu, runq->idler = NULL; runq->idle_balance_ticks = (unsigned int)-1; snprintf(name, sizeof(name), "thread_schedule_intr/%u", cpu); - evcnt_register(&runq->ev_schedule_intr, name); + syscnt_register(&runq->sc_schedule_intr, name); snprintf(name, sizeof(name), "thread_tick_intr/%u", cpu); - evcnt_register(&runq->ev_tick_intr, name); + syscnt_register(&runq->sc_tick_intr, name); } static inline struct thread_runq * @@ -2411,7 +2411,7 @@ thread_schedule_intr(void) assert(!thread_preempt_enabled()); runq = thread_runq_local(); - evcnt_inc(&runq->ev_schedule_intr); + syscnt_inc(&runq->sc_schedule_intr); } void @@ -2425,7 +2425,7 @@ thread_tick_intr(void) assert(!thread_preempt_enabled()); runq = thread_runq_local(); - evcnt_inc(&runq->ev_tick_intr); + syscnt_inc(&runq->sc_tick_intr); llsync_report_periodic_event(); sref_report_periodic_event(); work_report_periodic_event(); diff --git a/kern/work.c b/kern/work.c index f8e8e34..c55d85d 100644 --- a/kern/work.c +++ b/kern/work.c @@ -20,7 +20,6 @@ #include <kern/assert.h> #include <kern/bitmap.h> #include <kern/error.h> -#include <kern/evcnt.h> #include <kern/kmem.h> #include <kern/list.h> #include <kern/macros.h> @@ -30,6 +29,7 @@ #include <kern/printk.h> #include <kern/spinlock.h> #include <kern/sprintf.h> +#include <kern/syscnt.h> #include <kern/thread.h> #include <kern/work.h> #include <machine/cpu.h> @@ -90,7 +90,7 @@ struct work_pool { struct work_queue queue0; struct work_queue queue1; struct work_thread *manager; - struct evcnt ev_transfer; + struct syscnt sc_transfer; unsigned int cpu; unsigned int max_threads; unsigned int nr_threads; @@ -159,7 +159,7 @@ work_pool_compute_max_threads(unsigned int nr_cpus) static void work_pool_init(struct work_pool *pool, unsigned int cpu, int flags) { - char name[EVCNT_NAME_SIZE]; + char name[SYSCNT_NAME_SIZE]; const char *suffix; unsigned int id, nr_cpus, max_threads; int error; @@ -173,7 +173,7 @@ work_pool_init(struct work_pool *pool, unsigned int cpu, int flags) nr_cpus = 1; suffix = (flags & WORK_PF_HIGHPRIO) ? "h" : ""; snprintf(name, sizeof(name), "work_transfer/%u%s", cpu, suffix); - evcnt_register(&pool->ev_transfer, name); + syscnt_register(&pool->sc_transfer, name); pool->cpu = cpu; } @@ -274,7 +274,7 @@ work_pool_shift_queues(struct work_pool *pool, struct work_queue *old_queue) work_queue_init(&pool->queue0); if (work_queue_nr_works(old_queue) != 0) { - evcnt_inc(&pool->ev_transfer); + syscnt_inc(&pool->sc_transfer); } } |