xref: /unit/src/test/nxt_tests.h (revision 384)
1*384Szelenkov@nginx.com 
2*384Szelenkov@nginx.com /*
3*384Szelenkov@nginx.com  * Copyright (C) Igor Sysoev
4*384Szelenkov@nginx.com  * Copyright (C) NGINX, Inc.
5*384Szelenkov@nginx.com  */
6*384Szelenkov@nginx.com 
7*384Szelenkov@nginx.com #ifndef _NXT_TESTS_H_INCLUDED_
8*384Szelenkov@nginx.com #define _NXT_TESTS_H_INCLUDED_
9*384Szelenkov@nginx.com 
10*384Szelenkov@nginx.com 
11*384Szelenkov@nginx.com typedef nxt_bool_t (*nxt_msec_less_t)(nxt_msec_t first, nxt_msec_t second);
12*384Szelenkov@nginx.com 
13*384Szelenkov@nginx.com 
14*384Szelenkov@nginx.com #define NXT_RBT_NODES  1500
15*384Szelenkov@nginx.com 
16*384Szelenkov@nginx.com 
17*384Szelenkov@nginx.com #if (__i386__ || __i386 || __amd64__ || __amd64)
18*384Szelenkov@nginx.com #if (NXT_GCC || NXT_CLANG)
19*384Szelenkov@nginx.com 
20*384Szelenkov@nginx.com #define NXT_TEST_RTDTSC  1
21*384Szelenkov@nginx.com 
22*384Szelenkov@nginx.com nxt_inline uint64_t
23*384Szelenkov@nginx.com nxt_rdtsc(void)
24*384Szelenkov@nginx.com {
25*384Szelenkov@nginx.com     uint32_t  eax, edx;
26*384Szelenkov@nginx.com 
27*384Szelenkov@nginx.com     __asm__ volatile ("rdtsc" : "=a" (eax), "=d" (edx));
28*384Szelenkov@nginx.com 
29*384Szelenkov@nginx.com     return ((uint64_t) edx << 32) | eax;
30*384Szelenkov@nginx.com }
31*384Szelenkov@nginx.com 
32*384Szelenkov@nginx.com #endif
33*384Szelenkov@nginx.com #endif
34*384Szelenkov@nginx.com 
35*384Szelenkov@nginx.com 
36*384Szelenkov@nginx.com nxt_int_t nxt_term_parse_test(nxt_thread_t *thr);
37*384Szelenkov@nginx.com nxt_int_t nxt_msec_diff_test(nxt_thread_t *thr, nxt_msec_less_t);
38*384Szelenkov@nginx.com 
39*384Szelenkov@nginx.com nxt_int_t nxt_rbtree_test(nxt_thread_t *thr, nxt_uint_t n);
40*384Szelenkov@nginx.com nxt_int_t nxt_rbtree1_test(nxt_thread_t *thr, nxt_uint_t n);
41*384Szelenkov@nginx.com 
42*384Szelenkov@nginx.com #if (NXT_TEST_RTDTSC)
43*384Szelenkov@nginx.com 
44*384Szelenkov@nginx.com nxt_int_t nxt_rbtree_mb_start(nxt_thread_t *thr);
45*384Szelenkov@nginx.com void nxt_rbtree_mb_insert(nxt_thread_t *thr);
46*384Szelenkov@nginx.com void nxt_rbtree_mb_delete(nxt_thread_t *thr);
47*384Szelenkov@nginx.com 
48*384Szelenkov@nginx.com nxt_int_t nxt_rbtree1_mb_start(nxt_thread_t *thr);
49*384Szelenkov@nginx.com void nxt_rbtree1_mb_insert(nxt_thread_t *thr);
50*384Szelenkov@nginx.com void nxt_rbtree1_mb_delete(nxt_thread_t *thr);
51*384Szelenkov@nginx.com 
52*384Szelenkov@nginx.com #endif
53*384Szelenkov@nginx.com 
54*384Szelenkov@nginx.com nxt_int_t nxt_mp_test(nxt_thread_t *thr, nxt_uint_t runs, nxt_uint_t nblocks,
55*384Szelenkov@nginx.com     size_t max_size);
56*384Szelenkov@nginx.com nxt_int_t nxt_mem_zone_test(nxt_thread_t *thr, nxt_uint_t runs,
57*384Szelenkov@nginx.com     nxt_uint_t nblocks, size_t max_size);
58*384Szelenkov@nginx.com nxt_int_t nxt_lvlhsh_test(nxt_thread_t *thr, nxt_uint_t n,
59*384Szelenkov@nginx.com     nxt_bool_t use_pool);
60*384Szelenkov@nginx.com 
61*384Szelenkov@nginx.com nxt_int_t nxt_gmtime_test(nxt_thread_t *thr);
62*384Szelenkov@nginx.com nxt_int_t nxt_sprintf_test(nxt_thread_t *thr);
63*384Szelenkov@nginx.com nxt_int_t nxt_malloc_test(nxt_thread_t *thr);
64*384Szelenkov@nginx.com nxt_int_t nxt_utf8_test(nxt_thread_t *thr);
65*384Szelenkov@nginx.com nxt_int_t nxt_http_parse_test(nxt_thread_t *thr);
66*384Szelenkov@nginx.com nxt_int_t nxt_strverscmp_test(nxt_thread_t *thr);
67*384Szelenkov@nginx.com 
68*384Szelenkov@nginx.com 
69*384Szelenkov@nginx.com #endif /* _NXT_TESTS_H_INCLUDED_ */
70