1 /*=========================================================================
4 Module: $RCSfile: TestPrintTime.cxx,v $
6 Date: $Date: 2005/05/11 14:40:56 $
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: 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( );
57 if (!e1->IsReadable())
58 std::cout << "-----------Not Readable " << std::endl;
60 e1= new gdcm::File( );
61 e1->SetLoadMode( NO_SEQ | NO_SHADOW );
65 if (!e1->IsReadable())
66 std::cout << "-----------Not Readable " << std::endl;
70 << std::setw(60-strlen(gdcmDataImages[i])) << " "
71 << gdcmDataImages[i] << " "
72 << (long) ((tms2.tms_utime) - (tms1.tms_utime))
74 << (long) ((tms4.tms_utime) - (tms3.tms_utime));
76 std::cout << "\twith clock time : " << r2-r1 << " vs " << r4-r3
82 std::cout << "---------------------------------------------------" << std::endl;
85 for(int k=0;k<1; k++) // run many tiles to increase time ...
88 while( gdcmDataImages[i] != 0 )
90 std::string filename = GDCM_DATA_ROOT;
91 filename += "/"; //doh!
92 filename += gdcmDataImages[i];
94 e1= new gdcm::File( );
96 if (!e1->IsReadable())
97 std::cout << "-----------Not Readable " << std::endl;
106 // ---------------------------
108 for(int k=0;k<1; k++)
112 while( gdcmDataImages[i] != 0 )
114 std::string filename = GDCM_DATA_ROOT;
115 filename += "/"; //doh!
116 filename += gdcmDataImages[i];
118 e1= new gdcm::File( );
119 e1->SetLoadMode( NO_SEQ | NO_SHADOW );
120 e1->Load( filename );
121 if (!e1->IsReadable())
122 std::cout << "-----------Not Readable " << std::endl;
130 << (long) ((tms2.tms_utime) - (tms1.tms_utime))
132 << (long) ((tms4.tms_utime) - (tms3.tms_utime))
134 std::cout << "---------------------------------------------------" << std::endl;