MatLogger2  1.0.0
Library for logging of numeric data to HDF5 MAT-files, which is RT-safe and multithreaded.
MatLogger2

Library for logging of numeric data to HDF5 MAT-files, which is RT-safe and multithreaded.

Building MatLogger2 from source

Standard cmake workflow:

Installing the binary release

The binary release has been tested only with Ubuntu 16.04

## Linking against MatLogger2

1 find_package(matlogger2 REQUIRED)
2 target_link_libraries(mytarget matlogger2::matlogger2)

Quick start

### Circular-buffer mode

1 {c++}
2  #include <matlogger2/matlogger2.h>
3 
4  int main()
5  {
6  auto logger = XBot::MatLogger2::MakeLogger("/tmp/my_log");
7  logger->set_buffer_mode(XBot::VariableBuffer::Mode::circular_buffer);
8 
9  for(int i = 0; i < 1e5; i++)
10  {
11  Eigen::VectorXd vec(10);
12  Eigen::MatrixXd mat(6,8);
13 
14  logger->add("my_vec_var", vec);
15  logger->add("my_scalar_var", M_PI);
16  logger->add("my_mat_var", mat);
17  }
18 
19  } // destructor flushes to disk

### Producer-consumer mode (default)

1 {c++}
2  #include <matlogger2/matlogger2.h>
3  #include <matlogger2/utils/mat_appender.h>
4 
5  int main()
6  {
7  auto logger = XBot::MatLogger2::MakeLogger("/tmp/my_log");
8  auto appender = XBot::MatAppender::MakeInstance();
9  appender->add_logger(logger);
10  appender->start_flush_thread();
11 
12  for(int i = 0; i < 1e5; i++)
13  {
14  Eigen::VectorXd vec(10);
15  Eigen::MatrixXd mat(6,8);
16 
17  logger->add("my_vec_var", vec);
18  logger->add("my_scalar_var", M_PI);
19  logger->add("my_mat_var", mat);
20 
21  usleep(1000);
22  }
23 
24  }

Documentation

Header files are documented with doxygen! An online version is also available.