Motr
M0
|
#include "ut/ut.h"
#include "lib/time.h"
#include "lib/timer.h"
#include "lib/assert.h"
#include "lib/thread.h"
#include "lib/semaphore.h"
#include "lib/memory.h"
#include "lib/atomic.h"
#include "lib/ub.h"
#include "lib/trace.h"
#include <stdlib.h>
#include <unistd.h>
#include <sys/syscall.h>
Go to the source code of this file.
Data Structures | |
struct | tg_worker |
struct | tg_timer |
struct | thread_group |
Macros | |
#define | TIMER_UB(name, init, round, fini) |
#define | TIMER_UB2(name, init, round, fini) |
Enumerations | |
enum | { NR_TIMERS = 8, NR_TG = 8, NR_THREADS_TG = 8, NR_TIMERS_TG = 50 } |
enum | { UB_TIMER_NR = 0x1 } |
Functions | |
static pid_t | _gettid () |
static m0_time_t | make_time (int ms) |
static m0_time_t | make_time_abs (int ms) |
static int | time_rand_ms (int min_ms, int max_ms) |
static void | sem_init_zero (struct m0_semaphore *sem) |
static unsigned long | timer_callback (unsigned long data) |
static void | test_timers (enum m0_timer_type timer_type, int nr_timers, int interval_min_ms, int interval_max_ms, int wait_time_ms, int callbacks_min, int callbacks_max) |
static unsigned long | locality_default_callback (unsigned long data) |
static void | timer_locality_default_test () |
static unsigned long | locality_test_callback (unsigned long data) |
static void | timer_locality_test (int nr_timers, int interval_min_ms, int interval_max_ms) |
static unsigned long | test_timer_callback_mt (unsigned long data) |
static void | test_timer_worker_mt (struct tg_worker *worker) |
static void | test_timer_controller_mt (struct thread_group *tg) |
static void | test_timer_many_timers_mt () |
void | test_timer (void) |
unsigned long | timer_ub_callback_dummy (unsigned long unused) |
static int | timers_ub_init (const char *opts) |
static void | timers_ub_fini (void) |
static void | timer_ub__init (int index) |
static void | timer_ub__fini (int index) |
static void | timer_ub__start (int index) |
static void | timer_ub__stop (int index) |
static void | timer_ub_for_each (void(*func)(int index)) |
static void | timer_ub_init_dummy (void) |
static void | timer_ub_soft_init_dummy (void) |
static void | timer_ub_hard_init_dummy (void) |
static void | timer_ub_soft_init_all (void) |
static void | timer_ub_hard_init_all (void) |
static void | timer_ub_soft_init_start_all (void) |
static void | timer_ub_hard_init_start_all (void) |
static void | timer_ub_fini_dummy (void) |
static void | timer_ub_fini_all (void) |
static void | timer_ub_stop_fini_all (void) |
static void | timer_ub_start_stop (int index) |
static void | timer_ub_init_start_stop (int index) |
static void | timer_ub_init_start_stop_fini (int index) |
unsigned long | timer_ub_callback (unsigned long index) |
static void | timer_ub__init_cb (int index) |
static void | timer_ub__fini_cb (int index) |
static void | timer_ub_init_cb_dummy (void) |
static void | timer_ub_soft_init_cb_all (void) |
static void | timer_ub_hard_init_cb_all (void) |
static void | timer_ub_soft_init_start_cb_all (void) |
static void | timer_ub_hard_init_start_cb_all (void) |
static void | timer_ub_start_callback (int index) |
static void | timer_ub_fini_cb_all (void) |
static void | timer_ub_stop_fini_cb_all (void) |
static void | timer_ub_callback_stop (int index) |
static void | timer_ub_init_start_callback_stop_fini (int index) |
Variables | |
static pid_t | loc_default_tid |
static struct m0_semaphore | loc_default_lock |
static pid_t | test_locality_tid |
static struct m0_semaphore * | test_locality_lock |
static struct m0_atomic64 | callbacks_executed |
static struct m0_timer | timer_ub_timers [UB_TIMER_NR] |
static struct m0_semaphore | timer_ub_semaphores [UB_TIMER_NR] |
static enum m0_timer_type | timer_ub_type |
static m0_time_t | timer_ub_expiration |
static m0_timer_callback_t | timer_ub_cb |
struct m0_ub_set | m0_timer_ub |
anonymous enum |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
void test_timer | ( | void | ) |
|
static |
|
static |
|
static |
this (main) thread controller threads worker threads start all controllers wait for controllers init init workers wait for all workers barrier with workers barrier with controller sync with main wait for all controllers barrier with all controllers barrier with main init all timers run all timers fini() all timers barrier with workers barrier with controller detach from locality exit from thread wait for workers termination barrier with all controllers barrier with main exit from thread wait for controllers termination
Definition at line 422 of file timer.c.
|
static |
|
static |
Test timers.
timer_type | timer type |
nr_timers | number of timers in this test |
interval_min_ms | minimum value for timer interval |
interval_max_ms | maximum value for timer interval for every timer it will be chosen with rand() in range [interval_min_ms, interval_max_ms] |
wait_time_ms | function will wait this time and then m0_time_stop() for all timers |
callbacks_min |
callbacks_max | number of executed callbacks should be in the interval [callbacks_min, callbacks_max] (this is checked with M0_UT_ASSERT()) |
Definition at line 129 of file timer.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
unsigned long timer_ub_callback | ( | unsigned long | index | ) |
unsigned long timer_ub_callback_dummy | ( | unsigned long | unused | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
struct m0_ub_set m0_timer_ub |
|
static |
|
static |
|
static |
|
static |
|
static |