NewMadeleine

Documentation

« back to PM2 home.
nm_core_types.h File Reference

Private definitions for nmad core. More...

#include <stdatomic.h>
#include <inttypes.h>
Include dependency graph for nm_core_types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  nm_core_dispatching_event_s
 an event ready for dispatch (matching already done) More...
 
struct  nm_in_chunk_s
 an incoming chunk of data More...
 
struct  nm_chunk_injector_s
 a chunk to be injected into nmad core More...
 
struct  nm_unexpected_s
 a chunk of unexpected message to be stored More...
 
struct  nm_refcount_s
 a reference-counter that keeps trace of who increments/decrements in debug: full reference tracking in optimized: a plain counter managed with atomics, and nothing else More...
 

Macros

#define NM_ALIGN_FRONTIER   sizeof(NM_ALIGN_TYPE)
 
#define nm_aligned(x)   nm_aligned_n((x), NM_ALIGN_FRONTIER)
 
#define NM_IS_THREADED   ((nm_core_get_thread_level(nm_core_get_singleton()) >= NM_THREAD_SERIALIZED) ? 1 : 0)
 
#define NM_ALLOCATOR_TYPE(ENAME, TYPE)   PUK_ALLOCATOR_TYPE_EXT(ENAME, TYPE, !NM_IS_THREADED)
 
#define NM_TRK_SMALL   ((nm_trk_id_t)0)
 
#define NM_TRK_LARGE   ((nm_trk_id_t)1)
 
#define NM_TRK_NONE   ((nm_trk_id_t)-1)
 
#define NM_MAX_TRACKS   2
 
#define NM_SEQ_FIRST   ((nm_seq_t)1)
 First sequence number.
 
#define nm_profile_add(COUNTER, VALUE)   do {} while(0)
 
#define nm_profile_inc(COUNTER)   nm_profile_add(COUNTER, 1)
 
#define nm_refcount_inc(REFCOUNT, HOLDER)    nm_refcount_inc_internal(REFCOUNT, HOLDER, __FUNCTION__, __FILE__, __LINE__)
 

Functions

static nm_len_t nm_aligned_n (nm_len_t v, nm_len_t a)
 
static void * nm_aligned_ptr (const void *p, nm_len_t a)
 get a pointer aligned to given alignment a
 
 PUK_LIST_CREATE_FUNCS (nm_req)
 
 PUK_LIST_CREATE_FUNCS (nm_req_chunk)
 
 PUK_ALLOCATOR_TYPE_EXT (nm_req_chunk, struct nm_req_chunk_s, !((nm_core_get_thread_level(nm_core_get_singleton()) >=NM_THREAD_SERIALIZED) ? 1 :0))
 allocator for request chunks
 
static nm_seq_t nm_seq_next (nm_seq_t seq)
 Compute next sequence number.
 
static int nm_seq_compare (nm_seq_t current, nm_seq_t seq1, nm_seq_t seq2)
 compare to seq numbers, assuming they are in the future returns -1 if seq1 is before seq2, 0 if equal, 1 if seq1 after seq2
 
