File realtime_test.cpp

Program: test the real time capabilities of a machine.

Author

Maximilien Naveau (maximilien.naveau@gmail.com) license License BSD-3-Clause

Copyright

Copyright (c) 2019, New York University and Max Planck Gesellschaft.

Date

2019-05-22

Functions

void *thread_function(void *v)

This is the real time thread that perform the check and the computations.

void print_usage()

Display the usage in case of a miss-use.

bool set_config(int nb_args, char **args, Configuration &config)

parse the input argument and configure which conputation should be done

void clean_memory()

Delete the shared memeory.

void stop(int)

stop the current thread.

This method is called throw a “ctrl+c”

int main(int nb_args, char **argv)

This program evaulate the quality of the frequency tracking by a real time thread.

Variables

static int MATRIX_COMPUTATION_NO_EIGEN_64 = 1

valid modes, creating subclasses of Computation to add new ones (see below)

std::atomic<bool> RUNNING

Is the thread running?

class Configuration

Configuration of the test thread.

Public Members

int mode

mode of the thread

double frequency

thread frequency

double switch_frequency

bound on the achieved frequency

class Computation

Abstract interface for some different thread computation.

Subclassed by Matrix_computation_no_eigen

Public Functions

virtual void compute() = 0

Interface to some computation to perform in the real time thread.

class Matrix_computation_no_eigen : public Computation

Some specific computation based on matrix multiplication.

Public Functions

inline Matrix_computation_no_eigen(int size)

Construct a new Matrix_computation_no_eigen object.

Parameters

size – of the matrices

inline ~Matrix_computation_no_eigen()

class destructor

inline double compute(int i, int j)

Compute one element of the matrix multiplication.

Parameters
  • i\( i^th \) row

  • j\( j^th \) column

Returns

double result of the multiplication

inline virtual void compute()

compute the matrix multiplication.

Private Members

int size

The size of the matrices.

double **m1

The first matrix.

double **m2

The second matrix.

double **m3

The multiplication of the first 2 matrices.