proxygen
folly::compression::instructions Namespace Reference

Classes

struct  Default
 
struct  Haswell
 
struct  Nehalem
 

Enumerations

enum  Type { Type::DEFAULT, Type::NEHALEM, Type::HASWELL }
 

Functions

Type detect ()
 
template<class F >
auto dispatch (Type type, F &&f) -> decltype(f(std::declval< Default >()))
 
template<class F >
auto dispatch (F &&f) -> decltype(f(std::declval< Default >()))
 

Enumeration Type Documentation

Function Documentation

Type folly::compression::instructions::detect ( )
inline

Definition at line 158 of file Instructions.h.

References DEFAULT, HASWELL, NEHALEM, folly::compression::instructions::Nehalem::supported(), folly::compression::instructions::Haswell::supported(), and type.

Referenced by dispatch().

158  {
159  const static Type type = [] {
160  if (instructions::Haswell::supported()) {
161  VLOG(2) << "Will use folly::compression::instructions::Haswell";
162  return Type::HASWELL;
163  } else if (instructions::Nehalem::supported()) {
164  VLOG(2) << "Will use folly::compression::instructions::Nehalem";
165  return Type::NEHALEM;
166  } else {
167  VLOG(2) << "Will use folly::compression::instructions::Default";
168  return Type::DEFAULT;
169  }
170  }();
171  return type;
172 }
PskType type
template<class F >
auto folly::compression::instructions::dispatch ( Type  type,
F &&  f 
) -> decltype(f(std::declval<Default>()))

Definition at line 175 of file Instructions.h.

References folly::assume_unreachable(), DEFAULT, f, HASWELL, NEHALEM, and type.

Referenced by dispatch(), folly::compression::dispatchInstructions(), folly::pushmi::strand_queue_base< E >::front(), folly::compression::instructionsOverride(), and folly::pushmi::time_source_queue_base< E, TP >::top().

175  {
176  switch (type) {
177  case Type::HASWELL:
178  return f(Haswell());
179  case Type::NEHALEM:
180  return f(Nehalem());
181  case Type::DEFAULT:
182  return f(Default());
183  }
184 
186 }
auto f
PskType type
template<class F >
auto folly::compression::instructions::dispatch ( F &&  f) -> decltype(f(std::declval<Default>()))

Definition at line 189 of file Instructions.h.

References detect(), dispatch(), and f.

189  {
190  return dispatch(detect(), std::forward<F>(f));
191 }
auto f
auto dispatch(F &&f) -> decltype(f(std::declval< Default >()))
Definition: Instructions.h:189