25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

caca_prof.h 1.2 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * libcaca Colour ASCII-Art library
  3. * Copyright (c) 2009-2010 Sam Hocevar <sam@hocevar.net>
  4. * All Rights Reserved
  5. *
  6. * This library is free software. It comes without any warranty, to
  7. * the extent permitted by applicable law. You can redistribute it
  8. * and/or modify it under the terms of the Do What The Fuck You Want
  9. * To Public License, Version 2, as published by Sam Hocevar. See
  10. * http://sam.zoy.org/wtfpl/COPYING for more details.
  11. */
  12. /*
  13. * This file contains profiling functions.
  14. */
  15. #ifndef __CACA_PROF_H__
  16. #define __CACA_PROF_H__
  17. #if defined PROF && !defined __KERNEL__
  18. # define PROFILING_VARS
  19. # define STAT_IADD(_s, _n) \
  20. do \
  21. { \
  22. struct caca_stat *s = _s; \
  23. int i, n = _n; \
  24. for (i = STAT_VALUES - 1; i > 0; i--) \
  25. s->itable[i] = s->itable[i - 1]; \
  26. s->itable[0] = n; \
  27. s->imean = (s->imean * 63 + (int64_t)n * 64 + 32) / 64; \
  28. } \
  29. while(0)
  30. # define START_PROF(obj, fn)
  31. # define STOP_PROF(obj, fn)
  32. #else
  33. # define PROFILING_VARS
  34. # define STAT_IADD(_s, _n) do { } while(0)
  35. # define START_PROF(obj, fn) do { } while(0)
  36. # define STOP_PROF(obj, fn) do { } while(0)
  37. #endif
  38. #endif /* __CACA_PROF_H__ */