static int nm_seq_fuzzy_compare (nm_seq_t seq1, nm_seq_t seq2)
 compare to seq numbers taking into account looping at overflow, assuming they are less than halftrip of overflow returns -1 if seq1 < seq2, 0 if equal, 1 if seq1 > seq2
 
 PUK_VECT_TYPE (nm_core_monitor, struct nm_core_monitor_s *)
 
 PUK_LIST_TYPE (nm_core_pending_event, struct nm_core_event_s event;struct nm_core_monitor_s *p_core_monitor;)
 a pending event, not dispatched immediately because it was received out of order
 
 PUK_LFQUEUE_TYPE (nm_core_dispatching_event, struct nm_core_dispatching_event_s *, NULL, 1024)
 
 PUK_ALLOCATOR_TYPE_EXT (nm_core_dispatching_event, struct nm_core_dispatching_event_s, !((nm_core_get_thread_level(nm_core_get_singleton()) >=NM_THREAD_SERIALIZED) ? 1 :0))
 
 PUK_LIST_DECLARE_TYPE2 (nm_unexpected_wildcard, struct nm_unexpected_s)
 
 PUK_LIST_DECLARE_TYPE2 (nm_unexpected_gtag, struct nm_unexpected_s)
 
 PUK_LIST_DECLARE_TYPE2 (nm_unexpected_gate, struct nm_unexpected_s)
 
 PUK_LIST_DECLARE_TYPE2 (nm_unexpected_tag, struct nm_unexpected_s)
 
 PUK_LIST_CREATE_FUNCS (nm_unexpected_wildcard)
 
 PUK_LIST_CREATE_FUNCS (nm_unexpected_gtag)
 
 PUK_LIST_CREATE_FUNCS (nm_unexpected_gate)
 
 PUK_LIST_CREATE_FUNCS (nm_unexpected_tag)
 
 PUK_LIST_TYPE (nm_refcount_holder, const void *p_holder;const char *func;const char *file;int line;)
 elements for nm_refcount_s; a holder in the refcount
 
static void nm_refcount_dump (struct nm_refcount_s *p_refcount __attribute__((unused)))
 
static void nm_refcount_destroy (struct nm_refcount_s *p_refcount __attribute__((unused)))
 
static int nm_refcount_get (struct nm_refcount_s *p_refcount)
 
static void nm_refcount_inc_internal (struct nm_refcount_s *p_refcount, const void *p_holder __attribute__((unused)), const char *func __attribute__((unused)), const char *file __attribute__((unused)), const int line __attribute__((unused)))
 
static int nm_refcount_dec (struct nm_refcount_s *p_refcount, const void *p_holder __attribute__((unused)))
 decrement refcount for holder; returns refcount (if 0, caller may free ref-counted resource)
 
static void nm_refcount_init (struct nm_refcount_s *p_refcount, char *p_object_id, const void *p_init_holder)
 initialize a new refcount object; get the object ID to make debugging easier; we take ownership of object_id p_init_holder is the holder for the first reference.
 

Detailed Description

Private definitions for nmad core.

This file is not installed and not part of the public API.

Definition in file nm_core_types.h.

Macro Definition Documentation

◆ NM_ALIGN_FRONTIER

#define NM_ALIGN_FRONTIER   sizeof(NM_ALIGN_TYPE)

Definition at line 30 of file nm_core_types.h.

◆ nm_aligned

#define nm_aligned (   x)    nm_aligned_n((x), NM_ALIGN_FRONTIER)

Definition at line 31 of file nm_core_types.h.

◆ NM_ALLOCATOR_TYPE

#define NM_ALLOCATOR_TYPE (   ENAME,
  TYPE 
)    PUK_ALLOCATOR_TYPE_EXT(ENAME, TYPE, !NM_IS_THREADED)

Definition at line 55 of file nm_core_types.h.

◆ NM_IS_THREADED

#define NM_IS_THREADED   ((nm_core_get_thread_level(nm_core_get_singleton()) >= NM_THREAD_SERIALIZED) ? 1 : 0)

Definition at line 50 of file nm_core_types.h.

◆ NM_MAX_TRACKS

#define NM_MAX_TRACKS   2
Deprecated:

Definition at line 73 of file nm_core_types.h.

◆ nm_profile_add

#define nm_profile_add (   COUNTER,
  VALUE 
)    do {} while(0)

Definition at line 133 of file nm_core_types.h.

◆ nm_profile_inc

#define nm_profile_inc (   COUNTER)    nm_profile_add(COUNTER, 1)

Definition at line 136 of file nm_core_types.h.

◆ nm_refcount_inc

#define nm_refcount_inc (   REFCOUNT,
  HOLDER 
)     nm_refcount_inc_internal(REFCOUNT, HOLDER, __FUNCTION__, __FILE__, __LINE__)

Definition at line 261 of file nm_core_types.h.

