Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * GPU memory trace points
0004  *
0005  * Copyright (C) 2020 Google, Inc.
0006  */
0007 
0008 #undef TRACE_SYSTEM
0009 #define TRACE_SYSTEM gpu_mem
0010 
0011 #if !defined(_TRACE_GPU_MEM_H) || defined(TRACE_HEADER_MULTI_READ)
0012 #define _TRACE_GPU_MEM_H
0013 
0014 #include <linux/tracepoint.h>
0015 
0016 /*
0017  * The gpu_memory_total event indicates that there's an update to either the
0018  * global or process total gpu memory counters.
0019  *
0020  * This event should be emitted whenever the kernel device driver allocates,
0021  * frees, imports, unimports memory in the GPU addressable space.
0022  *
0023  * @gpu_id: This is the gpu id.
0024  *
0025  * @pid: Put 0 for global total, while positive pid for process total.
0026  *
0027  * @size: Size of the allocation in bytes.
0028  *
0029  */
0030 TRACE_EVENT(gpu_mem_total,
0031 
0032     TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size),
0033 
0034     TP_ARGS(gpu_id, pid, size),
0035 
0036     TP_STRUCT__entry(
0037         __field(uint32_t, gpu_id)
0038         __field(uint32_t, pid)
0039         __field(uint64_t, size)
0040     ),
0041 
0042     TP_fast_assign(
0043         __entry->gpu_id = gpu_id;
0044         __entry->pid = pid;
0045         __entry->size = size;
0046     ),
0047 
0048     TP_printk("gpu_id=%u pid=%u size=%llu",
0049         __entry->gpu_id,
0050         __entry->pid,
0051         __entry->size)
0052 );
0053 
0054 #endif /* _TRACE_GPU_MEM_H */
0055 
0056 /* This part must be outside protection */
0057 #include <trace/define_trace.h>