Motr  M0
time.c File Reference
#include "lib/time.h"
#include "lib/arith.h"
#include "lib/assert.h"
#include "lib/atomic.h"
#include "lib/semaphore.h"
#include "lib/thread.h"
#include "lib/trace.h"
#include "lib/ub.h"
#include "ut/ut.h"
Include dependency graph for time.c:

Go to the source code of this file.

Data Structures

struct  time_test
 
struct  time_test_thread
 

Enumerations

enum  { THREADS_NR_MAX = 32, TIME_VALUES_NR = 0x10000, DIFF_ACCEPTED = 2000000 }
 
enum  { UB_TIME_ITER = 0x1000000 }
 

Functions

static void time_test_simple (void)
 
static void time_thread (int thread_index)
 
static m0_time_t tv (int index)
 
static m0_time_t tv_prev (int index)
 
static void time_test_check (int64_t a, int64_t b, int64_t c)
 
static void time_test_mt_nr (int threads_nr)
 
void m0_ut_time_test (void)
 
static void ub_time_round (int unused)
 

Variables

static struct time_test time_values [TIME_VALUES_NR]
 
static struct time_test_thread time_threads [THREADS_NR_MAX]
 
static struct m0_atomic64 time_index
 
static unsigned long err_nr
 
static m0_time_t err_max
 
struct m0_ub_set m0_time_ub
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
THREADS_NR_MAX 
TIME_VALUES_NR 
DIFF_ACCEPTED 

2ms accepted difference between m0_time_now() on different cores

Definition at line 35 of file time.c.

◆ anonymous enum

anonymous enum
Enumerator
UB_TIME_ITER 

Definition at line 237 of file time.c.

Function Documentation

◆ m0_ut_time_test()

void m0_ut_time_test ( void  )

Definition at line 228 of file time.c.

Here is the call graph for this function:

◆ time_test_check()

static void time_test_check ( int64_t  a,
int64_t  b,
int64_t  c 
)
static

Definition at line 150 of file time.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_test_mt_nr()

static void time_test_mt_nr ( int  threads_nr)
static

Definition at line 169 of file time.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_test_simple()

static void time_test_simple ( void  )
static

Definition at line 59 of file time.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_thread()

static void time_thread ( int  thread_index)
static

Definition at line 109 of file time.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tv()

static m0_time_t tv ( int  index)
static

Definition at line 129 of file time.c.

Here is the caller graph for this function:

◆ tv_prev()

static m0_time_t tv_prev ( int  index)
static

Definition at line 135 of file time.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ub_time_round()

static void ub_time_round ( int  unused)
static

Definition at line 239 of file time.c.

Here is the call graph for this function:

Variable Documentation

◆ err_max

m0_time_t err_max
static

Maximum out-of-sync error

Definition at line 57 of file time.c.

◆ err_nr

unsigned long err_nr
static

Number of out-of-sync errors

Definition at line 56 of file time.c.

◆ m0_time_ub

struct m0_ub_set m0_time_ub
Initial value:
= {
.us_name = "time-ub",
.us_init = NULL,
.us_fini = NULL,
.us_run = {
{ .ub_name = "now",
.ub_iter = UB_TIME_ITER,
.ub_round = ub_time_round },
{ .ub_name = NULL }
}
}
#define NULL
Definition: misc.h:38
static void ub_time_round(int unused)
Definition: time.c:239

Definition at line 244 of file time.c.

◆ time_index

struct m0_atomic64 time_index
static

Definition at line 55 of file time.c.

◆ time_threads

struct time_test_thread time_threads[THREADS_NR_MAX]
static

Definition at line 54 of file time.c.

◆ time_values

struct time_test time_values[TIME_VALUES_NR]
static

Definition at line 53 of file time.c.