All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
tbb_init_t.cc
Go to the documentation of this file.
1 // Sketch of one way to do a scaling study
2 #include "tbb/task_scheduler_init.h"
3 #include "tbb/tick_count.h"
4 #include <iostream>
5 
6 extern "C" {
7 #include <unistd.h>
8 }
9 
10 int
12 {
13  int n = tbb::task_scheduler_init::default_num_threads();
14  for (int p = 1; p <= n; ++p) {
15  // Construct task scheduler with p threads
16  tbb::task_scheduler_init init(p);
17  auto t0 = tbb::tick_count::now();
18  // Execute parallel algorithm using task or template algorithm here.
19  usleep(4005 / n);
20  auto t1 = tbb::tick_count::now();
21  double t = (t1 - t0).seconds();
22  std::cout << "time = " << t << " with " << p << " threads." << std::endl;
23  // Implicitly destroy task scheduler.
24  }
25  return 0;
26 }
code to link reconstructed objects back to the MC truth information
int main()
Definition: tbb_init_t.cc:11