xref: /unit/src/test/nxt_tests.h (revision 1975)
1384Szelenkov@nginx.com 
2384Szelenkov@nginx.com /*
3384Szelenkov@nginx.com  * Copyright (C) Igor Sysoev
4384Szelenkov@nginx.com  * Copyright (C) NGINX, Inc.
5384Szelenkov@nginx.com  */
6384Szelenkov@nginx.com 
7384Szelenkov@nginx.com #ifndef _NXT_TESTS_H_INCLUDED_
8384Szelenkov@nginx.com #define _NXT_TESTS_H_INCLUDED_
9384Szelenkov@nginx.com 
10384Szelenkov@nginx.com 
11384Szelenkov@nginx.com typedef nxt_bool_t (*nxt_msec_less_t)(nxt_msec_t first, nxt_msec_t second);
12384Szelenkov@nginx.com 
13384Szelenkov@nginx.com 
14384Szelenkov@nginx.com #define NXT_RBT_NODES  1500
15384Szelenkov@nginx.com 
16384Szelenkov@nginx.com 
17384Szelenkov@nginx.com #if (__i386__ || __i386 || __amd64__ || __amd64)
18384Szelenkov@nginx.com #if (NXT_GCC || NXT_CLANG)
19384Szelenkov@nginx.com 
20384Szelenkov@nginx.com #define NXT_TEST_RTDTSC  1
21384Szelenkov@nginx.com 
22384Szelenkov@nginx.com nxt_inline uint64_t
23384Szelenkov@nginx.com nxt_rdtsc(void)
24384Szelenkov@nginx.com {
25384Szelenkov@nginx.com     uint32_t  eax, edx;
26384Szelenkov@nginx.com 
27384Szelenkov@nginx.com     __asm__ volatile ("rdtsc" : "=a" (eax), "=d" (edx));
28384Szelenkov@nginx.com 
29384Szelenkov@nginx.com     return ((uint64_t) edx << 32) | eax;
30384Szelenkov@nginx.com }
31384Szelenkov@nginx.com 
32384Szelenkov@nginx.com #endif
33384Szelenkov@nginx.com #endif
34384Szelenkov@nginx.com 
35384Szelenkov@nginx.com 
36384Szelenkov@nginx.com nxt_int_t nxt_term_parse_test(nxt_thread_t *thr);
37384Szelenkov@nginx.com nxt_int_t nxt_msec_diff_test(nxt_thread_t *thr, nxt_msec_less_t);
38384Szelenkov@nginx.com 
39384Szelenkov@nginx.com nxt_int_t nxt_rbtree_test(nxt_thread_t *thr, nxt_uint_t n);
40384Szelenkov@nginx.com nxt_int_t nxt_rbtree1_test(nxt_thread_t *thr, nxt_uint_t n);
41384Szelenkov@nginx.com 
42384Szelenkov@nginx.com #if (NXT_TEST_RTDTSC)
43384Szelenkov@nginx.com 
44384Szelenkov@nginx.com nxt_int_t nxt_rbtree_mb_start(nxt_thread_t *thr);
45384Szelenkov@nginx.com void nxt_rbtree_mb_insert(nxt_thread_t *thr);
46384Szelenkov@nginx.com void nxt_rbtree_mb_delete(nxt_thread_t *thr);
47384Szelenkov@nginx.com 
48384Szelenkov@nginx.com nxt_int_t nxt_rbtree1_mb_start(nxt_thread_t *thr);
49384Szelenkov@nginx.com void nxt_rbtree1_mb_insert(nxt_thread_t *thr);
50384Szelenkov@nginx.com void nxt_rbtree1_mb_delete(nxt_thread_t *thr);
51384Szelenkov@nginx.com 
52384Szelenkov@nginx.com #endif
53384Szelenkov@nginx.com 
54384Szelenkov@nginx.com nxt_int_t nxt_mp_test(nxt_thread_t *thr, nxt_uint_t runs, nxt_uint_t nblocks,
55384Szelenkov@nginx.com     size_t max_size);
56384Szelenkov@nginx.com nxt_int_t nxt_mem_zone_test(nxt_thread_t *thr, nxt_uint_t runs,
57384Szelenkov@nginx.com     nxt_uint_t nblocks, size_t max_size);
58384Szelenkov@nginx.com nxt_int_t nxt_lvlhsh_test(nxt_thread_t *thr, nxt_uint_t n,
59384Szelenkov@nginx.com     nxt_bool_t use_pool);
60384Szelenkov@nginx.com 
61384Szelenkov@nginx.com nxt_int_t nxt_gmtime_test(nxt_thread_t *thr);
62384Szelenkov@nginx.com nxt_int_t nxt_sprintf_test(nxt_thread_t *thr);
63384Szelenkov@nginx.com nxt_int_t nxt_malloc_test(nxt_thread_t *thr);
64384Szelenkov@nginx.com nxt_int_t nxt_utf8_test(nxt_thread_t *thr);
65384Szelenkov@nginx.com nxt_int_t nxt_http_parse_test(nxt_thread_t *thr);
66384Szelenkov@nginx.com nxt_int_t nxt_strverscmp_test(nxt_thread_t *thr);
67*1975Svbart@nginx.com nxt_int_t nxt_base64_test(nxt_thread_t *thr);
681306St.nateldemoura@f5.com nxt_int_t nxt_clone_creds_test(nxt_thread_t *thr);
69384Szelenkov@nginx.com 
70384Szelenkov@nginx.com 
71384Szelenkov@nginx.com #endif /* _NXT_TESTS_H_INCLUDED_ */
72