message: try to improve sampling rate for synthetic
diff: @@ -105,8 +105,8 @@ void SyntheticBoard::read_thread ()
  sin_phase_rad[i] = 0.0;
  }
  int sampling_rate = board_descr["sampling_rate"];
  - int initial_sleep_time = 1000 / sampling_rate;
  - int sleep_time = initial_sleep_time;
  + int batch_size = 15;
  + int sleep_time = (int)((1000.0 / sampling_rate) * batch_size);
  std::uniform_real_distribution<double> dist_around_one (0.90, 1.10);
  uint64_t seed = std::chrono::high_resolution_clock::now ().time_since_epoch ().count ();
  std::mt19937 mt (static_cast<uint32_t> (seed));
  @@ -119,9 +119,16 @@ void SyntheticBoard::read_thread ()
  package[i] = 0.0;
  }
  + double timestamp = 0;
  while (keep_alive)
  {
  auto start = std::chrono::high_resolution_clock::now ();
  + for (int num_in_batch = 0; num_in_batch < batch_size; num_in_batch++)
  + {
  + if (num_in_batch == 0)
  + {
  + timestamp = get_timestamp ();
  + }
  package[board_descr["package_num_channel"].get<int> ()] = (double)counter;
  for (unsigned int i = 0; i < exg_channels.size (); i++)
  {
  @@ -163,33 +170,25 @@ void SyntheticBoard::read_thread ()
  {
  package[channel] = 1000.0 * dist_around_one (mt);
  }
  - package[board_descr["battery_channel"].get<int> ()] = (dist_around_one (mt) - 0.1) * 100;
  - package[board_descr["timestamp_channel"].get<int> ()] = get_timestamp ();
  + package[board_descr["battery_channel"].get<int> ()] =
  + (dist_around_one (mt) - 0.1) * 100;
  + package[board_descr["timestamp_channel"].get<int> ()] =
  + timestamp + num_in_batch / (double)sampling_rate;
  push_package (package); // use this method to submit data to buffers
  counter++;
  - if (sleep_time > 0)
  - {
  -#ifdef _WIN32
  - Sleep (sleep_time);
  -#else
  - usleep (sleep_time * 1000);
  -#endif
  }
  -
  auto stop = std::chrono::high_resolution_clock::now ();
  auto duration =
  - std::chrono::duration_cast<std::chrono::microseconds> (stop - start).count ();
  - accumulated_time_delta += duration - initial_sleep_time * 1000;
  - if (accumulated_time_delta > 1000.0)
  - {
  - sleep_time = initial_sleep_time - (int)(accumulated_time_delta / 1000.0);
  - accumulated_time_delta -= 1000.0;
  - }
  - else
  + std::chrono::duration_cast<std::chrono::milliseconds> (stop - start).count ();
  + if (duration < sleep_time)
  {
  - sleep_time = initial_sleep_time;
  +#ifdef _WIN32
  + Sleep (sleep_time - duration);
  +#else
  + usleep ((sleep_time - duration) * 1000);
  +#endif
  }
  }
  delete[] sin_phase_rad;
  