datastats.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #ifndef __DATASTATS_H__
  17. #define __DATASTATS_H__
  18. /** @file */
  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__