+
+void init_benchmark(int numLoops)
+{
+ int i = 0;
+ long long durationInit = 0;
+ long long durationDeInit = 0;
+ struct timespec initStart, initEnd;
+ struct timespec deInitStart, deInitEnd;
+ unsigned int shutdownReg = PCL_SHUTDOWN_TYPE_FAST | PCL_SHUTDOWN_TYPE_NORMAL;
+
+ printf("\nTest i n i t / d e i n i t performance: %d times\n", numLoops);
+
+ // init
+ clock_gettime(CLOCK_ID, &initStart);
+ (void)pclInitLibrary(gAppName , shutdownReg);
+ clock_gettime(CLOCK_ID, &initEnd);
+ durationInit += getNsDuration(&initStart, &initEnd);
+
+ // deinit
+ clock_gettime(CLOCK_ID, &deInitStart);
+ pclDeinitLibrary();
+ clock_gettime(CLOCK_ID, &deInitEnd);
+ durationDeInit += getNsDuration(&deInitStart, &deInitEnd);
+
+ printf(" Init (single) => %f ms \n", (double)((double)durationInit/NANO2MIL));
+ printf(" Deinit (single) => %f ms \n", (double)((double)durationDeInit/NANO2MIL));
+
+ durationInit = 0;
+ durationDeInit = 0;
+
+
+ clock_gettime(CLOCK_ID, &initStart);
+ (void)pclInitLibrary(gAppName , shutdownReg);
+ clock_gettime(CLOCK_ID, &initEnd);
+ durationInit += getNsDuration(&initStart, &initEnd);
+
+ // deinit
+ clock_gettime(CLOCK_ID, &deInitStart);
+ pclDeinitLibrary();
+ clock_gettime(CLOCK_ID, &deInitEnd);
+ durationDeInit += getNsDuration(&deInitStart, &deInitEnd);
+
+ printf(" Init (single) => %f ms \n", (double)((double)durationInit/NANO2MIL));
+ printf(" Deinit (single) => %f ms \n", (double)((double)durationDeInit/NANO2MIL));
+
+ durationInit = 0;
+ durationDeInit = 0;
+
+ for(i=0; i<numLoops; i++)
+ {
+ // init
+ clock_gettime(CLOCK_ID, &initStart);
+ (void)pclInitLibrary(gAppName , shutdownReg);
+ clock_gettime(CLOCK_ID, &initEnd);
+ durationInit += getNsDuration(&initStart, &initEnd);
+
+ // deinit
+ clock_gettime(CLOCK_ID, &deInitStart);
+ (void)pclDeinitLibrary();
+ clock_gettime(CLOCK_ID, &deInitEnd);
+ durationDeInit += getNsDuration(&deInitStart, &deInitEnd);
+ }
+
+ printf(" Init => %f ms \n", (double)((double)durationInit/NANO2MIL/numLoops));
+ printf(" Deinit => %f ms \n", (double)((double)durationDeInit/NANO2MIL/numLoops));
+
+}
+
+
+