ATLAS Offline Software
|
Namespaces | |
detail | |
Portable implementations. | |
fpcompare | |
fpcompare_fn | |
vecDetail | |
Classes | |
class | Array |
Read-only multidimensional array. More... | |
class | Array< 0 > |
Read-only multidimensional array, specialized for N=0 . More... | |
class | ArrayIterator |
Iterator class for Array<N> . More... | |
class | ArrayIteratorChooser |
Helper for defining iterators over Array's . More... | |
class | ArrayIteratorChooser< 1 > |
Helper for defining iterators over Array's , specialized for N == 1. More... | |
class | ArrayScanner |
Helper class for converting strings to Array's. More... | |
class | BitPacker |
Pack a set of values bitwise into a stream. More... | |
class | BitPacker16 |
Pack a set of values bitwise into a stream. More... | |
class | BitPacker8 |
Pack a set of values bitwise into a stream. More... | |
class | BitUnpacker |
Helper to unpack a set of values bitwise from a stream. More... | |
class | BitUnpacker16 |
Helper to unpack a set of values bitwise from a stream. More... | |
class | BitUnpacker8 |
Helper to unpack a set of values bitwise from a stream. More... | |
union | CachedPointer |
Cached pointer with atomic update. More... | |
class | CachedUniquePtrT |
Cached pointer with atomic update. More... | |
class | CachedValue |
Cached value with atomic update. More... | |
class | ClassName |
Recursively separate out template arguments in a C++ class name. More... | |
class | CMurmurHash2A |
class | ConcurrentBitset |
Variable-sized bitset allowing (mostly) concurrent access. More... | |
class | ConcurrentPtrSet |
A set of pointers, allowing concurrent, lockless queries. More... | |
class | ConcurrentStrToValMap |
Hash map from strings to arbitrary objects allowing concurrent, lockless reads. More... | |
class | CRCTable |
Precomputed tables and constants for the CRC calculation. More... | |
struct | extrace_init |
class | FloatCompressor |
Class implementing a lossy float compression. More... | |
class | FloatPacker |
Pack/unpack floating-point data from/to a given number of bits. More... | |
class | IRangeMapPayloadDeleter |
Helper to delete payload objects for ConcurrentRangeMap. More... | |
class | LockedPointer |
A pointer together with a movable lock. More... | |
class | PackedArray |
An array of unsigned values of some bit size, packed tightly. More... | |
class | pointer_list |
A fast way to store a variable-sized collection of pointers. More... | |
class | pointer_list_base |
A fast way to store a variable-sized collection of pointers. More... | |
class | range_with_at |
Add at() methods to a range class. More... | |
class | range_with_conv |
Add to a range class conversions to containers. More... | |
class | RedirStderr |
class | releasing_iterator |
Adapter to retrieve elements from a unique_ptr iterator via release(). More... | |
class | reverse_wrapper |
Adapter for a container-like class to be used in a range-for so as to iterate in the reverse direction. More... | |
class | Ring |
A very simple ring buffer. More... | |
class | SimpleUpdater |
Simple (non-deleting) Updater implementation. More... | |
struct | sincos |
Helper to simultaneously calculate sin and cos of the same angle. More... | |
class | span |
Simplified version of the C++20 std::span. More... | |
struct | vec_fb |
class | WritableArray |
Read-write multidimensional array. More... | |
class | WritableArray< 0 > |
class | WritableArrayData |
Typedefs | |
template<class T , size_t Alignment = 1> | |
using | aligned_vector = std::vector< T, boost::alignment::aligned_allocator< T, Alignment > > |
A std::vector with extra alignment. More... | |
template<class T > | |
using | vec_aligned_vector = aligned_vector< T, 64 > |
A std::vector with alignment sufficient for any vector instructions on this platform. More... | |
template<class T > | |
using | CachedUniquePtr = CachedUniquePtrT< const T > |
template<std::ranges::input_range SPAN, class XFORM > | |
using | transform_view_with_at = range_with_at< std::ranges::transform_view< SPAN, XFORM > > |
Helper to add at() methods to a transform_view. More... | |
template<typename T , size_t N> | |
using | vec = typename vecDetail::vec_typedef< T, N >::type |
Define a nice alias for the vectorized type. More... | |
template<class VEC > | |
using | vec_type_t = typename vecDetail::vec_type< VEC >::type |
Define a nice alias for the element type of a vectorized type. More... | |
template<class VEC > | |
using | vec_mask_type_t = typename vecDetail::vec_mask_type< VEC >::type |
Define a nice alias for the mask type for a vectorized type. More... | |
template<typename T , size_t N> | |
using | ivec = vec_fb< typename boost::int_t< sizeof(T) *8 >::exact, N > |
Enumerations | |
enum | CacheState : unsigned char { INVALID = 0, UPDATING = 1, VALID = 2 } |
State of the cached value; see below. More... | |
enum | { CacheLineSize = 64 } |
While it is possible to determine cache line size at run time (e.g. More... | |
Functions | |
template<unsigned int N> | |
std::ostream & | operator<< (std::ostream &s, const Array< N > &a) |
template<class T > | |
void | fromArrayrep (const CaloRec::Arrayrep &rep, T &x) |
Helper to convert from an @x Arrayrep to a scalar type. More... | |
template<unsigned int N> | |
void | fromArrayrep (const CaloRec::Arrayrep &rep, CxxUtils::Array< N > &x) |
Helper to convert from an @x Arrayrep to an Array . More... | |
template<class T > | |
const T * | as_const_ptr (const T *p) |
Helper for getting a const version of a pointer. More... | |
template<class T > | |
T | atomic_bounded_decrement (std::atomic< T > *a, T bound=0, T decr=1, std::memory_order memorder=std::memory_order_seq_cst) |
Atomically decrement a value with a lower bound. More... | |
template<class T > | |
T | atomic_fetch_max (std::atomic< T > *a, T v, std::memory_order memorder=std::memory_order_seq_cst) |
Atomically calculate maximum. More... | |
template<class T > | |
T | atomic_fetch_min (std::atomic< T > *a, T v, std::memory_order memorder=std::memory_order_seq_cst) |
Atomically calculate minimum. More... | |
std::string | base64_encode (const unsigned char *, unsigned int) |
std::vector< unsigned char > | base64_decode (const std::string &) |
template<class E > | |
constexpr std::enable_if_t< is_bitmask_v< E >, E & > | set (E &lhs, E rhs) |
Convenience function to set bits in a class enum bitmask. More... | |
template<class E > | |
constexpr std::enable_if_t< is_bitmask_v< E >, E & > | reset (E &lhs, E rhs) |
Convenience function to clear bits in a class enum bitmask. More... | |
template<class E > | |
constexpr std::enable_if_t< is_bitmask_v< E >, bool > | test (E lhs, E rhs) |
Convenience function to test bits in a class enum bitmask. More... | |
constexpr unsigned | count_trailing_zeros (unsigned x) |
Count number of trailing zeros. More... | |
constexpr unsigned | count_trailing_zeros (unsigned long x) |
constexpr unsigned | count_trailing_zeros (unsigned long long x) |
constexpr unsigned | count_leading_zeros (unsigned x) |
Count number of leading zeros. More... | |
constexpr unsigned | count_leading_zeros (unsigned long x) |
constexpr unsigned | count_leading_zeros (unsigned long long x) |
constexpr unsigned | count_ones (unsigned x) |
Count number of set bits. More... | |
constexpr unsigned | count_ones (unsigned long x) |
constexpr unsigned | count_ones (unsigned long long x) |
template<typename T > | |
constexpr int | maxSetBit (const T x) |
Returns the position (counting from least-significant-bit=0) of the most significant set bit. More... | |
template<class KEY , class VALUE , template< class > class UPDATER, class HASHER = std::hash<KEY>, class MATCHER = std::equal_to<KEY>, detail::ConcurrentHashmapVal_t NULLVAL = 0, detail::ConcurrentHashmapVal_t TOMBSTONE = NULLVAL> | |
ATH_REQUIRES (detail::IsConcurrentHashmapPayload< KEY > &&detail::IsConcurrentHashmapPayload< VALUE > &&detail::IsUpdater< UPDATER > &&detail::IsHash< HASHER, KEY > &&detail::IsBinaryPredicate< MATCHER, KEY >) class ConcurrentMap | |
Hash map from integers/pointers allowing concurrent, lockless reads. More... | |
template<class RANGE , class KEY , class T , class COMPARE , template< class > class UPDATER> | |
ATH_REQUIRES (detail::IsUpdater< UPDATER > &&detail::IsConcurrentRangeCompare< COMPARE, RANGE, KEY, typename UPDATER< int >::Context_t >) class ConcurrentRangeMap | |
Map from range to payload object, allowing concurrent, lockless reads. More... | |
template<class VALUE , template< class > class UPDATER> | |
ATH_REQUIRES (detail::IsConcurrentHashmapPayload< VALUE > &&detail::IsUpdater< UPDATER >) class ConcurrentStrMap | |
Hash map from strings allowing concurrent, lockless reads. More... | |
template<class KEY , class VALUE , template< class > class UPDATER, class HASHER = std::hash<KEY>, class MATCHER = std::equal_to<KEY>, detail::ConcurrentHashmapVal_t NULLVAL = 0> | |
ATH_REQUIRES (detail::IsConcurrentHashmapPayload< KEY > &&detail::IsUpdater< UPDATER > &&detail::IsHash< HASHER, KEY > &&detail::IsBinaryPredicate< MATCHER, KEY >) class ConcurrentToValMap | |
Hash map from pointers/integers to arbitrary objects allowing concurrent, lockless reads. More... | |
template<class InputIterator , class OutputIterator , class InputTag , class OutputTag > | |
OutputIterator | copy_bounded1 (InputIterator begi, InputIterator endi, OutputIterator bego, OutputIterator endo, const InputTag &, const OutputTag &) |
Copy a range with bounds restriction; generic version. More... | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | copy_bounded1 (InputIterator begi, InputIterator endi, OutputIterator bego, OutputIterator endo, const std::random_access_iterator_tag &, const std::random_access_iterator_tag &) |
Copy a range with bounds restriction; random_access_iterator version. More... | |
template<class InputIterator , class OutputIterator > | |
ATH_REQUIRES (std::input_iterator< InputIterator > &&std::output_iterator< OutputIterator, typename std::iterator_traits< InputIterator >::value_type >) inline OutputIterator copy_bounded(InputIterator begi | |
Copy a range with bounds restriction. More... | |
template<class InputRange , class OutputRange > | |
auto | copy_bounded (const InputRange &input, OutputRange &output) -> decltype(std::begin(output)) |
Copy a range with bounds restriction. More... | |
template<class InputRange , class OutputRange > | |
auto | copy_bounded (const InputRange &input, OutputRange &&output) -> decltype(std::begin(output)) |
Copy a range with bounds restriction. More... | |
void | deleteCRCTable (CxxUtils::CRCTable *table) |
Delete a CRCTable object. More... | |
std::unique_ptr< CRCTable > | makeCRCTable (uint64_t p, uint64_t initial=0xffffffffffffffff) |
Initialize CRC tables and constants. More... | |
uint64_t | crc64_bytewise (const CRCTable &table, const char *data, size_t data_len) |
Find the CRC-64 of a string, using a byte-by-byte algorithm. More... | |
uint64_t | crc64_bytewise (const char *data, size_t data_len) |
Find the CRC-64 of a string, using a byte-by-byte algorithm, with the default CRC. More... | |
uint64_t | crc64_bytewise (const std::string &s) |
Find the CRC-64 of a string, using a byte-by-byte algorithm, with the default CRC. More... | |
uint64_t | crc64 (const CRCTable &table, const char *data, size_t data_len) |
Find the CRC-64 of a string,. More... | |
uint64_t | crc64 (const char *data, size_t data_len) |
Find the CRC-64 of a string, with the default CRC. More... | |
uint64_t | crc64 (const std::string &s) |
Find the CRC-64 of a string, using the default polynomial. More... | |
uint64_t | crc64addint (uint64_t crc, uint64_t x) |
Extend a previously-calculated CRC to include an int. More... | |
std::string | crc64format (uint64_t crc) |
Format a CRC-64 as a string. More... | |
std::string | crc64digest (const std::string &str) |
Return a CRC-64 digest of a string. More... | |
void | exctrace (const std::exception &e, IOFD fd=IOFD_INVALID) |
Print out information for the last exception. More... | |
uint16_t | htole16 (uint16_t x) |
uint32_t | htole32 (uint32_t x) |
uint64_t | htole64 (uint64_t x) |
uint16_t | get_unaligned16 (const uint8_t *ATH_RESTRICT &p) |
Read a 2-byte little-endian value from a possibly unaligned pointer. More... | |
uint32_t | get_unaligned32 (const uint8_t *ATH_RESTRICT &p) |
Read a 4-byte little-endian value from a possibly unaligned pointer. More... | |
uint64_t | get_unaligned64 (const uint8_t *ATH_RESTRICT &p) |
Read a 8-byte little-endian value from a possibly unaligned pointer. More... | |
float | get_unaligned_float (const uint8_t *ATH_RESTRICT &p) |
Read little-endian float value from a possibly unaligned pointer. More... | |
double | get_unaligned_double (const uint8_t *ATH_RESTRICT &p) |
Read little-endian float value from a possibly unaligned pointer. More... | |
template<class T > | |
T | get_unaligned (const uint8_t *ATH_RESTRICT &p) |
Define templated versions of the above functions. More... | |
template<> | |
uint8_t | get_unaligned< uint8_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
uint16_t | get_unaligned< uint16_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
uint32_t | get_unaligned< uint32_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
uint64_t | get_unaligned< uint64_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
float | get_unaligned< float > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
double | get_unaligned< double > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
int8_t | get_unaligned< int8_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
int16_t | get_unaligned< int16_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
int32_t | get_unaligned< int32_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
int64_t | get_unaligned< int64_t > (const uint8_t *ATH_RESTRICT &p) |
void | hexdump (std::ostream &s, const void *addr, size_t n, size_t offset=0) |
Make a hex dump of memory. More... | |
void | safeHexdump (std::ostream &s, const void *addr, size_t n, size_t offset=0) |
Make a hex dump of memory, protected against bad reads. More... | |
uint32_t | MurmurHash2 (const void *key, int len, uint32_t seed) |
uint64_t | MurmurHash64A (const void *key, int len, uint64_t seed) |
uint64_t | MurmurHash64B (const void *key, int len, uint64_t seed) |
uint32_t | MurmurHash2A (const void *key, int len, uint32_t seed) |
uint32_t | MurmurHashNeutral2 (const void *key, int len, uint32_t seed) |
uint32_t | MurmurHashAligned2 (const void *key, int len, uint32_t seed) |
std::string | normalizeFunctionName (const std::string &fname) |
Normalize a pretty-printed C++ function name. More... | |
template<class T > | |
constexpr T | ones (unsigned int n) |
Return a bit mask with the lower n bits set. More... | |
template<typename T > | |
T | wrapToPi (T phi) |
Wrap angle in radians to [-pi, pi]. More... | |
template<typename T > | |
T | deltaPhi (T phiA, T phiB) |
Return difference phiA - phiB in range [-pi, pi]. More... | |
template<typename T > | |
T | phiMean (T phiA, T phiB) |
Calculate average of two angles. More... | |
template<typename T > | |
T | phiBisect (T phiA, T phiB) |
Bisect (average) the angle spanned by phiA and phiB. More... | |
void | prefetchOne (const void *address) |
Generic prefetch method. More... | |
template<size_t N> | |
void | prefetchN (const void *ptr) |
Prefetch an N-byte block of memory. More... | |
template<typename T > | |
void | prefetchObj (const T *ptr) |
Generic prefetch of the object of specific types (sizes). More... | |
template<typename Iter > | |
void | prefetchNext (Iter iter, Iter endIter) |
Prefetch next object in sequence. More... | |
template<typename Iter > | |
void | prefetchTwo (Iter iter, Iter endIter) |
Prefetch two objects. More... | |
template<class T > | |
auto | begin (range_with_at< T > &s) |
template<class T > | |
auto | begin (const range_with_at< T > &s) |
template<class T > | |
auto | end (range_with_at< T > &s) |
template<class T > | |
auto | end (const range_with_at< T > &s) |
template<class T > | |
auto | begin (range_with_conv< T > &s) |
template<class T > | |
auto | begin (const range_with_conv< T > &s) |
template<class T > | |
auto | end (range_with_conv< T > &s) |
template<class T > | |
auto | end (const range_with_conv< T > &s) |
template<class CONT , class RANGE > | |
CONT | to (RANGE &&r) |
template<class T > | |
auto | make_reverse_wrapper (T &r) |
Make a reverse_wrapper for a given container-like object. More... | |
template<class T > | |
span (T *ptr, std::size_t sz) -> span< T > | |
A couple needed deduction guides. More... | |
template<class T > | |
span (T *beg, T *end) -> span< T > | |
template<class CONTAINER > | |
auto | make_span (CONTAINER &c) |
Helper to make a span from a container. More... | |
template<class T > | |
auto | begin (span< T > &s) |
template<class T > | |
auto | begin (const span< T > &s) |
template<class T > | |
auto | end (span< T > &s) |
template<class T > | |
auto | end (const span< T > &s) |
void | stall () |
Emit stall instruction for use in a spin loop. More... | |
std::string | strformat (const char *fmt,...) |
return a std::string according to a format fmt and varargs More... | |
int | atoi (std::string_view str) |
Helper functions to unpack numbers decoded in string into integers and doubles The strings are required to contain only digits, a floating point dot, the signs +- or a whitespace Exceptions are thrown otherwise. More... | |
double | atof (std::string_view str) |
Converts a string into a double / float. More... | |
std::string_view | eraseWhiteSpaces (std::string_view str) |
Removes all trailing and starting whitespaces from a string. More... | |
std::vector< std::string > | tokenize (const std::string &the_str, std::string_view delimiters) |
Splits the string into smaller substrings. More... | |
std::vector< double > | tokenizeDouble (const std::string &the_str, std::string_view delimiter) |
std::vector< int > | tokenizeInt (const std::string &the_str, std::string_view delimiter) |
void | ubsan_suppress (void(*func)()) |
Helper for suppressing ubsan warnings. More... | |
template<class VEC > | |
constexpr ATH_ALWAYS_INLINE size_t | vec_size () |
Return the number of elements in a vectorized type. More... | |
template<class VEC > | |
constexpr ATH_ALWAYS_INLINE size_t | vec_size (const VEC &) |
Return the number of elements in a vectorized type. More... | |
template<typename VEC , typename T > | |
ATH_ALWAYS_INLINE void | vbroadcast (VEC &v, T x) |
Copy a scalar to each element of a vectorized type. More... | |
template<typename VEC > | |
ATH_ALWAYS_INLINE void | vload (VEC &dst, vec_type_t< VEC > const *src) |
template<typename VEC > | |
ATH_ALWAYS_INLINE void | vstore (vec_type_t< VEC > *dst, const VEC &src) |
template<typename VEC > | |
ATH_ALWAYS_INLINE void | vselect (VEC &dst, const VEC &a, const VEC &b, const vec_mask_type_t< VEC > &mask) |
template<typename VEC > | |
ATH_ALWAYS_INLINE void | vmin (VEC &dst, const VEC &a, const VEC &b) |
template<typename VEC > | |
ATH_ALWAYS_INLINE void | vmax (VEC &dst, const VEC &a, const VEC &b) |
template<typename VEC > | |
ATH_ALWAYS_INLINE bool | vany (const VEC &mask) |
template<typename VEC > | |
ATH_ALWAYS_INLINE bool | vnone (const VEC &mask) |
template<typename VEC > | |
ATH_ALWAYS_INLINE bool | vall (const VEC &mask) |
template<typename VEC1 , typename VEC2 > | |
ATH_ALWAYS_INLINE void | vconvert (VEC1 &dst, const VEC2 &src) |
performs dst is the result of a static cast of each element of src More... | |
template<size_t... Indices, typename VEC , typename VEC1 > | |
ATH_ALWAYS_INLINE void | vpermute (VEC1 &dst, const VEC &src) |
vpermute function. More... | |
template<size_t... Indices, typename VEC , typename VEC1 > | |
ATH_ALWAYS_INLINE void | vpermute2 (VEC1 &dst, const VEC &src1, const VEC &src2) |
vpermute2 function. More... | |
template<typename T , size_t N> | |
ivec< T, N > | operator! (const vec_fb< T, N > &a) |
Negation. More... | |
template<typename T , size_t N> | |
ivec< T, N > | operator&& (const vec_fb< T, N > &a, const vec_fb< T, N > &b) |
V1 && V2. More... | |
template<typename T , size_t N, class U > | |
ivec< T, N > | operator&& (U a, const vec_fb< T, N > &b) |
S && V. More... | |
template<typename T , size_t N, class U > | |
ivec< T, N > | operator&& (const vec_fb< T, N > &a, U b) |
V && S. More... | |
template<typename T , size_t N> | |
ivec< T, N > | operator|| (const vec_fb< T, N > &a, const vec_fb< T, N > &b) |
V1 || V2. More... | |
std::string | clean_allocator (std::string f) |
Clean ‘allocator’ template arguments from the function f. More... | |
std::string | munge_string_name (const std::string &str_in) |
std::string | munge_punct (const std::string &str_in) |
std::string | do_replace (std::string s, const std::string &pat, const std::string &rep) |
std::string | munge_names (const std::string &str_in) |
template<class dType > | |
void | convertToNumber (std::string_view str, dType &number) |
Variables | |
InputIterator | endi |
InputIterator OutputIterator | bego |
InputIterator OutputIterator OutputIterator | endo |
template<class RANGE , class T > | |
concept | InputRangeOverT |
Concept for an input range over a given type. More... | |
constexpr size_t | dynamic_extent = static_cast<size_t>(-1) |
Used to specify a subrange of indefinite size in subspan(). More... | |
template<class T , class U > | |
constexpr bool | valid_span_type_v = std::is_convertible_v<U(*)[], T(*)[]> |
Is U* a valid type to use to initialize a span<T>? No more than const-conversion. More... | |
const CRCTable | defaultCRCTable (0xad93d23594c935a9) |
using CxxUtils::aligned_vector = typedef std::vector<T, boost::alignment::aligned_allocator<T, Alignment> > |
A std::vector
with extra alignment.
The alignment for the payload will be at least either that required by T
or Alignment
, whichever is greater.
Definition at line 39 of file aligned_vector.h.
using CxxUtils::CachedUniquePtr = typedef CachedUniquePtrT<const T> |
Definition at line 114 of file CachedUniquePtr.h.
using CxxUtils::ivec = typedef vec_fb<typename boost::int_t<sizeof(T) * 8>::exact, N> |
using CxxUtils::transform_view_with_at = typedef range_with_at<std::ranges::transform_view<SPAN, XFORM> > |
Helper to add at() methods to a transform_view.
Definition at line 57 of file range_with_at.h.
using CxxUtils::vec = typedef typename vecDetail::vec_typedef<T,N>::type |
using CxxUtils::vec_aligned_vector = typedef aligned_vector<T, 64> |
A std::vector
with alignment sufficient for any vector instructions on this platform.
For now, just hard code 64, which is sufficient for a 512-bit vector, the largest supported by any x86 processors. We may want to make this platform-dependent in the future.
Definition at line 51 of file aligned_vector.h.
using CxxUtils::vec_mask_type_t = typedef typename vecDetail::vec_mask_type<VEC>::type |
using CxxUtils::vec_type_t = typedef typename vecDetail::vec_type<VEC>::type |
anonymous enum |
While it is possible to determine cache line size at run time (e.g.
using sysconf(_SC_LEVEL1_DCACHE_LINESIZE) on Linux or sysctlbyname("hw.cachelinesize", ...) on Apple systems) that approach creates more problems: the location that stores cache line size will probably be out of cache when one needs to know it. This is why we use a compile time constant for cache line size. Cache line size is 64 for the current generation of Intel/AMD CPUs.
If an object spans multiple cache lines then prefetching whole object should be done by prefetching at least one address from each of the cache lines that object occupies. How many lines are needed depends on three things: object size, cache line size, and object starting address. If CacheLineSize is lower than the actual line size then more prefetches than necessary will be generated (2, 4, or more per cache line if cache line size is power of 2). This may be somewhat wasteful so this number may need to be adjusted in the far future when all CPUs have wider cache lines.
Enumerator | |
---|---|
CacheLineSize |
Definition at line 59 of file prefetch.h.
enum CxxUtils::CacheState : unsigned char |
State of the cached value; see below.
Enumerator | |
---|---|
INVALID | |
UPDATING | |
VALID |
Definition at line 27 of file CachedValue.h.
Helper for getting a const version of a pointer.
p | Pointer to convert. |
Given T* p
, as_const_ptr(p)
will return p
as a const T*
.
This is similar in spirit to std::as_const
(which doesn't really do what you might expect for pointers).
Definition at line 32 of file as_const_ptr.h.
CxxUtils::ATH_REQUIRES | ( | detail::IsConcurrentHashmapPayload< KEY > &&detail::IsConcurrentHashmapPayload< VALUE > &&detail::IsUpdater< UPDATER > &&detail::IsHash< HASHER, KEY > &&detail::IsBinaryPredicate< MATCHER, KEY > | ) |
Hash map from integers/pointers allowing concurrent, lockless reads.
This class implements a hash map. Both the key and mapped types may be pointers or any numeric type that can fit in a uintptr_t. (However, using floating types for the key is not recommended.) It allows for concurrent access from many threads. Reads can proceed without taking out a lock, while writes are serialized with each other. Thus, this is appropriate for maps which are read-mostly.
This is based on ConcurrentHashmapImpl.
Besides the mapped key and value types, this class is templated on an UPDATER class, which is used to manage the underlying memory. See IsUpdater.h for details. (AthenaKernel/RCUUpdater is a concrete version that should work in the context of Athena.)
The operations used for calculating the hash of the keys and comparing keys can be customized with the HASHER and MATCHER template arguments (though the defaults should usually be fine).
One value of the key must be reserved as a null value, which no real keys may take. By default this is ‘0’, but it may be customized with the NULLVAL template argument. The map may optionally support erasures (via tombstones). To allow this, a second reserved key value must be identified and specified by the TOMBSTONE template argument. Note that the type of the NULLPTR and TOMBSTONE template arguments is a uintptr_t, not KEY.
This mostly supports the interface of std::unordered_map, with a few differences / omissions:
Performance: This is the result from running the test with –perf on my machine, with gcc 13.0.0
ConcurrentMap lookup: 0.843s wall, 0.840s user + 0.000s system = 0.840s CPU (99.6%) iterate: 0.551s wall, 0.540s user + 0.000s system = 0.540s CPU (97.9%) UnorderedMap lookup: 1.890s wall, 1.870s user + 0.000s system = 1.870s CPU (99.0%) iterate: 0.966s wall, 0.970s user + 0.000s system = 0.970s CPU (100.4%) concurrent_unordered_map lookup: 3.718s wall, 3.690s user + 0.010s system = 3.700s CPU (99.5%) iterate: 5.719s wall, 5.690s user + 0.000s system = 5.690s CPU (99.5%) ck_ht lookup: 1.471s wall, 1.460s user + 0.000s system = 1.460s CPU (99.2%) iterate: 1.519s wall, 1.500s user + 0.000s system = 1.500s CPU (98.7%)
The timing for the lookup test of UnorderedMap is probably overly-optimistic, since the test doesn't do any locking in that case.
Representation type in the underlying map.
The underlying uint->uint hash table.
Standard STL types.
Updater object.
Context type.
Type for external locking.
Ensure that the underlying map can store our types.
Constructor.
updater | Object used to manage memory (see comments at the start of the class). |
capacity | The initial table capacity. (Will be rounded up to a power of two.) |
ctx | Execution context. |
Constructor from another map.
updater | Object used to manage memory (see comments at the start of the class). |
capacity | The initial table capacity of the new table. (Will be rounded up to a power of two.) |
ctx | Execution context. |
(Not really a copy constructor since we need to pass updater
.)
Constructor from a range.
f | Start iterator for the range. |
l | End iterator for the range. |
updater | Object used to manage memory (see comments at the start of the class). |
capacity | The initial table capacity of the new table. (Will be rounded up to a power of two.) |
ctx | Execution context. |
Constructor from a range of pairs.
Copy / move / assign not supported.
Destructor.
Return the number of items currently in the map.
Test if the map is currently empty.
Return the current size (capacity) of the hash table.
The number of erased elements in the current table.
Value structure for iterators.
Iterator class.
This uses boost::iterator_facade to define the methods required by an STL iterator in terms of the private methods below.
Since dereference() will be returning a const_iterator_value by value, we also need to override the reference type.
Constructor.
it | Iterator of the underlying table. |
Test if this iterator is valid.
This should be the same as testing for != end().
Required by iterator_facade.
iterator_facade requirement: Increment the iterator.
iterator_facade requirement: Decrement the iterator.
iterator_facade requirement: Equality test.
iterator_facade requirement: Dereference the iterator.
The iterator on the underlying table.
A range defined by two iterators.
Return an iterator range covering the entire map.
Iterator at the start of the map.
Iterator at the end of the map.
Iterator at the start of the map.
Iterator at the end of the map.
Test if a key is in the container.
key | The key to test. |
Return the number of times a given key is in the container.
key | The key to test. |
Returns either 0 or 1, depending on whether or not the key is in the map.
Look up an element in the map.
key | The element to find. |
Returns either an iterator referencing the found element or end().
Look up an element in the map.
key | The element to find. |
Returns the value associated with the key. Throws std::out_of_range
if the key does not exist in the map.
Return a range of iterators with entries matching key
.
key | The element to find. |
As keys are unique in this container, this is either a single-element range, or both iterators are equal to end().
Take a lock on the container.
Take a lock on the container. The lock can then be passed to insertion methods, allowing to factor out the locking inside loops. The lock will be released when the lock object is destroyed.
Add an element to the map.
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map, with external locking.
lock | The lock object returned from lock(). |
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map, or overwrite an existing one.
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map, or overwrite an existing one, with external locking.
lock | The lock object returned from lock(). |
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map.
p | The item to add. Should be a pair where first is the key and second is the integer value. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
For external locking, use emplace().
Insert a range of elements to the map.
first | Start of the range. |
last | End of the range. |
The range should be a sequence of pairs where first is the string key and second is the integer value.
Erase an entry from the table.
key | The key to erase. |
Mark the corresponding entry as deleted. Return true on success, false on failure (key not found).
The tombstone value must be different from the null value.
This may cause the key type returned by an iterator to change asynchronously to the tombstone value.
Erase an entry from the table, with external locking.
lock | The lock object returned from lock(). |
key | The key to erase. |
Mark the corresponding entry as deleted. Return true on success, false on failure (key not found).
The tombstone value must be different from the null value.
This may cause the key type returned by an iterator to change asynchronously to the tombstone value.
Increase the table capacity.
capacity | The new table capacity. |
ctx | Execution context. |
No action will be taken if capacity
is smaller than the current capacity.
Increase the table capacity.
capacity | The new table capacity. |
No action will be taken if capacity
is smaller than the current capacity.
Erase the table and change the capacity.
capacity | The new table capacity. |
ctx | Execution context. |
Erase the table (don't change the capacity).
ctx | Execution context. |
Erase the table in-place.
This method avoids allocating a new version of the table. However, it is not safe to use concurrently — no other threads may be accessing the container at the same time, either for read or write.
Called when this thread is no longer referencing anything from this container.
ctx | Execution context. |
Swap this container with another.
other | The container with which to swap. |
This will also call swap on the Updater object; hence, the Updater object must also support swap. The Hasher and Matcher instances are NOT swapped.
This operation is NOT thread-safe. No other threads may be accessing either container during this operation.
Access the Updater instance.
Convert an underlying key value to this type's key value.
val | The underlying key value. |
Convert this type's key value to an underlying key value.
k | The key. |
Convert an underlying mapped value to this type's mapped value.
val | The underlying mapped value. |
Convert this type's mapped value to an underlying mapped value.
val | The mapped value. |
Do a lookup in the table.
key | The key to look up. |
Returns an iterator of the underlying map pointing at the found entry or end();
Insert / overwrite an entry in the table.
key | The key of the new item to add. |
val | The value of the new item to add. |
overwrite | If true, allow overwriting an existing entry. |
ctx | Execution context. |
The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Insert / overwrite an entry in the table, with external locking.
lock | The lock object returned from lock(). |
key | The key of the new item to add. |
val | The value of the new item to add. |
overwrite | If true, allow overwriting an existing entry. |
ctx | Execution context. |
The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
The underlying hash table.
Definition at line 94 of file ConcurrentMap.h.
CxxUtils::ATH_REQUIRES | ( | detail::IsConcurrentHashmapPayload< KEY > &&detail::IsUpdater< UPDATER > &&detail::IsHash< HASHER, KEY > &&detail::IsBinaryPredicate< MATCHER, KEY > | ) |
Hash map from pointers/integers to arbitrary objects allowing concurrent, lockless reads.
This class implements a hash map, using keys that may be pointers or any integer type that can fit in an uintptr_t. The mapped type is arbitrary. It allows for concurrent access from many threads. Reads can proceed without taking out a lock, while writes are serialized with each other. Thus, this is appropriate for maps which are read-mostly.
This class includes non-const references that can be used to obtain non-const references to the mapped objects. Howeer, the mapped objects must themselves the thread-safe in order to safely modify them in a multithreaded context.
This is based on ConcurrentHashmapImpl.
Besides the key and mapped value types, this class is templated on an UPDATER class, which is used to manage the underlying memory. See IsUpdater.h for details. (AthenaKernel/RCUUpdater is a concrete version that should work in the context of Athena.)
The operations used for calculating the hash of the keys and comparing keys can be customized with the HASHER and MATCHER template arguments (though the defaults should usually be fine).
One value of the key must be reserved as a null value, which no real keys may take. By default this is ‘0’, but it may be customized with the NULLVAL template argument. Note that the type of the NULLPTR template argument is a uintptr_t, not KEY.
This mostly supports the interface of std::unordered_map, with a few differences / omissions:
The mapped value can be given as any of:
I.e., any of these should work:
Representation type in the underlying map.
The underlying uint->uint hash table.
Standard STL types.
Updater object.
Context type.
Constructor.
updater | Object used to manage memory (see comments at the start of the class). |
capacity | The initial table capacity. (Will be rounded up to a power of two.) |
ctx | Execution context. |
Constructor from another map.
updater | Object used to manage memory (see comments at the start of the class). |
capacity | The initial table capacity of the new table. (Will be rounded up to a power of two.) |
ctx | Execution context. |
(Not really a copy constructor since we need to pass updater
.)
Constructor from a range.
f | Start iterator for the range. |
l | End iterator for the range. |
updater | Object used to manage memory (see comments at the start of the class). |
capacity | The initial table capacity of the new table. (Will be rounded up to a power of two.) |
ctx | Execution context. |
Constructor from a range of pairs.
Copy / move / assign not supported.
Destructor.
Return the number of items currently in the map.
Test if the map is currently empty.
Return the current size (capacity) of the hash table.
Value structures for iterators.
For a map from K to V, a STL-style iterator should dereference to a std::pair<const K, V>. However, we don't actually store an object like that anywhere. In order to be able to have STL-like iterators, we instead use a pair where the second element is a const reference to the mapped value. We will return this by value when we deference an iterator. (The compiler should be able to optimize out the redundant packing and unpacking of fields.)
Const iterator class.
This uses boost::iterator_facade to define the methods required by an STL iterator in terms of the private methods below.
Since dereference() will be returning a const_iterator_value by value, we also need to override the reference type.
Constructor.
it | Iterator of the underlying table. |
Conversion from non-const iterator (for interoperability).
other | The other iterator. |
Test if this iterator is valid.
This should be the same as testing for != end().
Required by iterator_facade.
iterator_facade requirement: Increment the iterator.
iterator_facade requirement: Decrement the iterator.
iterator_facade requirement: Equality test.
iterator_facade requirement: Equality test. (Interoperability.)
iterator_facade requirement: Dereference the iterator.
The iterator on the underlying table.
Iterator class.
This uses boost::iterator_facade to define the methods required by an STL iterator in terms of the private methods below.
Since dereference() will be returning a iterator_value by value, we also need to override the reference type.
From this, we can get a non-const reference to the mapped object. The mapped object must be thread-safe itself in order to safely make any changes to it.
Constructor.
it | Iterator of the underlying table. |
Test if this iterator is valid.
This should be the same as testing for != end().
Required by iterator_facade.
iterator_facade requirement: Increment the iterator.
iterator_facade requirement: Decrement the iterator.
iterator_facade requirement: Equality test.
iterator_facade requirement: Equality test. (Interoperability.)
iterator_facade requirement: Dereference the iterator.
The iterator on the underlying table.
A range defined by two iterators.
Return an iterator range covering the entire map.
Return an iterator range covering the entire map.
The mapped objects must themselves be thread-safe in order to make any changes to them through the returned iterators.
Iterator at the start of the map.
Iterator at the end of the map.
Iterator at the start of the map.
The mapped objects must themselves be thread-safe in order to make any changes to them through the returned iterators.
Iterator at the end of the map.
The mapped objects must themselves be thread-safe in order to make any changes to them through the returned iterators.
Iterator at the start of the map.
Iterator at the end of the map.
Test if a key is in the container.
key | The key to test. |
Return the number of times a given key is in the container.
key | The key to test. |
Returns either 0 or 1, depending on whether or not the key is in the map.
Look up an element in the map.
key | The element to find. |
Returns either an iterator referencing the found element or end().
Look up an element in the map.
key | The element to find. |
Returns either an iterator referencing the found element or end().
The mapped object must itself be thread-safe in order to make any changes to it through the returned iterator.
Look up an element in the map.
key | The element to find. |
Returns the value associated with the key. Throws std::out_of_range
if the key does not exist in the map.
Look up an element in the map.
key | The element to find. |
Returns the value associated with the key. Throws std::out_of_range
if the key does not exist in the map.
This returns a non-const reference to the mapped object. The mapped object must be thread-safe itself in order to safely make any changes to it.
Return a range of iterators with entries matching key
.
key | The element to find. |
As keys are unique in this container, this is either a single-element range, or both iterators are equal to end().
Return a range of iterators with entries matching key
.
key | The element to find. |
As keys are unique in this container, this is either a single-element range, or both iterators are equal to end().
The mapped objects must themselves be thread-safe in order to make any changes to them through the returned iterators.
Add an element to the map.
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map.
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map.
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map.
p | The item to add. Should be a pair where first is the string key and second is the integer value. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map.
p | The item to add. Should be a pair where first is the string key and second is the integer value. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Insert a range of elements to the map.
first | Start of the range. |
last | End of the range. |
ctx | Execution context. |
The range should be a sequence of pairs where first is the string key and second is the integer value.
Increase the table capacity.
capacity | The new table capacity. |
ctx | Execution context. |
No action will be taken if capacity
is smaller than the current capacity.
Increase the table capacity.
capacity | The new table capacity. |
No action will be taken if capacity
is smaller than the current capacity.
Called when this thread is no longer referencing anything from this container.
ctx | Execution context. |
Swap this container with another.
other | The container with which to swap. |
This will also call swap on the Updater object; hence, the Updater object must also support swap.
This operation is NOT thread-safe. No other threads may be accessing either container during this operation.
Access the Updater instance.
Convert an underlying key value to this type's key value.
val | The underlying key value. |
Convert this type's key value to an underlying key value.
k | The key. |
Convert an underlying mapped value a pointer to this type's mapped value.
val | The underlying mapped value. |
Convert this type's mapped value to an underlying mapped value.
val | The mapped value. |
Do a lookup in the table.
key | The key to look up. |
Returns an iterator of the underlying map pointing at the found entry or end();
Insert an entry in the table.
key | The key of the new item to add. |
val | The new mapped value to add. |
ctx | Execution context. |
The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
The underlying hash table.
Definition at line 98 of file ConcurrentToValMap.h.
CxxUtils::ATH_REQUIRES | ( | detail::IsConcurrentHashmapPayload< VALUE > &&detail::IsUpdater< UPDATER > | ) |
Hash map from strings allowing concurrent, lockless reads.
This class implements a hash map from strings. The mapped type may be a pointer or any numeric type that can fit in a uintptr_t. It allows for concurrent access from many threads. Reads can proceed without taking out a lock, while writes are serialized with each other. Thus, this is appropriate for maps which are read-mostly.
This is based on ConcurrentHashmapImpl.
Besides the mapped value type, this class is templated on an UPDATER class, which is used to manage the underlying memory. See IsUpdater.h for details. (AthenaKernel/RCUUpdater is a concrete version that should work in the context of Athena.)
This mostly supports the interface of std::unordered_map, with a few differences / omissions:
Possible improvements:
The underlying uint->uint hash table.
Representation type in the underlying map.
Standard STL types.
Updater object.
Context type.
Type for external locking.
Ensure that the underlying map can store our mapped_type.
Constructor.
updater | Object used to manage memory (see comments at the start of the class). |
capacity | The initial table capacity. (Will be rounded up to a power of two.) |
ctx | Execution context. |
Constructor from another map.
updater | Object used to manage memory (see comments at the start of the class). |
capacity | The initial table capacity of the new table. (Will be rounded up to a power of two.) |
ctx | Execution context. |
(Not really a copy constructor since we need to pass updater
.)
Constructor from a range.
f | Start iterator for the range. |
l | End iterator for the range. |
updater | Object used to manage memory (see comments at the start of the class). |
capacity | The initial table capacity of the new table. (Will be rounded up to a power of two.) |
ctx | Execution context. |
Constructor from a range of pairs.
Copy / move / assign not supported.
Destructor.
Return the number of items currently in the map.
Test if the map is currently empty.
Return the current size (capacity) of the hash table.
Value structure for iterators.
For a map from K to V, a STL-style iterator should dereference to a std::pair<const K, V>. However, we don't actually store an object like that anywhere. In order to be able to have STL-like iterators, we instead use a pair where the first element is a const reference to the std::string key. We will return this by value when we deference an iterator. (The compiler should be able to optimize out the redundant packing and unpacking of fields.)
Iterator class.
This uses boost::iterator_facade to define the methods required by an STL iterator in terms of the private methods below.
Since dereference() will be returning a const_iterator_value by value, we also need to override the reference type.
Constructor.
it | Iterator of the underlying table. |
Test if this iterator is valid.
This should be the same as testing for != end().
Required by iterator_facade.
iterator_facade requirement: Increment the iterator.
iterator_facade requirement: Decrement the iterator.
iterator_facade requirement: Equality test.
iterator_facade requirement: Dereference the iterator.
The iterator on the underlying table.
A range defined by two iterators.
Return an iterator range covering the entire map.
Iterator at the start of the map.
Iterator at the end of the map.
Iterator at the start of the map.
Iterator at the end of the map.
Test if a key is in the container.
key | The key to test. |
Return the number of times a given key is in the container.
key | The key to test. |
Returns either 0 or 1, depending on whether or not the key is in the map.
Look up an element in the map.
key | The element to find. |
Returns either an iterator referencing the found element or end().
Look up an element in the map.
key | The element to find. |
Returns the value associated with the key. Throws std::out_of_range
if the key does not exist in the map.
Return a range of iterators with entries matching key
.
key | The element to find. |
As keys are unique in this container, this is either a single-element range, or both iterators are equal to end().
Take a lock on the container.
Take a lock on the container. The lock can then be passed to insertion methods, allowing to factor out the locking inside loops. The lock will be released when the lock object is destroyed.
Add an element to the map.
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map, with external locking.
lock | The lock object returned from lock(). |
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map.
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map, with external locking.
lock | The lock object returned from lock(). |
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map, or overwrite an existing one.
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map, or overwrite an existing one, with external locking.
lock | The lock object returned from lock(). |
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map, or overwrite an existing one.
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map, or overwrite an existing one, with external locking.
lock | The lock object returned from lock(). |
key | The key of the new item to add. |
val | The value of the new item to add. |
ctx | Execution context. |
This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Add an element to the map.
p | The item to add. Should be a pair where first is the string key and second is the integer value. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
For external locking, use emplace().
Add an element to the map.
p | The item to add. Should be a pair where first is the string key and second is the integer value. |
ctx | Execution context. |
This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Insert a range of elements to the map.
first | Start of the range. |
last | End of the range. |
ctx | Execution context. |
The range should be a sequence of pairs where first is the string key and second is the integer value.
Increase the table capacity.
capacity | The new table capacity. |
ctx | Execution context. |
No action will be taken if capacity
is smaller than the current capacity.
Increase the table capacity.
capacity | The new table capacity. |
No action will be taken if capacity
is smaller than the current capacity.
Called when this thread is no longer referencing anything from this container.
ctx | Execution context. |
Swap this container with another.
other | The container with which to swap. |
This will also call swap on the Updater object; hence, the Updater object must also support swap.
This operation is NOT thread-safe. No other threads may be accessing either container during this operation.
Access the Updater instance.
Convert an underlying key value to a string pointer.
val | The underlying key value. |
Convert a string pointer to an underlying key value.
s | The string pointer. |
Convert an underlying mapped value to this type's mapped value.
val | The underlying mapped value. |
Convert this type's mapped value to an underlying mapped value.
val | The mapped value. |
Do a lookup in the table.
key | The key to look up. |
Returns an iterator of the underlying map pointing at the found entry or end();
Insert / overwrite an entry in the table.
key | The key of the new item to add. |
val | The value of the new item to add. |
overwrite | If true, allow overwriting an existing entry. |
ctx | Execution context. |
The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Insert / overwrite an entry in the table, with external locking.
lock | The lock object returned from lock(). |
val | The value of the new item to add. |
overwrite | If true, allow overwriting an existing entry. |
ctx | Execution context. |
The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.
Hash functional for keys.
The key can be either a std::string or the representation type used by the underlying map.
Hash function from the underlying representation type.
Hash function from a std::string.
Hash functional.
Matching functional for keys.
Compare two keys (as the underlying representation type) for equality.
The underlying hash table.
Definition at line 75 of file ConcurrentStrMap.h.
CxxUtils::ATH_REQUIRES | ( | detail::IsUpdater< UPDATER > &&detail::IsConcurrentRangeCompare< COMPARE, RANGE, KEY, typename UPDATER< int >::Context_t > | ) |
Map from range to payload object, allowing concurrent, lockless reads.
This class implements a map of sorted ‘range’ objects (though only a single value is actually used) to allocated payload objects. Values can be looked up by a key; the value returned will be the first for which the range is not less than the key. We also support insertions, erasures, and iteration.
The only thing we need to do with the contained pointers is to delete them. Rather than doing that directly, we take a deletion object as an argument to the constructor. This allows one to instantiate this template with void
as T
, to reduce the amount of generated code. The emplace
method takes a unique_ptr
as an argument. We define payload_unique_ptr
which is a unique_ptr
to T
that does deletion by calling an arbitrary function. payload_unique_ptr
may be initialized from a unique_ptr
; to construct one directly, the deletion function should be passed as a second argument to the payload_unique_ptr
constructor.
There can be only one writer at a time; this is enforced with internal locks. However, there can be any number of concurrent readers at any time. The reads are lockless (but not necessarily waitless, though this should not be significant in practice). So this is appropriate when reads are much more frequent than writes.
This implementation also assumes that a lookup is most likely to be for the last element in the map, that insertions are most likely to be at the end, and that erasures are most likely to be from the beginning. This class will still work if these assumptions are violated, but it may be much slower. (The use case for which this was targeted was that of conditions containers.)
Template arguments: RANGE - The type of the range object stored with each element. KEY - The type used to look up objects in the container. This may be same as RANGE, but not necessarily. (For example, RANGE may contain start and end times, while KEY may be a single time.) COMPARE - Object used for key comparisons; see below. UPDATER - Object used for memory management; see below.
COMPARE should implement a less-than relation, like a typical STL comparison object, with these signatures:
In order to implement updating concurrently with reading, we need to defer deletion of objects until no thread can be referencing them any more. The policy for this for the internal implementation objects is set by the template UPDATER<T>. For details, see IsUpdater.h.
Deletion of payload objects is managed via the IRangeMapPayloadDeleter
object passed to the constructor.
Implementation notes: The values we store are pairs of RANGE, const T*. The data are stored in a vector of such values. We maintain atomic pointers to the first and last valid elements in the map. We can quickly add an element to the end or delete an element from the beginning by adjusting these pointers. Any other changes will require making a new copy of the data vector.
Function to delete a T*
unique_ptr
deletion class for a payload object.
We can't use the unique_ptr default because we want to allow instantiating with a void
.
Initialize with an explicit deletion function.
Allow initializing a payload_unique_ptr
from a std::unique_ptr<U>
.
Delete a pointer.
The deletion function.
unique_ptr
holding a payload object.
One may initialize an instance of this in one of two ways. First, from another std::unique_ptr:
where U* must be convertible to T*. In this case, the pointer will be deleted as a U*. Second, one can supply an explicit deletion function:
Holds one version of the map.
This object holds one version of the map. Within a single version, we can add elements to the end or remove elements from the beginning. If we need to make other changes, or to expand the map, we must make a new version and copy the contents. The UPDATER object is then used to install the new version; old versions should be kept until they are no longer referenced by any thread.
Constructor.
capacity | Size of the data vector to allocate. |
Destructor.
Return a pointer to the start of the data vector.
Return the size of the current data vector.
Vector holding the map data.
Constructor.
updater | Object used to manage memory (see comments at the start of the class). |
payloadDeleter | Object for deleting payload objects. This is owned via a shared_ptr . |
capacity | Initial capacity of the map. |
compare | Comparison object. |
Destructor.
Clean up any remaining payload objects.
Return a reference to the payload deleter object.
Return a reference to the payload deleter object.
Search for the first item less than or equal to KEY.
key | The key to search for. |
Results returned from emplace().
All ok.
New object was added, but overlaps with an existing range.
New object duplicates an existing range, and was not added.
Add a new element to the map.
range | Validity range for this element. |
ptr | Payload for this element. |
tryExtend | If true, then allow an existing range to be extended (see below). |
ctx | Execution context. |
Returns SUCCESS if the new element was successfully inserted. Returns DUPLICATE if the range compared equal to an existing one. In that case, no new element is inserted (and ptr
gets deleted). Returns EXTEND if the range of the last element was extended to range
. This happens if tryExtend
is true, range
is equal to the range of the last element (according to m_compare
), and the range can be extended according to extendRange
. (This will generally mean that the start time of range
matches the last range, and end time of range
is after the end time of the last range.) In this case, again no new element is inserted and ptr
is deleted. Returns OVERLAP if the range of the new element overlaps an existing element (the new element is still inserted).
Erase the first item less than or equal to KEY.
key | The key to search erase. |
ctx | Execution context. |
Extend the range of the last entry of the map.
newRange | New range to use for the last entry. |
ctx | Execution context. |
The range of the last entry in the map is updated to newRange
. Does nothing if the map is empty. This will make a new version of implementation data.
The semantics of what it means to extend a range are given by the extendRange
method of the COMPARE
object (see above).
Returns -1 if there was an error; 1 if the last range was extended; and 0 if nothing was changed.
Update all range objects.
rangeUpdater | Functional to call on each range object. |
ctx | Execution context. |
This will iterate through the list of entries and call rangeUpdater
on the RANGE
part of each. Be careful: rangeUpdater must not change any part of the range which might affect the sorting of entries.
Remove unused entries from the front of the list.
keys | List of keys that may still be in use. (Must be sorted.) |
trimall | If true, then allow removing all elements in the container. Otherwise, stop when there's one left. |
We examine the objects in the container, starting with the earliest one. If none of the keys in keys
match the range for this object, then it is removed from the container. We stop when we either find an object with a range matching a key in keys
or (if trimall is false) when there is only one object left.
The list keys
MUST be sorted.
Removed objects are queued for deletion once all slots have been marked as quiescent.
Returns the number of objects that were removed.
Remove all entries in the container. Mostly for testing — should not normally be used.
Return the current number of elements in the map.
Test if the map is empty.
Return the current capacity of the map.
Return the number times an item was inserted into the map.
Return the maximum size of the map.
Return a range that can be used to iterate over the container.
Called when this thread is no longer referencing anything from this container.
ctx | Execution context. |
Type of the mutex for this container.
Return the begin/last pointers.
[in,out] | last | Current value of last. |
Retrieve consistent values of the begin and last pointers. The last pointer should have already been fetched, and may be updated. Usage should be like this:
Consistently update both the begin and last pointers.
begin | New begin pointer. |
end | New end pointer. |
Test to see if any keys within keys
match r
. r Range to test. @break keys List of keys to test. MUST be sorted.
Install a new implementation instance and make it visible.
new_impl | The new instance. |
new_begin | Begin pointer for the new instance. |
new_end | End pointer for the new instance. (Usual STL meaning of end. If the instance is empty, then new_end should match new_begin.) |
ctx | Execution context. |
Extend the range of the last entry of the map.
Lock | object. |
extendedRange | New range to use for the last entry. |
ctx | Execution context. |
Implementation of extendLastRange
; see there for details. Must be called with the lock held.
Updater object. This maintains ownership of the current implementation class and the older versions.
Comparison object.
Payload deleter object. Important: do not discard an object while it's still reachable from the m_begin / m_last range — update the pointers first. Otherwise, the object may be deleted while another thread is still referencing it: thread 1: Discard object. Sets grace mask for both slots. thread 2: Call quiescent(). Clears grace mask for 2. Retrieve the discarded object. thread 1: Adjust pointers. Call quiescent. The discarded object may be deleted at this point while thread 2 is still reading it.
Current version of the implementation class.
Pointers to the first and last elements of the container. m_last is not the usual end pointer; it points at the last element in the container. If the container is empty, then m_last will be null. If these are to both be updated together, it should be done in this order. First, m_begin should be set to null. This marks that there's an update in progress. Then m_last should be set, followed by m_begin. To read both pointers, we first fetch m_last. Then fetch m_begin. Then check that both m_begin is non-null and the previous value we fetched for last matches what's now in m_last. If either condition fails, then re-fetch both pointers.
Some basic statistics.
Mutex protecting the container.
Definition at line 217 of file ConcurrentRangeMap.h.
CxxUtils::ATH_REQUIRES | ( | std::input_iterator< InputIterator > &&std::output_iterator< OutputIterator, typename std::iterator_traits< InputIterator >::value_type > | ) |
Copy a range with bounds restriction.
begi | Start of input range. |
endi | End of input range. |
bego | Start of output range. |
endo | End of output range. |
Like std::copy(begi, endi, bego), except that it will not copy more than std::distance(bego, endo) elements.
Copies exactly n = std::min (std::distance(begi,endi), std::distance(bego,endo)) elements. Returns bego + n.
double CxxUtils::atof | ( | std::string_view | str | ) |
Converts a string into a double / float.
Definition at line 91 of file Control/CxxUtils/Root/StringUtils.cxx.
int CxxUtils::atoi | ( | std::string_view | str | ) |
Helper functions to unpack numbers decoded in string into integers and doubles The strings are required to contain only digits, a floating point dot, the signs +- or a whitespace Exceptions are thrown otherwise.
Converts a string into an integer
Definition at line 85 of file Control/CxxUtils/Root/StringUtils.cxx.
|
inline |
Atomically decrement a value with a lower bound.
a | Pointer to the atomic value. |
bound | Lower bound for a. |
decr | The amount by which to decrement. |
memorder | Memory ordering. |
Atomically decrement A by DECR, provided the result is not less than BOUND. I.e., the atomic equivalent of:
Returns in any case the original value of the atomic variable.
Definition at line 41 of file atomic_bounded_decrement.h.
|
inline |
Atomically calculate maximum.
a | Pointer to the atomic value. |
v | The other value. |
memorder | Memory ordering. |
Computes max(*a, v) and stores it in *a. Returns the original value of *a.
Definition at line 42 of file atomic_fetch_minmax.h.
|
inline |
Atomically calculate minimum.
a | Pointer to the atomic value. |
v | The other value. |
memorder | Memory ordering. |
Computes min(*a, v) and stores it in *a. Returns the original value of *a.
Definition at line 63 of file atomic_fetch_minmax.h.
std::vector< unsigned char > CxxUtils::base64_decode | ( | const std::string & | encoded_string | ) |
Definition at line 97 of file base64.cxx.
std::string CxxUtils::base64_encode | ( | const unsigned char * | bytes_to_encode, |
unsigned int | in_len | ||
) |
Definition at line 55 of file base64.cxx.
auto CxxUtils::begin | ( | const range_with_at< T > & | s | ) |
Definition at line 66 of file range_with_at.h.
auto CxxUtils::begin | ( | const range_with_conv< T > & | s | ) |
Definition at line 64 of file range_with_conv.h.
auto CxxUtils::begin | ( | range_with_at< T > & | s | ) |
Definition at line 64 of file range_with_at.h.
auto CxxUtils::begin | ( | range_with_conv< T > & | s | ) |
Definition at line 62 of file range_with_conv.h.
auto CxxUtils::begin | ( | span< T > & | s | ) |
std::string CxxUtils::clean_allocator | ( | std::string | f | ) |
Clean ‘allocator’ template arguments from the function f.
f | Name of the function to clean. |
Definition at line 24 of file normalizeFunctionName.cxx.
void CxxUtils::convertToNumber | ( | std::string_view | str, |
dType & | number | ||
) |
Allow for trailing & leading white spaces
To avoid infinite recursion because of string like '42 24' check that white spaces have been indeed removed
Definition at line 65 of file Control/CxxUtils/Root/StringUtils.cxx.
|
inline |
Copy a range with bounds restriction.
input | Input range |
output | Output range |
copy_bounded written in terms of iterator ranges.
We have this as a distinct overload in order to be able to pass a CxxUtils::span temporary as the second argument.
Definition at line 124 of file copy_bounded.h.
|
inline |
Copy a range with bounds restriction.
input | Input range |
output | Output range |
copy_bounded written in terms of iterator ranges.
Definition at line 102 of file copy_bounded.h.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
uint64_t CxxUtils::crc64 | ( | const char * | data, |
size_t | data_len | ||
) |
Find the CRC-64 of a string, with the default CRC.
data | Pointer to the string to hash. |
data_len | Length of the string to hash, in bytes. |
Find the CRC-64 of a string,.
table | Precomputed CRC tables and constants. |
data | Pointer to the string to hash. |
data_len | Length of the string to hash, in bytes. |
This is the default implementation, used on platforms without pclmul.
uint64_t CxxUtils::crc64 | ( | const std::string & | s | ) |
uint64_t CxxUtils::crc64_bytewise | ( | const char * | data, |
size_t | data_len | ||
) |
Find the CRC-64 of a string, using a byte-by-byte algorithm, with the default CRC.
table | Precomputed CRC tables and constants. |
data | Pointer to the string to hash. |
data_len | Length of the string to hash, in bytes. |
Find the CRC-64 of a string, using a byte-by-byte algorithm.
table | Precomputed CRC tables and constants. |
data | Pointer to the string to hash. |
data_len | Length of the string to hash, in bytes. |
uint64_t CxxUtils::crc64_bytewise | ( | const std::string & | s | ) |
Find the CRC-64 of a string, using a byte-by-byte algorithm, with the default CRC.
table | Precomputed CRC tables and constants. |
s | String to hash. |
uint64_t CxxUtils::crc64addint | ( | uint64_t | crc, |
uint64_t | x | ||
) |
std::string CxxUtils::crc64digest | ( | const std::string & | str | ) |
Return a CRC-64 digest of a string.
str | The string to hash. |
std::string CxxUtils::crc64format | ( | uint64_t | crc | ) |
void CxxUtils::deleteCRCTable | ( | CxxUtils::CRCTable * | table | ) |
|
inline |
Return difference phiA - phiB in range [-pi, pi].
Definition at line 42 of file phihelper.h.
auto CxxUtils::end | ( | const range_with_at< T > & | s | ) |
Definition at line 70 of file range_with_at.h.
auto CxxUtils::end | ( | const range_with_conv< T > & | s | ) |
Definition at line 68 of file range_with_conv.h.
auto CxxUtils::end | ( | range_with_at< T > & | s | ) |
Definition at line 68 of file range_with_at.h.
auto CxxUtils::end | ( | range_with_conv< T > & | s | ) |
Definition at line 66 of file range_with_conv.h.
auto CxxUtils::end | ( | span< T > & | s | ) |
std::string_view CxxUtils::eraseWhiteSpaces | ( | std::string_view | str | ) |
Removes all trailing and starting whitespaces from a string.
Definition at line 44 of file Control/CxxUtils/Root/StringUtils.cxx.
void CxxUtils::exctrace | ( | const std::exception & | e, |
IOFD | fd = IOFD_INVALID |
||
) |
Print out information for the last exception.
Prints the supplied exception, plus the backtrace from the last exception, if available.
e | The exception to print. |
fd | The file descriptor to which to write. |
Definition at line 59 of file exctrace.cxx.
void CxxUtils::fromArrayrep | ( | const CaloRec::Arrayrep & | rep, |
CxxUtils::Array< N > & | x | ||
) |
void CxxUtils::fromArrayrep | ( | const CaloRec::Arrayrep & | rep, |
T & | x | ||
) |
Helper to convert from an @x Arrayrep to a scalar type.
rep | Representation object to convert. |
x[out] | Result of the conversion. |
T CxxUtils::get_unaligned | ( | const uint8_t *ATH_RESTRICT & | p | ) |
Define templated versions of the above functions.
|
inline |
Read a 2-byte little-endian value from a possibly unaligned pointer.
p | Pointer from which to read. Advanced to the next value. |
Reads a little-endian value, regardless of the host byte ordering, and advances the pointer. Should not rely on undefined behavior, regardless of the alignment of p
.
If used in a loop, you'll get better code with a restricted pointer.
Definition at line 62 of file get_unaligned.h.
|
inline |
Read a 4-byte little-endian value from a possibly unaligned pointer.
p | Pointer from which to read. Advanced to the next value. |
Reads a little-endian value, regardless of the host byte ordering, and advances the pointer. Should not rely on undefined behavior, regardless of the alignment of p
.
If used in a loop, you'll get better code with a restricted pointer.
Definition at line 82 of file get_unaligned.h.
|
inline |
Read a 8-byte little-endian value from a possibly unaligned pointer.
p | Pointer from which to read. Advanced to the next value. |
Reads a little-endian value, regardless of the host byte ordering, and advances the pointer. Should not rely on undefined behavior, regardless of the alignment of p
.
If used in a loop, you'll get better code with a restricted pointer.
Definition at line 102 of file get_unaligned.h.
|
inline |
Definition at line 204 of file get_unaligned.h.
|
inline |
Definition at line 196 of file get_unaligned.h.
|
inline |
Definition at line 220 of file get_unaligned.h.
|
inline |
Definition at line 228 of file get_unaligned.h.
|
inline |
Definition at line 236 of file get_unaligned.h.
|
inline |
Definition at line 212 of file get_unaligned.h.
|
inline |
Definition at line 172 of file get_unaligned.h.
|
inline |
Definition at line 180 of file get_unaligned.h.
|
inline |
Definition at line 188 of file get_unaligned.h.
|
inline |
Definition at line 164 of file get_unaligned.h.
|
inline |
Read little-endian float value from a possibly unaligned pointer.
p | Pointer from which to read. Advanced to the next value. |
Reads a little-endian value, regardless of the host byte ordering, and advances the pointer. Should not rely on undefined behavior, regardless of the alignment of p
.
If used in a loop, you'll get better code with a restricted pointer.
Definition at line 144 of file get_unaligned.h.
|
inline |
Read little-endian float value from a possibly unaligned pointer.
p | Pointer from which to read. Advanced to the next value. |
Reads a little-endian value, regardless of the host byte ordering, and advances the pointer. Should not rely on undefined behavior, regardless of the alignment of p
.
If used in a loop, you'll get better code with a restricted pointer.
Definition at line 122 of file get_unaligned.h.
void CxxUtils::hexdump | ( | std::ostream & | s, |
const void * | addr, | ||
size_t | n, | ||
size_t | offset = 0 |
||
) |
Make a hex dump of memory.
s | Stream to which to write the output. |
addr | Address at which to start dumping. |
n | Number of byte to dump. |
offset | Offset by which to shift the printed address (mostly for testing). |
Definition at line 37 of file hexdump.cxx.
|
inline |
Definition at line 41 of file get_unaligned.h.
|
inline |
Definition at line 42 of file get_unaligned.h.
|
inline |
Definition at line 43 of file get_unaligned.h.
auto CxxUtils::make_reverse_wrapper | ( | T & | r | ) |
Make a reverse_wrapper
for a given container-like object.
Definition at line 46 of file reverse_wrapper.h.
auto CxxUtils::make_span | ( | CONTAINER & | c | ) |
Helper to make a span from a container.
c | The container for which to make a span. It must have contiguous iterators. |
std::unique_ptr< CRCTable > CxxUtils::makeCRCTable | ( | uint64_t | p, |
uint64_t | initial = 0xffffffffffffffff |
||
) |
|
constexpr |
std::string CxxUtils::munge_names | ( | const std::string & | str_in | ) |
Definition at line 106 of file normalizeFunctionName.cxx.
std::string CxxUtils::munge_punct | ( | const std::string & | str_in | ) |
std::string CxxUtils::munge_string_name | ( | const std::string & | str_in | ) |
Definition at line 54 of file normalizeFunctionName.cxx.
uint32_t CxxUtils::MurmurHash2 | ( | const void * | key, |
int | len, | ||
uint32_t | seed | ||
) |
Definition at line 42 of file MurmurHash2.cxx.
uint32_t CxxUtils::MurmurHash2A | ( | const void * | key, |
int | len, | ||
uint32_t | seed | ||
) |
Definition at line 220 of file MurmurHash2.cxx.
uint64_t CxxUtils::MurmurHash64A | ( | const void * | key, |
int | len, | ||
uint64_t | seed | ||
) |
Definition at line 103 of file MurmurHash2.cxx.
uint64_t CxxUtils::MurmurHash64B | ( | const void * | key, |
int | len, | ||
uint64_t | seed | ||
) |
Definition at line 155 of file MurmurHash2.cxx.
uint32_t CxxUtils::MurmurHashAligned2 | ( | const void * | key, |
int | len, | ||
uint32_t | seed | ||
) |
Definition at line 324 of file MurmurHash2.cxx.
uint32_t CxxUtils::MurmurHashNeutral2 | ( | const void * | key, |
int | len, | ||
uint32_t | seed | ||
) |
Definition at line 267 of file MurmurHash2.cxx.
std::string CxxUtils::normalizeFunctionName | ( | const std::string & | fname | ) |
Normalize a pretty-printed C++ function name.
fname | The name to normalize. |
A C++ compiler can provide a complete printable name of the current function, though for example PRETTY_FUNCTION. This is useful to include in diagnostic messages. However, the exact string generated by different compilers may differ slightly. This can then cause issues if one is trying to compare the output of tests to an expected reference.
This function tries to normalize the function name strings so that they are the same, at least between gcc and clang.
Definition at line 135 of file normalizeFunctionName.cxx.
|
inlineconstexpr |
std::ostream& CxxUtils::operator<< | ( | std::ostream & | s, |
const Array< N > & | a | ||
) |
|
inline |
Bisect (average) the angle spanned by phiA and phiB.
The average is calculated by rotating phiA half-way counter-clockwise onto phiB. Note that his method is not symmetric in its arguments. Typical use-cases are to determine the centre of a region in the detector.
The returned value is within the range [-pi, pi].
Definition at line 77 of file phihelper.h.
|
inline |
Calculate average of two angles.
The average is calculated as the angle of the sum of the two unit vectors with angles phiA and phiB. As such it always returns the angle in the narrower of the two complimentary regions spanned by phiA and phiB. If the vector sum is zero, return the angle within [-pi/2, pi/2]. This method is symmetric in its arguments except if |mean| equals pi.
The returned value is within the range [-pi, pi].
Definition at line 60 of file phihelper.h.
|
inline |
Prefetch an N-byte block of memory.
[in] | ptr | Starting address of the block. |
Definition at line 85 of file prefetch.h.
|
inline |
Prefetch next object in sequence.
iter | Current iteration position. |
endIter | End of the sequence. |
Iter
is a ForwardIterator
over pointers.
Prefetches next object in a collection of pointers. Accepts two iterators: the first iterator is the current iteration position, and the second iterator is the end iterator for the whole sequence. The first iterator must not be equal to the end iterator (this is not checked). This increments the iterator and, if not equal to the end, prefetches the complete object referenced by the pointer.
Definition at line 130 of file prefetch.h.
|
inline |
Generic prefetch of the object of specific types (sizes).
[in] | address | memory location to prefetch |
This method will prefetch as many cache lines as needed to store the object of the specified type in memory. Type is specified as a template argument.
Definition at line 108 of file prefetch.h.
|
inline |
Generic prefetch method.
[in] | address | memory location to prefetch |
This is generic method that does not have any extra behavior. It only prefetches the whole cache line which contains the specified memory location. It does not incur any additional overhead and may be the most efficient method for small objects which have a high chance of being on just a single cache line.
Definition at line 73 of file prefetch.h.
|
inline |
Prefetch two objects.
iter | Current iteration position. |
endIter | End of the sequence. |
Iter
is a ForwardIterator
over pointers.
Prefetches the current and next objects in a collection of pointers. Accepts two iterators: the first iterator is the current iteration position, and the second is the end iterator for the whole sequence. If the first iterator is not equal to end the iterator, the object to which it points is prefetched. Then the iterator is incremented and, if not equal to the end iterator, the next objects is also prefetched.
Definition at line 154 of file prefetch.h.
|
constexpr |
void CxxUtils::safeHexdump | ( | std::ostream & | s, |
const void * | addr, | ||
size_t | n, | ||
size_t | offset = 0 |
||
) |
Make a hex dump of memory, protected against bad reads.
s | Stream to which to write the output. |
addr | Address at which to start dumping. |
n | Number of byte to dump. |
offset | Offset by which to shift the printed address (mostly for testing). |
This function will skip dumping memory pages that are not readable. It may also start dumping slightly before the requested address, in order to start with an alignment of 16.
Definition at line 104 of file hexdump.cxx.
|
constexpr |
CxxUtils::span | ( | T * | beg, |
T * | end | ||
) | -> span< T > |
CxxUtils::span | ( | T * | ptr, |
std::size_t | sz | ||
) | -> span< T > |
A couple needed deduction guides.
|
inline |
Emit stall instruction for use in a spin loop.
For best performance of a spin loop (as used for a spinlock or other MT consistency operations), Intel recommends adding a ‘pause’ instruction within the loop on x86(_64) targets. This function provides a portable way of doing this.
Currently a no-op for anything other than x86(_64) + arm. Support for other architectures can be added if it is useful.
std::string CxxUtils::strformat | ( | const char * | fmt, |
... | |||
) |
return a std::string
according to a format fmt
and varargs
Definition at line 49 of file StrFormat.cxx.
|
constexpr |
Convenience function to test bits in a class enum bitmask.
lhs | Target bitmask. |
rhs | Bits to test. |
Same as (lhs & rhs) != 0. This function is enabled only for enumerators that have used the ATH_BITMASK
macro.
CONT CxxUtils::to | ( | RANGE && | r | ) |
std::vector< std::string > CxxUtils::tokenize | ( | const std::string & | the_str, |
std::string_view | delimiters | ||
) |
Splits the string into smaller substrings.
Definition at line 15 of file Control/CxxUtils/Root/StringUtils.cxx.
std::vector< double > CxxUtils::tokenizeDouble | ( | const std::string & | the_str, |
std::string_view | delimiter | ||
) |
Definition at line 34 of file Control/CxxUtils/Root/StringUtils.cxx.
std::vector< int > CxxUtils::tokenizeInt | ( | const std::string & | the_str, |
std::string_view | delimiter | ||
) |
Definition at line 55 of file Control/CxxUtils/Root/StringUtils.cxx.
void CxxUtils::ubsan_suppress | ( | void(*)() | func | ) |
Helper for suppressing ubsan warnings.
func | Function to call (may be a lambda). |
If ubsan is running, temporarily redirect stderr to /dev/null. Then call func
.
For example, we sometimes get a bogus ubsan warning from cling initialization. This can be suppressed by adding something like:
Definition at line 69 of file ubsan_suppress.cxx.
ATH_ALWAYS_INLINE bool CxxUtils::vall | ( | const VEC & | mask | ) |
ATH_ALWAYS_INLINE bool CxxUtils::vany | ( | const VEC & | mask | ) |
ATH_ALWAYS_INLINE void CxxUtils::vbroadcast | ( | VEC & | v, |
T | x | ||
) |
Copy a scalar to each element of a vectorized type.
ATH_ALWAYS_INLINE void CxxUtils::vconvert | ( | VEC1 & | dst, |
const VEC2 & | src | ||
) |
|
constexpr |
|
constexpr |
ATH_ALWAYS_INLINE void CxxUtils::vload | ( | VEC & | dst, |
vec_type_t< VEC > const * | src | ||
) |
ATH_ALWAYS_INLINE void CxxUtils::vmax | ( | VEC & | dst, |
const VEC & | a, | ||
const VEC & | b | ||
) |
ATH_ALWAYS_INLINE void CxxUtils::vmin | ( | VEC & | dst, |
const VEC & | a, | ||
const VEC & | b | ||
) |
ATH_ALWAYS_INLINE bool CxxUtils::vnone | ( | const VEC & | mask | ) |
ATH_ALWAYS_INLINE void CxxUtils::vpermute | ( | VEC1 & | dst, |
const VEC & | src | ||
) |
ATH_ALWAYS_INLINE void CxxUtils::vpermute2 | ( | VEC1 & | dst, |
const VEC & | src1, | ||
const VEC & | src2 | ||
) |
ATH_ALWAYS_INLINE void CxxUtils::vselect | ( | VEC & | dst, |
const VEC & | a, | ||
const VEC & | b, | ||
const vec_mask_type_t< VEC > & | mask | ||
) |
ATH_ALWAYS_INLINE void CxxUtils::vstore | ( | vec_type_t< VEC > * | dst, |
const VEC & | src | ||
) |
|
inline |
Wrap angle in radians to [-pi, pi].
Odd positive (negative) multiples of pi map to (-)pi.
Definition at line 24 of file phihelper.h.
InputIterator OutputIterator CxxUtils::bego |
Definition at line 83 of file copy_bounded.h.
|
inlineconstexpr |
InputIterator CxxUtils::endi |
Definition at line 82 of file copy_bounded.h.
InputIterator OutputIterator OutputIterator CxxUtils::endo |
Definition at line 83 of file copy_bounded.h.
concept CxxUtils::InputRangeOverT |