datastats.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2011,2013-2014,2016 Université de Bordeaux
  4. * Copyright (C) 2010-2012,2015,2017 CNRS
  5. * Copyright (C) 2016 Inria
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef __DATASTATS_H__
  19. #define __DATASTATS_H__
  20. #include <starpu.h>
  21. #include <common/config.h>
  22. #include <stdint.h>
  23. #include <stdlib.h>
  24. extern int _starpu_enable_stats;
  25. void _starpu_datastats_init();
  26. static inline int starpu_enable_stats(void)
  27. {
  28. return _starpu_enable_stats;
  29. }
  30. void __starpu_msi_cache_hit(unsigned node);
  31. void __starpu_msi_cache_miss(unsigned node);
  32. #define _starpu_msi_cache_hit(node) do { \
  33. if (starpu_enable_stats()) \
  34. __starpu_msi_cache_hit(node); \
  35. } while (0)
  36. #define _starpu_msi_cache_miss(node) do { \
  37. if (starpu_enable_stats()) \
  38. __starpu_msi_cache_miss(node); \
  39. } while (0)
  40. void _starpu_display_msi_stats(FILE *stream);
  41. void __starpu_allocation_cache_hit(unsigned node STARPU_ATTRIBUTE_UNUSED);
  42. void __starpu_data_allocation_inc_stats(unsigned node STARPU_ATTRIBUTE_UNUSED);
  43. #define _starpu_allocation_cache_hit(node) do { \
  44. if (starpu_enable_stats()) \
  45. __starpu_allocation_cache_hit(node); \
  46. } while (0)
  47. #define _starpu_data_allocation_inc_stats(node) do { \
  48. if (starpu_enable_stats()) \
  49. __starpu_data_allocation_inc_stats(node); \
  50. } while (0)
  51. void _starpu_display_alloc_cache_stats(FILE *stream);
  52. #endif // __DATASTATS_H__