◆ NM_SEQ_FIRST

#define NM_SEQ_FIRST   ((nm_seq_t)1)

First sequence number.

Definition at line 78 of file nm_core_types.h.

◆ NM_TRK_LARGE

#define NM_TRK_LARGE   ((nm_trk_id_t)1)

Definition at line 69 of file nm_core_types.h.

◆ NM_TRK_NONE

#define NM_TRK_NONE   ((nm_trk_id_t)-1)

Definition at line 70 of file nm_core_types.h.

◆ NM_TRK_SMALL

#define NM_TRK_SMALL   ((nm_trk_id_t)0)

Definition at line 68 of file nm_core_types.h.

Function Documentation

◆ nm_aligned_n()

static nm_len_t nm_aligned_n ( nm_len_t  v,
nm_len_t  a 
)
inlinestatic

Definition at line 33 of file nm_core_types.h.

◆ nm_aligned_ptr()

static void * nm_aligned_ptr ( const void *  p,
nm_len_t  a 
)
inlinestatic

get a pointer aligned to given alignment a

Definition at line 40 of file nm_core_types.h.

◆ nm_refcount_dec()

static int nm_refcount_dec ( struct nm_refcount_s p_refcount,
const void *p_holder   __attribute__(unused) 
)
inlinestatic

decrement refcount for holder; returns refcount (if 0, caller may free ref-counted resource)

Definition at line 319 of file nm_core_types.h.

References assert(), count, NM_FATAL, nm_spin_lock(), nm_spin_unlock(), and nm_refcount_s::refcount.

Referenced by nm_pw_ref_dec().

Here is the call graph for this function:

◆ nm_refcount_destroy()

static void nm_refcount_destroy ( struct nm_refcount_s *p_refcount   __attribute__(unused))
inlinestatic

Definition at line 246 of file nm_core_types.h.

References nm_refcount_dump(), and nm_spin_destroy().

Here is the call graph for this function:

◆ nm_refcount_dump()

static void nm_refcount_dump ( struct nm_refcount_s *p_refcount   __attribute__(unused))
inlinestatic

Definition at line 234 of file nm_core_types.h.

References NM_WARN.

Referenced by nm_refcount_destroy().

◆ nm_refcount_get()

static int nm_refcount_get ( struct nm_refcount_s p_refcount)
inlinestatic

Definition at line 256 of file nm_core_types.h.

References nm_refcount_s::refcount.

Referenced by nm_pw_ref_dec_free().

◆ nm_refcount_inc_internal()

static void nm_refcount_inc_internal ( struct nm_refcount_s p_refcount,
const void *p_holder   __attribute__(unused),
const char *func   __attribute__(unused),
const char *file   __attribute__(unused),
const int line   __attribute__(unused) 
)
inlinestatic

Definition at line 289 of file nm_core_types.h.

References assert(), nm_spin_lock(), nm_spin_unlock(), NM_WARN, and nm_refcount_s::refcount.

Here is the call graph for this function:

◆ nm_refcount_init()

static void nm_refcount_init ( struct nm_refcount_s p_refcount,
char *  p_object_id,
const void *  p_init_holder 
)
inlinestatic

initialize a new refcount object; get the object ID to make debugging easier; we take ownership of object_id p_init_holder is the holder for the first reference.

Definition at line 351 of file nm_core_types.h.

References nm_spin_init(), and nm_refcount_s::refcount.

Referenced by nm_mpi_refcount_init().

Here is the call graph for this function:

◆ nm_seq_compare()

static int nm_seq_compare ( nm_seq_t  current,
nm_seq_t  seq1,
nm_seq_t  seq2 
)
inlinestatic

compare to seq numbers, assuming they are in the future returns -1 if seq1 is before seq2, 0 if equal, 1 if seq1 after seq2

Definition at line 92 of file nm_core_types.h.

References assert().

Here is the call graph for this function:

◆ nm_seq_fuzzy_compare()

