starpu_perf_monitoring.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2019 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 __STARPU_PERF_MONITORING_H__
  17. #define __STARPU_PERF_MONITORING_H__
  18. #include <starpu.h>
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. /**
  24. @defgroup API_Perf_Monitoring Perf_Monitoring
  25. @{
  26. */
  27. enum starpu_perf_counter_scope
  28. {
  29. starpu_perf_counter_scope_undefined = 0,
  30. starpu_perf_counter_scope_global = 2,
  31. starpu_perf_counter_scope_per_worker = 4,
  32. starpu_perf_counter_scope_per_codelet = 6
  33. };
  34. enum starpu_perf_counter_type
  35. {
  36. starpu_perf_counter_type_undefined = 0,
  37. starpu_perf_counter_type_int32 = 1,
  38. starpu_perf_counter_type_int64 = 2,
  39. starpu_perf_counter_type_float = 3,
  40. starpu_perf_counter_type_double = 4
  41. };
  42. struct starpu_perf_counter_listener;
  43. struct starpu_perf_counter_sample;
  44. struct starpu_perf_counter_set;
  45. int starpu_perf_counter_scope_name_to_id(const char *name);
  46. const char *starpu_perf_counter_scope_id_to_name(enum starpu_perf_counter_scope scope);
  47. int starpu_perf_counter_type_name_to_id(const char *name);
  48. const char *starpu_perf_counter_type_id_to_name(enum starpu_perf_counter_type type);
  49. int starpu_perf_counter_nb(enum starpu_perf_counter_scope scope);
  50. int starpu_perf_counter_name_to_id(enum starpu_perf_counter_scope scope, const char *name);
  51. int starpu_perf_counter_nth_to_id(enum starpu_perf_counter_scope scope, int nth);
  52. const char *starpu_perf_counter_id_to_name(int id);
  53. int starpu_perf_counter_get_type_id(int id);
  54. const char *starpu_perf_counter_get_help_string(int id);
  55. void starpu_perf_counter_list_avail(enum starpu_perf_counter_scope scope);
  56. void starpu_perf_counter_list_all_avail(enum starpu_perf_counter_scope scope);
  57. struct starpu_perf_counter_set *starpu_perf_counter_set_alloc(enum starpu_perf_counter_scope scope);
  58. void starpu_perf_counter_set_free(struct starpu_perf_counter_set *set);
  59. void starpu_perf_counter_set_enable_id(struct starpu_perf_counter_set *set, int id);
  60. void starpu_perf_counter_set_disable_id(struct starpu_perf_counter_set *set, int id);
  61. struct starpu_perf_counter_listener *starpu_perf_counter_listener_init(struct starpu_perf_counter_set *set, void (*callback)(struct starpu_perf_counter_listener *listener, struct starpu_perf_counter_sample *sample, void *context), void *user_arg);
  62. void starpu_perf_counter_listener_exit(struct starpu_perf_counter_listener *listener);
  63. void starpu_perf_counter_set_global_listener(struct starpu_perf_counter_listener *listener);
  64. void starpu_perf_counter_set_per_worker_listener(unsigned workerid, struct starpu_perf_counter_listener *listener);
  65. void starpu_perf_counter_set_all_per_worker_listeners(struct starpu_perf_counter_listener *listener);
  66. void starpu_perf_counter_set_per_codelet_listener(struct starpu_codelet *cl, struct starpu_perf_counter_listener *listener);
  67. void starpu_perf_counter_unset_global_listener();
  68. void starpu_perf_counter_unset_per_worker_listener(unsigned workerid);
  69. void starpu_perf_counter_unset_all_per_worker_listeners(void);
  70. void starpu_perf_counter_unset_per_codelet_listener(struct starpu_codelet *cl);
  71. int32_t starpu_perf_counter_sample_get_int32_value(struct starpu_perf_counter_sample *sample, const int counter_id);
  72. int64_t starpu_perf_counter_sample_get_int64_value(struct starpu_perf_counter_sample *sample, const int counter_id);
  73. float starpu_perf_counter_sample_get_float_value(struct starpu_perf_counter_sample *sample, const int counter_id);
  74. double starpu_perf_counter_sample_get_double_value(struct starpu_perf_counter_sample *sample, const int counter_id);
  75. /** @} */
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif /* __STARPU_PERF_MONITORING_H__ */