timerfd timing interface
More...
Go to the source code of this file.
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Timerfd Timing Interface" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_TIMING, } |
|
static struct ast_module_info * | ast_module_info = &__mod_info |
|
static struct ao2_container * | timerfd_timers |
|
static struct ast_timing_interface | timerfd_timing |
|
static void * | timing_funcs_handle |
|
#define TIMERFD_MAX_RATE 1000 |
#define TIMERFD_TIMER_BUCKETS 563 |
static void __reg_module |
( |
void |
| ) |
|
|
static |
static void __unreg_module |
( |
void |
| ) |
|
|
static |
static int load_module |
( |
void |
| ) |
|
|
static |
Definition at line 336 of file res_timing_timerfd.c.
References ao2_container_alloc, ao2_ref, ast_log(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_register_timing_interface, LOG_ERROR, TIMERFD_TIMER_BUCKETS, timerfd_timer_cmp(), timerfd_timer_hash(), and timing_funcs_handle.
341 if ((fd = timerfd_create(CLOCK_MONOTONIC, 0)) < 0) {
342 ast_log(
LOG_ERROR,
"timerfd_create() not supported by the kernel. Not loading.\n");
static int timerfd_timer_hash(const void *obj, const int flags)
static void * timing_funcs_handle
static struct ast_timing_interface timerfd_timing
static struct ao2_container * timerfd_timers
#define ao2_ref(o, delta)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static int timerfd_timer_cmp(void *obj, void *args, int flags)
#define TIMERFD_TIMER_BUCKETS
#define ao2_container_alloc(arg1, arg2, arg3)
#define ast_register_timing_interface(i)
Register a set of timing functions.
static void timer_destroy |
( |
void * |
obj | ) |
|
|
static |
static int timerfd_timer_ack |
( |
int |
handle, |
|
|
unsigned int |
quantity |
|
) |
| |
|
static |
Definition at line 172 of file res_timing_timerfd.c.
References ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_debug, ast_log(), errno, timerfd_timer::handle, LOG_ERROR, and OBJ_POINTER.
174 uint64_t expirations;
194 struct itimerspec timer_status;
196 if (timerfd_gettime(handle, &timer_status)) {
197 ast_log(
LOG_ERROR,
"Call to timerfd_gettime() using handle %d error: %s\n", handle, strerror(
errno));
203 if (timer_status.it_value.tv_sec == 0 && timer_status.it_value.tv_nsec == 0) {
204 ast_debug(1,
"Avoiding read on disarmed timerfd %d\n", handle);
209 read_result = read(handle, &expirations,
sizeof(expirations));
210 if (read_result == -1) {
219 }
while (read_result !=
sizeof(expirations));
224 if (expirations != quantity) {
225 ast_debug(2,
"Expected to acknowledge %u ticks but got %llu instead\n", quantity, (
unsigned long long) expirations);
#define ast_debug(level,...)
Log a DEBUG message.
static struct ao2_container * timerfd_timers
#define ao2_ref(o, delta)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define ao2_find(arg1, arg2, arg3)
static void timerfd_timer_close |
( |
int |
handle | ) |
|
|
static |
Definition at line 119 of file res_timing_timerfd.c.
References ao2_find, ao2_ref, ao2_unlink, ast_log(), timerfd_timer::handle, LOG_ERROR, and OBJ_POINTER.
static struct ao2_container * timerfd_timers
#define ao2_ref(o, delta)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define ao2_find(arg1, arg2, arg3)
#define ao2_unlink(arg1, arg2)
static int timerfd_timer_cmp |
( |
void * |
obj, |
|
|
void * |
args, |
|
|
int |
flags |
|
) |
| |
|
static |
static int timerfd_timer_disable_continuous |
( |
int |
handle | ) |
|
|
static |
Definition at line 267 of file res_timing_timerfd.c.
References ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_log(), timerfd_timer::handle, timerfd_timer::is_continuous, LOG_ERROR, OBJ_POINTER, and timerfd_timer::saved_timer.
static struct ao2_container * timerfd_timers
unsigned int is_continuous
struct itimerspec saved_timer
#define ao2_ref(o, delta)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define ao2_find(arg1, arg2, arg3)
static int timerfd_timer_enable_continuous |
( |
int |
handle | ) |
|
|
static |
Definition at line 230 of file res_timing_timerfd.c.
References ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_log(), timerfd_timer::handle, timerfd_timer::is_continuous, LOG_ERROR, OBJ_POINTER, and timerfd_timer::saved_timer.
233 struct itimerspec continuous_timer = {
234 .it_value.tv_nsec = 1L,
static struct ao2_container * timerfd_timers
unsigned int is_continuous
struct itimerspec saved_timer
#define ao2_ref(o, delta)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define ao2_find(arg1, arg2, arg3)
Definition at line 302 of file res_timing_timerfd.c.
References ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_log(), AST_TIMING_EVENT_CONTINUOUS, AST_TIMING_EVENT_EXPIRED, timerfd_timer::handle, timerfd_timer::is_continuous, LOG_ERROR, and OBJ_POINTER.
static struct ao2_container * timerfd_timers
unsigned int is_continuous
#define ao2_ref(o, delta)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define ao2_find(arg1, arg2, arg3)
static unsigned int timerfd_timer_get_max_rate |
( |
int |
handle | ) |
|
|
static |
static int timerfd_timer_hash |
( |
const void * |
obj, |
|
|
const int |
flags |
|
) |
| |
|
static |
static int timerfd_timer_open |
( |
void |
| ) |
|
|
static |
Definition at line 97 of file res_timing_timerfd.c.
References ao2_alloc, ao2_link, ao2_ref, ast_log(), errno, timerfd_timer::handle, LOG_ERROR, timer, and timer_destroy().
103 ast_log(
LOG_ERROR,
"Could not allocate memory for timerfd_timer structure\n");
106 if ((handle = timerfd_create(CLOCK_MONOTONIC, 0)) < 0) {
#define ao2_link(arg1, arg2)
static struct ao2_container * timerfd_timers
#define ao2_ref(o, delta)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define ao2_alloc(data_size, destructor_fn)
static void timer_destroy(void *obj)
static struct ast_timer * timer
static int timerfd_timer_set_rate |
( |
int |
handle, |
|
|
unsigned int |
rate |
|
) |
| |
|
static |
Definition at line 139 of file res_timing_timerfd.c.
References ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_log(), timerfd_timer::handle, timerfd_timer::is_continuous, LOG_ERROR, OBJ_POINTER, and timerfd_timer::saved_timer.
158 our_timer->
saved_timer.it_value.tv_nsec = rate ? (long) (1000000000 / rate) : 0L;
static struct ao2_container * timerfd_timers
unsigned int is_continuous
struct itimerspec saved_timer
#define ao2_ref(o, delta)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define ao2_find(arg1, arg2, arg3)
static int unload_module |
( |
void |
| ) |
|
|
static |
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Timerfd Timing Interface" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_TIMING, } |
|
static |
void* timing_funcs_handle |
|
static |