datastats.h 1.8 KB

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