Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

47 rader
1.2 KiB

  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__ */