static int nm_seq_fuzzy_compare ( nm_seq_t  seq1,
nm_seq_t  seq2 
)
inlinestatic

compare to seq numbers taking into account looping at overflow, assuming they are less than halftrip of overflow returns -1 if seq1 < seq2, 0 if equal, 1 if seq1 > seq2

Definition at line 109 of file nm_core_types.h.

References NM_FATAL, and NM_SEQ_MAX.

◆ nm_seq_next()

static nm_seq_t nm_seq_next ( nm_seq_t  seq)
inlinestatic

Compute next sequence number.

Definition at line 81 of file nm_core_types.h.

References assert(), NM_SEQ_NONE, and seq.

Here is the call graph for this function:

◆ PUK_ALLOCATOR_TYPE_EXT() [1/2]

PUK_ALLOCATOR_TYPE_EXT ( nm_core_dispatching_event  ,
struct nm_core_dispatching_event_s  ,
(nm_core_get_thread_level(nm_core_get_singleton()) >=NM_THREAD_SERIALIZED) ? 1 :0 
)

◆ PUK_ALLOCATOR_TYPE_EXT() [2/2]

PUK_ALLOCATOR_TYPE_EXT ( nm_req_chunk  ,
struct nm_req_chunk_s  ,
(nm_core_get_thread_level(nm_core_get_singleton()) >=NM_THREAD_SERIALIZED) ? 1 :0 
)

allocator for request chunks

◆ PUK_LFQUEUE_TYPE()

PUK_LFQUEUE_TYPE ( nm_core_dispatching_event  ,
struct nm_core_dispatching_event_s ,
NULL  ,
1024   
)

◆ PUK_LIST_CREATE_FUNCS() [1/6]

PUK_LIST_CREATE_FUNCS ( nm_req  )

◆ PUK_LIST_CREATE_FUNCS() [2/6]

PUK_LIST_CREATE_FUNCS ( nm_req_chunk  )

◆ PUK_LIST_CREATE_FUNCS() [3/6]

PUK_LIST_CREATE_FUNCS ( nm_unexpected_gate  )

◆ PUK_LIST_CREATE_FUNCS() [4/6]

PUK_LIST_CREATE_FUNCS ( nm_unexpected_gtag  )

◆ PUK_LIST_CREATE_FUNCS() [5/6]

PUK_LIST_CREATE_FUNCS ( nm_unexpected_tag  )

◆ PUK_LIST_CREATE_FUNCS() [6/6]

PUK_LIST_CREATE_FUNCS ( nm_unexpected_wildcard  )

◆ PUK_LIST_DECLARE_TYPE2() [1/4]

PUK_LIST_DECLARE_TYPE2 ( nm_unexpected_gate  ,
struct nm_unexpected_s   
)

◆ PUK_LIST_DECLARE_TYPE2() [2/4]

PUK_LIST_DECLARE_TYPE2 ( nm_unexpected_gtag  ,
struct nm_unexpected_s   
)

◆ PUK_LIST_DECLARE_TYPE2() [3/4]

PUK_LIST_DECLARE_TYPE2 ( nm_unexpected_tag  ,
struct nm_unexpected_s   
)

◆ PUK_LIST_DECLARE_TYPE2() [4/4]

PUK_LIST_DECLARE_TYPE2 ( nm_unexpected_wildcard  ,
struct nm_unexpected_s   
)

◆ PUK_LIST_TYPE() [1/2]

PUK_LIST_TYPE ( nm_core_pending_event  ,
struct nm_core_event_s event;struct nm_core_monitor_s *p_core_monitor;   
)

a pending event, not dispatched immediately because it was received out of order

◆ PUK_LIST_TYPE() [2/2]

PUK_LIST_TYPE ( nm_refcount_holder  ,
const void *p_holder;const char *func;const char *file;int line;   
)

elements for nm_refcount_s; a holder in the refcount

◆ PUK_VECT_TYPE()

PUK_VECT_TYPE ( nm_core_monitor  ,
struct nm_core_monitor_s  
)