starpu_profiling.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 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 __STARPU_PROFILING_H__
  17. #define __STARPU_PROFILING_H__
  18. #include <errno.h>
  19. #include <starpu.h>
  20. #define STARPU_PROFILING_DISABLE 0
  21. #define STARPU_PROFILING_ENABLE 1
  22. /* -ENOSYS is returned in case the info is not available. Timing are shown in
  23. * microseconds. */
  24. struct starpu_task_profiling_info {
  25. int64_t submit_time;
  26. int64_t start_time;
  27. int64_t end_time;
  28. /* TODO add expected length, expected start/end ? */
  29. int workerid;
  30. };
  31. /* The timing is provided since the previous call to starpu_worker_get_profiling_info */
  32. struct starpu_worker_profiling_info {
  33. int64_t start_time;
  34. int64_t total_time;
  35. int64_t executing_time;
  36. int64_t sleeping_time;
  37. int executed_tasks;
  38. };
  39. /* This function sets the profiling status:
  40. * - enable with STARPU_PROFILING_ENABLE
  41. * - disable with STARPU_PROFILING_DISABLE
  42. * Negative return values indicate an error, otherwise the previous status is
  43. * returned. */
  44. int starpu_profiling_status_set(int status);
  45. /* Return the current profiling status or a negative value in case there was an
  46. * error. */
  47. int starpu_profiling_status_get(void);
  48. /* Get the profiling info associated to a worker, and reset the profiling
  49. * measurements. If worker_info is NULL, we only reset the counters. */
  50. int starpu_worker_get_profiling_info(int workerid, struct starpu_worker_profiling_info *worker_info);
  51. #endif // __STARPU_PROFILING_H__