#include <pls/pls.h>
#include <pls/internal/helpers/profiler.h>
#include <pls/internal/helpers/mini_benchmark.h>

#include <iostream>
#include <vector>
#include <functional>

static constexpr int INPUT_SIZE = 100;

int main() {
  PROFILE_ENABLE
  std::vector<double> vec(INPUT_SIZE, 1);
  std::vector<double> out(INPUT_SIZE);

  for (int i = 0; i < INPUT_SIZE; i++) {
    vec[i] = i;
  }

  pls::internal::helpers::run_mini_benchmark([&] {
    pls::scan(vec.begin(), vec.end(), out.begin(), std::plus<double>(), 0.0);
  }, 8, 1000);

  PROFILE_SAVE("test_profile.prof")
}

//int main() {
//  PROFILE_ENABLE
//  pls::malloc_scheduler_memory my_scheduler_memory{8, 2u << 18};
//  pls::scheduler scheduler{&my_scheduler_memory, 8};
//
//  std::vector<double> vec(INPUT_SIZE, 1);
//  std::vector<double> out(INPUT_SIZE);
//
//  for (int i = 0; i < INPUT_SIZE; i++) {
//    vec[i] = 1;
//  }
//
//  scheduler.perform_work([&] {
//    PROFILE_MAIN_THREAD
//    for (int i = 0; i < 100; i++) {
//      pls::scan(vec.begin(), vec.end(), out.begin(), std::plus<double>(), 0.0);
//    }
//  });
//
//  PROFILE_SAVE("test_profile.prof")
//}
