datastats.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2021 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. #pragma GCC visibility push(hidden)
  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. #pragma GCC visibility pop
  53. #endif // __DATASTATS_H__