profiling.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * StarPU
  3. * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file)
  4. *
  5. * This program 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. * This program 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 __PROFILING_H__
  17. #define __PROFILING_H__
  18. #include <sys/time.h>
  19. #include <starpu.h>
  20. #include <starpu_profiling.h>
  21. #include <common/config.h>
  22. /* Create a task profiling info structure (with the proper time stamps) in case
  23. * profiling is enabled. */
  24. struct starpu_task_profiling_info *_starpu_allocate_profiling_info_if_needed(void);
  25. /* Clear all the profiling info related to the worker. */
  26. void _starpu_worker_reset_profiling_info(int workerid);
  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);
  30. /* Update the per-worker profiling info when StarPU wakes up: this indicates
  31. * how much time was spent sleeping. */
  32. void _starpu_worker_update_profiling_info_sleeping(int workerid, struct timespec *sleeping_start, struct timespec *sleeping_end);
  33. /* Record the date when the worker started to sleep. This permits to measure
  34. * how much time was spent sleeping when it becomes awake later on. */
  35. void _starpu_worker_register_sleeping_start_date(int workerid, struct timespec *sleeping_start);
  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. /* When StarPU is initialized, a matrix describing all the bus between memory
  41. * nodes is created: it indicates whether there is a physical link between two
  42. * memory nodes or not. This matrix should contain the identifier of the bus
  43. * between two nodes or -1 in case there is no link. */
  44. void _starpu_initialize_busid_matrix(void);
  45. /* Tell StarPU that there exists a link between the two memory nodes. This
  46. * function returns the identifier associated to the bus which can be used to
  47. * retrieve profiling information about the bus activity later on. */
  48. int _starpu_register_bus(int src_node, int dst_node);
  49. /* Tell StarPU that "size" bytes were transferred between the two specified
  50. * memory nodes. */
  51. void _starpu_bus_update_profiling_info(int src_node, int dst_node, size_t size);
  52. void _starpu_profiling_set_task_push_start_time(struct starpu_task *task);
  53. void _starpu_profiling_set_task_push_end_time(struct starpu_task *task);
  54. /* This function needs to be called before other starpu_profile_* functions */
  55. void _starpu_profiling_init(void);
  56. #endif // __PROFILING_H__