1 /*=========================================================================
4 Module: $RCSfile: exPrintTime.cxx,v $
6 Date: $Date: 2007/06/21 15:01:00 $
7 Version: $Revision: 1.2 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 // TODO : check what's *actually* usefull
23 #include "gdcmCommon.h"
27 #include <sys/times.h>
29 #include <iomanip> // for std::ios::left, ...
32 //#define CLK_TCK 1 ///usr/include/bits/time.h:41:
33 // warning: this is the location of the previous definition
37 #include "gdcmDataImages.h"
38 int main(int, char *[])
40 clock_t r1, r2, r3, r4;
41 struct tms tms1, tms2, tms3, tms4;
42 GDCM_NAME_SPACE::File *e1;
44 //std::ostream os = std::cout;
45 //std::ostringstream s;
48 while( gdcmDataImages[i] != 0 )
50 std::string filename = GDCM_DATA_ROOT;
51 filename += "/"; //doh!
52 filename += gdcmDataImages[i];
54 e1= new GDCM_NAME_SPACE::File( );
56 e1->SetFileName( filename );
59 if (!e1->IsReadable())
60 std::cout << "-----------Not Readable " << std::endl;
62 e1= new GDCM_NAME_SPACE::File( );
63 e1->SetLoadMode( GDCM_NAME_SPACE::LD_NOSEQ | GDCM_NAME_SPACE::LD_NOSHADOW );
65 e1->SetFileName( filename );
69 if (!e1->IsReadable())
70 std::cout << "-----------Not Readable " << std::endl;
74 << std::setw(60-strlen(gdcmDataImages[i])) << " "
75 << gdcmDataImages[i] << " "
76 << (long) ((tms2.tms_utime) - (tms1.tms_utime))
78 << (long) ((tms4.tms_utime) - (tms3.tms_utime));
80 std::cout << "\twith clock time : " << r2-r1 << " vs " << r4-r3
86 std::cout << "---------------------------------------------------" << std::endl;
89 for(int k=0;k<1; k++) // run many tiles to increase time ...
92 while( gdcmDataImages[i] != 0 )
94 std::string filename = GDCM_DATA_ROOT;
95 filename += "/"; //doh!
96 filename += gdcmDataImages[i];
98 e1= new GDCM_NAME_SPACE::File( );
99 e1->SetFileName( filename );
101 if (!e1->IsReadable())
102 std::cout << "-----------Not Readable " << std::endl;
111 // ---------------------------
113 for(int k=0;k<1; k++)
117 while( gdcmDataImages[i] != 0 )
119 std::string filename = GDCM_DATA_ROOT;
120 filename += "/"; //doh!
121 filename += gdcmDataImages[i];
123 e1= new GDCM_NAME_SPACE::File( );
124 e1->SetLoadMode( GDCM_NAME_SPACE::LD_NOSEQ | GDCM_NAME_SPACE::LD_NOSHADOW );
125 e1->SetFileName( filename );
127 if (!e1->IsReadable())
128 std::cout << "-----------Not Readable " << std::endl;
136 << (long) ((tms2.tms_utime) - (tms1.tms_utime))
138 << (long) ((tms4.tms_utime) - (tms3.tms_utime))
140 std::cout << "---------------------------------------------------" << std::endl;