1 /*=========================================================================
4 Module: $RCSfile: TestPrintTime.cxx,v $
6 Date: $Date: 2005/07/08 12:02:02 $
7 Version: $Revision: 1.3 $
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: warning: this is the location of the previous definition
36 #include "gdcmDataImages.h"
37 int main(int, char *[])
39 clock_t r1, r2, r3, r4;
40 struct tms tms1, tms2, tms3, tms4;
43 //std::ostream os = std::cout;
44 //std::ostringstream s;
47 while( gdcmDataImages[i] != 0 )
49 std::string filename = GDCM_DATA_ROOT;
50 filename += "/"; //doh!
51 filename += gdcmDataImages[i];
53 e1= new gdcm::File( );
55 e1->SetFileName( filename );
58 if (!e1->IsReadable())
59 std::cout << "-----------Not Readable " << std::endl;
61 e1= new gdcm::File( );
62 e1->SetLoadMode( NO_SEQ | NO_SHADOW );
64 e1->SetFileName( filename );
68 if (!e1->IsReadable())
69 std::cout << "-----------Not Readable " << std::endl;
73 << std::setw(60-strlen(gdcmDataImages[i])) << " "
74 << gdcmDataImages[i] << " "
75 << (long) ((tms2.tms_utime) - (tms1.tms_utime))
77 << (long) ((tms4.tms_utime) - (tms3.tms_utime));
79 std::cout << "\twith clock time : " << r2-r1 << " vs " << r4-r3
85 std::cout << "---------------------------------------------------" << std::endl;
88 for(int k=0;k<1; k++) // run many tiles to increase time ...
91 while( gdcmDataImages[i] != 0 )
93 std::string filename = GDCM_DATA_ROOT;
94 filename += "/"; //doh!
95 filename += gdcmDataImages[i];
97 e1= new gdcm::File( );
98 e1->SetFileName( filename );
100 if (!e1->IsReadable())
101 std::cout << "-----------Not Readable " << std::endl;
110 // ---------------------------
112 for(int k=0;k<1; k++)
116 while( gdcmDataImages[i] != 0 )
118 std::string filename = GDCM_DATA_ROOT;
119 filename += "/"; //doh!
120 filename += gdcmDataImages[i];
122 e1= new gdcm::File( );
123 e1->SetLoadMode( NO_SEQ | NO_SHADOW );
124 e1->SetFileName( filename );
126 if (!e1->IsReadable())
127 std::cout << "-----------Not Readable " << std::endl;
135 << (long) ((tms2.tms_utime) - (tms1.tms_utime))
137 << (long) ((tms4.tms_utime) - (tms3.tms_utime))
139 std::cout << "---------------------------------------------------" << std::endl;