Functions
tbb_init_t.cc File Reference
#include "tbb/task_scheduler_init.h"
#include "tbb/tick_count.h"
#include <iostream>
#include <unistd.h>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( )

Definition at line 11 of file tbb_init_t.cc.

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