Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

caca_prof.h 1.1 KiB

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