• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * drivers/staging/android/ion/ion-trace.h
4  *
5  * Copyright (C) 2020 Google, Inc.
6  */
7 
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM ion
10 
11 #if !defined(_ION_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _ION_TRACE_H
13 
14 #include <linux/tracepoint.h>
15 
16 #ifndef __ION_PTR_TO_HASHVAL
__ion_ptr_to_hash(const void * ptr)17 static unsigned int __maybe_unused __ion_ptr_to_hash(const void *ptr)
18 {
19 	unsigned long hashval;
20 
21 	if (ptr_to_hashval(ptr, &hashval))
22 		return 0;
23 
24 	/* The hashed value is only 32-bit */
25 	return (unsigned int)hashval;
26 }
27 
28 #define __ION_PTR_TO_HASHVAL
29 #endif
30 
31 TRACE_EVENT(ion_stat,
32 	    TP_PROTO(const void *addr, long len,
33 		     unsigned long total_allocated),
34 	    TP_ARGS(addr, len, total_allocated),
35 	    TP_STRUCT__entry(__field(unsigned int, buffer_id)
36 		__field(long, len)
37 		__field(unsigned long, total_allocated)
38 	    ),
39 	    TP_fast_assign(__entry->buffer_id = __ion_ptr_to_hash(addr);
40 		__entry->len = len;
41 		__entry->total_allocated = total_allocated;
42 	    ),
43 	    TP_printk("buffer_id=%u len=%ldB total_allocated=%ldB",
44 		      __entry->buffer_id,
45 		      __entry->len,
46 		      __entry->total_allocated)
47 	    );
48 
49 #endif /* _ION_TRACE_H */
50 
51 /* This part must be outside protection */
52 #undef TRACE_INCLUDE_PATH
53 #define TRACE_INCLUDE_PATH .
54 #define TRACE_INCLUDE_FILE ion_trace
55 #include <trace/define_trace.h>
56