timer.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. Copyright 1999 ImageMagick Studio LLC, a non-profit organization
  3. dedicated to making software imaging solutions freely available.
  4. You may not use this file except in compliance with the License. You may
  5. obtain a copy of the License at
  6. https://imagemagick.org/script/license.php
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. MagickCore timer methods.
  13. */
  14. #ifndef MAGICKCORE_TIMER_H
  15. #define MAGICKCORE_TIMER_H
  16. #if defined(__cplusplus) || defined(c_plusplus)
  17. extern "C" {
  18. #endif
  19. typedef enum
  20. {
  21. UndefinedTimerState,
  22. StoppedTimerState,
  23. RunningTimerState
  24. } TimerState;
  25. typedef struct _Timer
  26. {
  27. double
  28. start,
  29. stop,
  30. total;
  31. } Timer;
  32. typedef struct _TimerInfo
  33. {
  34. Timer
  35. user,
  36. elapsed;
  37. TimerState
  38. state;
  39. size_t
  40. signature;
  41. } TimerInfo;
  42. extern MagickExport double
  43. GetElapsedTime(TimerInfo *),
  44. GetUserTime(TimerInfo *);
  45. extern MagickExport MagickBooleanType
  46. ContinueTimer(TimerInfo *);
  47. extern MagickExport ssize_t
  48. FormatMagickTime(const time_t,const size_t,char *);
  49. extern MagickExport TimerInfo
  50. *AcquireTimerInfo(void),
  51. *DestroyTimerInfo(TimerInfo *);
  52. extern MagickExport void
  53. GetTimerInfo(TimerInfo *),
  54. ResetTimer(TimerInfo *),
  55. StartTimer(TimerInfo *,const MagickBooleanType);
  56. #if defined(__cplusplus) || defined(c_plusplus)
  57. }
  58. #endif
  59. #endif