Skip to content

Latest commit

 

History

History
 
 

benchmark

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Benchmarks and Performance Classes

Benchmarks

  • The benchmarks provide code that exercises microcontroller performance.
  • Various efficiency aspects are emphasized such as integral and floating-point calculations, looping, branching, etc.
  • Each benchmark is implemented as a single callable function to be called from a scheduled task in the multitasking scheduler configuration.
  • Every benchmark file can also be compiled separately as a standalone C++11 project.
  • A benchmark digital I/O pin is toggled hi/lo at begin/end of the benchmark run providing for oscilloscope real-time measurement.
  • The benchmarks provide scalable, portable C++11 means for identifying the performance class of the microcontroller.

Benchmark details

  • app_benchmark_none.cpp via #define APP_BENCHMARK_TYPE_NONE is an empty benchmark with merely a Boolean function call returning true.
  • app_benchmark_complex.cpp via #define APP_BENCHMARK_TYPE_COMPLEX computes a floating-point complex-valued trigonometric sine function using the extended_complex::complex template class.
  • app_benchmark_crc.cpp via #define APP_BENCHMARK_TYPE_CRC calculates a 32-bit byte-oriented CRC result described in Sect. 6.1 of the book.
  • app_benchmark_fast_math.cpp via #define APP_BENCHMARK_TYPE_FAST_MATH calculates reduced, time-optimized floating-point elementary transcendental functions.
  • app_benchmark_filter.cpp via #define APP_BENCHMARK_TYPE_FILTER calculates an integral FIR filter sampling result.
  • app_benchmark_fixed_point.cpp via #define APP_BENCHMARK_TYPE_FIXED_POINT calculates the first derivative of an elementary function using the self-written fixed_point template class in Chap. 13 of the book.
  • app_benchmark_float.cpp via #define APP_BENCHMARK_TYPE_FLOAT implements the floating-point examples detailed in Sect. 12.4 of the book.
  • app_benchmark_wide_integer.cpp via #define APP_BENCHMARK_TYPE_WIDE_INTEGER performs 256-bit unsigned big integer calculations using the uintwide_t class.
  • app_benchmark_pi_spigot.cpp via #define APP_BENCHMARK_TYPE_PI_SPIGOT performs a pi calculation using a template-based spigot algorithm with calculation steps divided among the slices of the idle task.
  • app_benchmark_pi_spigot_single.cpp via #define APP_BENCHMARK_TYPE_PI_SPIGOT_SINGLE does the same pi calculation as above implemented as a single function call.
  • app_benchmark_hash.cpp via #define APP_BENCHMARK_TYPE_HASH computes a 160-bit hash checksum of a 3-character message.
  • app_benchmark_wide_decimal.cpp via #define APP_BENCHMARK_TYPE_WIDE_DECIMAL computes a 100 decimal digit square root using the decwide_t template class.
  • app_benchmark_trapezoid_integral.cpp via #define APP_BENCHMARK_TYPE_TRAPEZOID_INTEGRAL computes the numerical floating-point result of a Bessel function using a recursive trapezoid integration routine.
  • app_benchmark_pi_agm.cpp via #define APP_BENCHMARK_TYPE_PI_AGM computes 53 decimal digits of pi using a Gaus AGM method with the decwide_t template class having a so-called limb type of std::uint16_t.
  • app_benchmark_boost_math_cbrt_tgamma.cpp via #define APP_BENCHMARK_TYPE_BOOST_MATH_CBRT_TGAMMA uses Boost.Math to compute the cube root of various Gamma functions values, where we note that heavy-weight error-handling has been patched for bare metal builds with the file error_handling.hpp.
  • app_benchmark_cnl_scaled_integer.cpp via #define APP_BENCHMARK_TYPE_CNL_SCALED_INTEGER brings a small subset of the CNL Library onto the metal by exercising various elementary quadratic calculations with the fixed-point representations of cnl::scaled_integer.
  • app_benchmark_soft_double_h2f1.cpp via #define APP_BENCHMARK_TYPE_SOFT_DOUBLE_H2F1 calculates an decimal digit hypergeometric function value using a classic iterative rational approximation scheme. This calculation is also included as an example in the soft_double project.

Performance classes

Most of the benchmarks run on each supported target system. Experience with runs on the individual target systems reveal a wide range of microcontroller performance classes.

Consider, for instance, the APP_BENCHMARK_TYPE_PI_AGM benchmark. This program compute 53 decimal digits of the mathematical constant using a Gauss AGM method with help from the decwide_t template class.

The PDF image shows the real-time measurement of this benchmark on two of our target systems having vastly different performance classes: the 8-bit MICROCHIP(R) AVR controller of the Arduino and the 32-bit ARM(R) 8 controller of the BeagleBone Black Edition, Rev. C. The calculation requires approximately 470ms and 1.5ms, respectively, on these two microcontroller systems.