profiling.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. * Copyright (C) 2020 Federal University of Rio Grande do Sul (UFRGS)
  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 __PROFILING_H__
  18. #define __PROFILING_H__
  19. #include <starpu.h>
  20. #include <starpu_profiling.h>
  21. #include <starpu_util.h>
  22. #include <common/config.h>
  23. /* Create a task profiling info structure (with the proper time stamps) in case
  24. * profiling is enabled. */
  25. struct starpu_profiling_task_info *_starpu_allocate_profiling_info_if_needed(struct starpu_task *task);
  26. /* Update the per-worker profiling info after a task (or more) was executed.
  27. * This tells StarPU how much time was spent doing computation. */
  28. void _starpu_worker_update_profiling_info_executing(int workerid, struct timespec *executing_time, int executed_tasks, uint64_t used_cycles, uint64_t stall_cycles, double consumed_energy, double flops);
  29. /* Record the date when the worker started to sleep. This permits to measure
  30. * how much time was spent sleeping. */
  31. void _starpu_worker_restart_sleeping(int workerid);
  32. /* Record the date when the worker stopped sleeping. This permits to measure
  33. * how much time was spent sleeping. */
  34. void _starpu_worker_stop_sleeping(int workerid);
  35. /* Record the date when the worker started to execute a piece of code. This
  36. * permits to measure how much time was really spent doing computation at the
  37. * end of the codelet. */
  38. void _starpu_worker_register_executing_start_date(int workerid, struct timespec *executing_start);
  39. /* Record that the worker is not executing any more. */
  40. void _starpu_worker_register_executing_end(int workerid);
  41. /* When StarPU is initialized, a matrix describing all the bus between memory
  42. * nodes is created: it indicates whether there is a physical link between two
  43. * memory nodes or not. This matrix should contain the identifier of the bus
  44. * between two nodes or -1 in case there is no link. */
  45. void _starpu_initialize_busid_matrix(void);
  46. /* Tell StarPU that there exists a link between the two memory nodes. This
  47. * function returns the identifier associated to the bus which can be used to
  48. * retrieve profiling information about the bus activity later on. */
  49. int _starpu_register_bus(int src_node, int dst_node);
  50. /* Tell StarPU that "size" bytes were transferred between the two specified
  51. * memory nodes. */
  52. void _starpu_bus_update_profiling_info(int src_node, int dst_node, size_t size);
  53. void _starpu_profiling_set_task_push_start_time(struct starpu_task *task);
  54. void _starpu_profiling_set_task_push_end_time(struct starpu_task *task);
  55. #ifdef STARPU_PAPI
  56. /* Functions for papi task profilling */
  57. void _starpu_profiling_papi_task_start_counters(struct starpu_task *task);
  58. void _starpu_profiling_papi_task_stop_counters(struct starpu_task *task);
  59. #endif
  60. /* This function needs to be called before other starpu_profile_* functions */
  61. void _starpu_profiling_init(void);
  62. /* This function starts profiling if the STARPU_PROFILING environment variable was set */
  63. void _starpu_profiling_start(void);
  64. void _starpu_profiling_terminate(void);
  65. #endif // __PROFILING_H__