X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestInline.cxx;fp=Testing%2FTestInline.cxx;h=8a0dec653bac1f2f1c55b71c4d3536fdf58e2f20;hb=773706a0e77a31dcc20b4ef95b54158db9a76a34;hp=38611daeb098edf45a07a991d05c3b220a23c72f;hpb=0e030c69b4fec60eaf0c92a6c1701a3e8de5e794;p=gdcm.git diff --git a/Testing/TestInline.cxx b/Testing/TestInline.cxx index 38611dae..8a0dec65 100755 --- a/Testing/TestInline.cxx +++ b/Testing/TestInline.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestInline.cxx,v $ Language: C++ - Date: $Date: 2005/11/02 09:40:11 $ - Version: $Revision: 1.7 $ + Date: $Date: 2005/11/17 17:44:24 $ + Version: $Revision: 1.8 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -30,7 +30,7 @@ // Which CXX_FLAGS, LINKER_FLAGS, ..., must we set to see the difference? #include "gdcmUtil.h" -#include "gdcmDebug.h" +#include "TestInLine.h" #include #include @@ -151,7 +151,7 @@ int TestInline(int argc, char *argv[]) else nbLoop = 10000000; - clock_t r1, r2; + //clock_t r1, r2; struct tms tms1, tms2; double a = 1, b = 2; @@ -161,25 +161,29 @@ int TestInline(int argc, char *argv[]) // ---------------------------------------- std::cout << "Use a macro "<< std::endl; - r1 = times(&tms1); + //r1 = times(&tms1); + times(&tms1); for(i = 0 ; i< nbLoop ; i++) { mswap (a,b); } - r2 = times(&tms2); - std::cout + //r2 = times(&tms2); + times(&tms2); + std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; // ---------------------------------------- std::cout << "Use reference function" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { frswap (a,b); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -187,12 +191,14 @@ int TestInline(int argc, char *argv[]) // ---------------------------------------- std::cout << "Use pointer function" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { fpswap (&a, &b); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -200,12 +206,14 @@ int TestInline(int argc, char *argv[]) // ---------------------------------------- std::cout << "Use inline, main-defined reference function" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { ifrswap (a, b); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -213,12 +221,14 @@ int TestInline(int argc, char *argv[]) // ---------------------------------------- std::cout << "Use inline, main-defined pointer function" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { ifpswap (&a, &b); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -230,12 +240,15 @@ int TestInline(int argc, char *argv[]) std::cout << "Use inline, .h defined, WITH inline keyword pointer function" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { - gdcm::Util::hifpswap (&a, &b); + //gdcm::Util::hifpswap (&a, &b); + hifpswap (&a, &b); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -245,12 +258,15 @@ int TestInline(int argc, char *argv[]) std::cout << "Use inline, .h defined, NO inline keyword pointer function" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { - gdcm::Util::hNoifpswap (&a, &b); + //gdcm::Util::hNoifpswap (&a, &b); + hNoifpswap (&a, &b); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -260,12 +276,14 @@ int TestInline(int argc, char *argv[]) std::cout << "Pass uint_16 param directly" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { passDirect (x, y); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -274,12 +292,14 @@ int TestInline(int argc, char *argv[]) std::cout << "Pass uint_16 param as ref" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { passRef (x, y); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -288,12 +308,14 @@ int TestInline(int argc, char *argv[]) std::cout << "Pass uint_16 param as ptr" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { passPtr (&x, &y); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -305,12 +327,14 @@ int TestInline(int argc, char *argv[]) uint32_t m =1, n=2; std::cout << "Pass uint_32 param directly" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { passDirect32 (m, n); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -319,12 +343,14 @@ int TestInline(int argc, char *argv[]) std::cout << "Pass uint32_t param as ref" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { passRef32 (m, n); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -333,12 +359,14 @@ int TestInline(int argc, char *argv[]) std::cout << "Pass uint_32 param as ptr" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { passPtr32 (&m, &n); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -350,12 +378,15 @@ int TestInline(int argc, char *argv[]) std::cout << "Pass double param directly" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { passDirectDouble (dx, dy); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); + std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -364,12 +395,15 @@ int TestInline(int argc, char *argv[]) std::cout << "Pass double param as ref" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { passRefDouble (dx, dy); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); + std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl; @@ -378,12 +412,15 @@ int TestInline(int argc, char *argv[]) std::cout << "Pass double param as ptr" << std::endl; - r1 = times(&tms1); - for(i = 0 ; i< nbLoop ; i++) + //r1 = times(&tms1); + times(&tms1); + for(i = 0 ; i< nbLoop ; i++) { passPtrDouble (&dx, &dy); } - r2 = times(&tms2); + //r2 = times(&tms2); + times(&tms2); + std::cout << (long) ((tms2.tms_utime) - (tms1.tms_utime)) << std::endl;