]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/test_and_benchmark/libbenchmark/inc/libbenchmark/libbenchmark_threadset.h
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / test_and_benchmark / libbenchmark / inc / libbenchmark / libbenchmark_threadset.h
1 /***** defines *****/
2 #define LIBBENCHMARK_THREADSET_PER_THREAD_STATE_GET_USERS_PER_THREAD_STATE( libbenchmark_threadset_per_thread_state )   (libbenchmark_threadset_per_thread_state).users_per_thread_state
3 #define LIBBENCHMARK_THREADSET_PER_THREAD_STATE_GET_USERS_PER_NUMA_STATE( libbenchmark_threadset_per_thread_state )     (libbenchmark_threadset_per_thread_state).numa_node_state->users_per_numa_state
4 #define LIBBENCHMARK_THREADSET_PER_THREAD_STATE_GET_USERS_OVERALL_STATE( libbenchmark_threadset_per_thread_state )      (libbenchmark_threadset_per_thread_state).threadset_state->users_threadset_state
5
6 /***** structs *****/
7 struct libbenchmark_threadset_per_thread_state
8 {
9   enum flag volatile
10     thread_ready_flag,
11     *threadset_start_flag;
12
13   libshared_pal_thread_handle_t
14     thread_handle;
15
16   struct lfds710_list_asu_element
17     lasue;
18
19   struct libbenchmark_topology_node_state
20     *tns_lp;
21
22   struct libbenchmark_threadset_per_numa_state
23     *numa_node_state;
24
25   struct libbenchmark_threadset_state
26     *threadset_state;
27
28   struct libshared_pal_thread_info
29     pti;
30
31   void
32     *users_per_thread_state;
33 };
34
35 struct libbenchmark_threadset_per_numa_state
36 {
37   lfds710_pal_uint_t
38     numa_node_id;
39
40   struct lfds710_list_asu_element
41     lasue;
42
43   void
44     *users_per_numa_state;
45 };
46
47 struct libbenchmark_threadset_state
48 {
49   enum flag volatile
50     threadset_start_flag;
51
52   libshared_pal_thread_return_t
53     (LIBSHARED_PAL_THREAD_CALLING_CONVENTION *thread_function)( void *thread_user_state );
54
55   struct lfds710_list_asu_state
56     list_of_per_numa_states,
57     list_of_per_thread_states;
58
59   void
60     *users_threadset_state;
61 };
62
63 /***** prototypes *****/
64 void libbenchmark_threadset_init( struct libbenchmark_threadset_state *tsets,
65                                   struct libbenchmark_topology_state *ts,
66                                   struct lfds710_list_aso_state *logical_processor_set,
67                                   struct libshared_memory_state *ms,
68                                   libshared_pal_thread_return_t (LIBSHARED_PAL_THREAD_CALLING_CONVENTION *thread_function)( void *thread_user_state ),
69                                   void *users_threadset_state );
70 void libbenchmark_threadset_cleanup( struct libbenchmark_threadset_state *ts );
71
72 void libbenchmark_threadset_run( struct libbenchmark_threadset_state *tsets );
73
74 void libbenchmark_threadset_thread_ready_and_wait( struct libbenchmark_threadset_per_thread_state *ts );
75