| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | #include <stdio.h> |
|---|
| 47 | #include <stdlib.h> |
|---|
| 48 | #include <string.h> |
|---|
| 49 | #include <math.h> |
|---|
| 50 | #include <time.h> |
|---|
| 51 | #include "wand/MagickWand.h" |
|---|
| 52 | #if defined(__WINDOWS__) |
|---|
| 53 | #include <windows.h> |
|---|
| 54 | #endif |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | int main(int argc,char **argv) |
|---|
| 70 | { |
|---|
| 71 | char |
|---|
| 72 | *option; |
|---|
| 73 | |
|---|
| 74 | double |
|---|
| 75 | elapsed_time, |
|---|
| 76 | user_time; |
|---|
| 77 | |
|---|
| 78 | ExceptionInfo |
|---|
| 79 | *exception; |
|---|
| 80 | |
|---|
| 81 | ImageInfo |
|---|
| 82 | *image_info; |
|---|
| 83 | |
|---|
| 84 | MagickBooleanType |
|---|
| 85 | regard_warnings, |
|---|
| 86 | status; |
|---|
| 87 | |
|---|
| 88 | register long |
|---|
| 89 | i; |
|---|
| 90 | |
|---|
| 91 | TimerInfo |
|---|
| 92 | timer; |
|---|
| 93 | |
|---|
| 94 | unsigned long |
|---|
| 95 | iterations; |
|---|
| 96 | |
|---|
| 97 | MagickCoreGenesis(*argv,MagickTrue); |
|---|
| 98 | exception=AcquireExceptionInfo(); |
|---|
| 99 | iterations=1; |
|---|
| 100 | status=MagickFalse; |
|---|
| 101 | regard_warnings=MagickFalse; |
|---|
| 102 | for (i=1; i < (long) (argc-1); i++) |
|---|
| 103 | { |
|---|
| 104 | option=argv[i]; |
|---|
| 105 | if ((strlen(option) == 1) || ((*option != '-') && (*option != '+'))) |
|---|
| 106 | continue; |
|---|
| 107 | if (LocaleCompare("bench",option+1) == 0) |
|---|
| 108 | iterations=(unsigned long) atol(argv[++i]); |
|---|
| 109 | if (LocaleCompare("debug",option+1) == 0) |
|---|
| 110 | (void) SetLogEventMask(argv[++i]); |
|---|
| 111 | if (LocaleCompare("regard-warnings",option+1) == 0) |
|---|
| 112 | regard_warnings=MagickTrue; |
|---|
| 113 | } |
|---|
| 114 | GetTimerInfo(&timer); |
|---|
| 115 | for (i=0; i < (long) iterations; i++) |
|---|
| 116 | { |
|---|
| 117 | image_info=AcquireImageInfo(); |
|---|
| 118 | status=StreamImageCommand(image_info,argc,argv,(char **) NULL,exception); |
|---|
| 119 | if (exception->severity != UndefinedException) |
|---|
| 120 | { |
|---|
| 121 | if ((exception->severity > ErrorException) || |
|---|
| 122 | (regard_warnings != MagickFalse)) |
|---|
| 123 | status=MagickTrue; |
|---|
| 124 | CatchException(exception); |
|---|
| 125 | } |
|---|
| 126 | image_info=DestroyImageInfo(image_info); |
|---|
| 127 | } |
|---|
| 128 | if (iterations > 1) |
|---|
| 129 | { |
|---|
| 130 | elapsed_time=GetElapsedTime(&timer); |
|---|
| 131 | user_time=GetUserTime(&timer); |
|---|
| 132 | (void) fprintf(stderr,"Performance: %lui %gips %0.3fu %ld:%02ld\n", |
|---|
| 133 | iterations,1.0*iterations/elapsed_time,user_time,(long) |
|---|
| 134 | (elapsed_time/60.0+0.5),(long) ceil(fmod(elapsed_time,60.0))); |
|---|
| 135 | } |
|---|
| 136 | exception=DestroyExceptionInfo(exception); |
|---|
| 137 | MagickCoreTerminus(); |
|---|
| 138 | return(status == MagickFalse ? 0 : 1); |
|---|
| 139 | } |
|---|