Changeset 449 for ImageMagick/trunk/utilities/convert.c
- Timestamp:
- 10/24/09 21:03:55 (5 months ago)
- Files:
-
- 1 modified
-
ImageMagick/trunk/utilities/convert.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ImageMagick/trunk/utilities/convert.c
r249 r449 48 48 Include declarations. 49 49 */ 50 #include <stdio.h> 51 #include <stdlib.h> 52 #include <string.h> 53 #include <time.h> 54 #include <math.h> 50 #include "magick/studio.h" 51 #include "magick/thread-private.h" 55 52 #include "wand/MagickWand.h" 56 53 #if defined(__WINDOWS__) … … 77 74 78 75 double 76 duration, 79 77 elapsed_time, 80 78 user_time; … … 86 84 *image_info; 87 85 86 long 87 j; 88 88 89 MagickBooleanType 90 concurrent, 89 91 regard_warnings, 90 92 status; … … 100 102 101 103 MagickCoreGenesis(*argv,MagickTrue); 104 concurrent=MagickFalse; 105 duration=(-1.0); 102 106 exception=AcquireExceptionInfo(); 103 107 iterations=1; 104 status=Magick False;108 status=MagickTrue; 105 109 regard_warnings=MagickFalse; 106 110 for (i=1; i < (long) (argc-1); i++) … … 111 115 if (LocaleCompare("bench",option+1) == 0) 112 116 iterations=(unsigned long) atol(argv[++i]); 117 if (LocaleCompare("concurrent",option+1) == 0) 118 concurrent=MagickTrue; 113 119 if (LocaleCompare("debug",option+1) == 0) 114 120 (void) SetLogEventMask(argv[++i]); 121 if (LocaleCompare("duration",option+1) == 0) 122 duration=(unsigned long) atof(argv[++i]); 115 123 if (LocaleCompare("regard-warnings",option+1) == 0) 116 124 regard_warnings=MagickTrue; … … 119 127 if (iterations > 1) 120 128 timer=AcquireTimerInfo(); 121 for (i=0; i < (long) iterations; i++) 129 if (concurrent != MagickFalse) 130 SetOpenMPNested(1); 131 # pragma omp parallel for shared(status) 132 for (i=0; i < (long) (concurrent != MagickFalse ? iterations : 1); i++) 122 133 { 123 image_info=AcquireImageInfo(); 124 status=ConvertImageCommand(image_info,argc,argv,(char **) NULL,exception); 125 if (exception->severity != UndefinedException) 126 { 127 if ((exception->severity > ErrorException) || 128 (regard_warnings != MagickFalse)) 129 status=MagickTrue; 130 CatchException(exception); 131 } 132 image_info=DestroyImageInfo(image_info); 134 if (status == MagickFalse) 135 continue; 136 if (GetElapsedTime(timer) > duration) 137 continue; 138 ContinueTimer(timer); 139 for (j=0; j < (long) (concurrent == MagickFalse ? iterations : 1); j++) 140 { 141 if (status == MagickFalse) 142 break; 143 if (GetElapsedTime(timer) > duration) 144 break; 145 ContinueTimer(timer); 146 image_info=AcquireImageInfo(); 147 status=ConvertImageCommand(image_info,argc,argv,(char **) NULL,exception); 148 # pragma omp critical (MagickCore_Convert_Utility) 149 if (exception->severity != UndefinedException) 150 { 151 if ((exception->severity > ErrorException) || 152 (regard_warnings != MagickFalse)) 153 status=MagickTrue; 154 CatchException(exception); 155 } 156 image_info=DestroyImageInfo(image_info); 157 } 133 158 } 134 159 if (iterations > 1)
