gpu_mem.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * GPU memory trace points
  4. *
  5. * Copyright (C) 2020 Google, Inc.
  6. */
  7. #undef TRACE_SYSTEM
  8. #define TRACE_SYSTEM gpu_mem
  9. #if !defined(_TRACE_GPU_MEM_H) || defined(TRACE_HEADER_MULTI_READ)
  10. #define _TRACE_GPU_MEM_H
  11. #include <linux/tracepoint.h>
  12. /*
  13. * The gpu_memory_total event indicates that there's an update to either the
  14. * global or process total gpu memory counters.
  15. *
  16. * This event should be emitted whenever the kernel device driver allocates,
  17. * frees, imports, unimports memory in the GPU addressable space.
  18. *
  19. * @gpu_id: This is the gpu id.
  20. *
  21. * @pid: Put 0 for global total, while positive pid for process total.
  22. *
  23. * @size: Size of the allocation in bytes.
  24. *
  25. */
  26. TRACE_EVENT(gpu_mem_total,
  27. TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size),
  28. TP_ARGS(gpu_id, pid, size),
  29. TP_STRUCT__entry(
  30. __field(uint32_t, gpu_id)
  31. __field(uint32_t, pid)
  32. __field(uint64_t, size)
  33. ),
  34. TP_fast_assign(
  35. __entry->gpu_id = gpu_id;
  36. __entry->pid = pid;
  37. __entry->size = size;
  38. ),
  39. TP_printk("gpu_id=%u pid=%u size=%llu",
  40. __entry->gpu_id,
  41. __entry->pid,
  42. __entry->size)
  43. );
  44. #endif /* _TRACE_GPU_MEM_H */
  45. /* This part must be outside protection */
  46. #include <trace/define_trace.h>