profiling.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2012,2014,2016,2017 Université de Bordeaux
  4. * Copyright (C) 2010,2011,2013,2015,2017 CNRS
  5. * Copyright (C) 2016 Inria
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef __PROFILING_H__
  19. #define __PROFILING_H__
  20. #include <starpu.h>
  21. #include <starpu_profiling.h>
  22. #include <starpu_util.h>
  23. #include <common/config.h>
  24. /* Create a task profiling info structure (with the proper time stamps) in case
  25. * profiling is enabled. */
  26. struct starpu_profiling_task_info *_starpu_allocate_profiling_info_if_needed(struct starpu_task *task);
  27. /* Update the per-worker profiling info after a task (or more) was executed.
  28. * This tells StarPU how much time was spent doing computation. */
  29. 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);
  30. /* Record the date when the worker started to sleep. This permits to measure
  31. * how much time was spent sleeping. */
  32. void _starpu_worker_restart_sleeping(int workerid);
  33. /* Record the date when the worker stopped sleeping. This permits to measure
  34. * how much time was spent sleeping. */
  35. void _starpu_worker_stop_sleeping(int workerid);
  36. /* Record the date when the worker started to execute a piece of code. This
  37. * permits to measure how much time was really spent doing computation at the
  38. * end of the codelet. */
  39. void _starpu_worker_register_executing_start_date(int workerid, struct timespec *executing_start);
  40. /* Record that the worker is not executing any more. */
  41. void _starpu_worker_register_executing_end(int workerid);
  42. /* When StarPU is initialized, a matrix describing all the bus between memory
  43. * nodes is created: it indicates whether there is a physical link between two
  44. * memory nodes or not. This matrix should contain the identifier of the bus
  45. * between two nodes or -1 in case there is no link. */
  46. void _starpu_initialize_busid_matrix(void);
  47. /* Tell StarPU that there exists a link between the two memory nodes. This
  48. * function returns the identifier associated to the bus which can be used to
  49. * retrieve profiling information about the bus activity later on. */
  50. int _starpu_register_bus(int src_node, int dst_node);
  51. /* Tell StarPU that "size" bytes were transferred between the two specified
  52. * memory nodes. */
  53. void _starpu_bus_update_profiling_info(int src_node, int dst_node, size_t size);
  54. void _starpu_profiling_set_task_push_start_time(struct starpu_task *task);
  55. void _starpu_profiling_set_task_push_end_time(struct starpu_task *task);
  56. /* This function needs to be called before other starpu_profile_* functions */
  57. void _starpu_profiling_init(void);
  58. /* This function starts profiling if the STARPU_PROFILING environment variable was set */
  59. void _starpu_profiling_start(void);
  60. void _starpu_profiling_terminate(void);
  61. #endif // __PROFILING_H__