xref: /linux/include/trace/events/timestamp.h (revision 79d2e1919a2728ef49d938eb20ebd5903c14dfb0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM timestamp
4 
5 #if !defined(_TRACE_TIMESTAMP_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_TIMESTAMP_H
7 
8 #include <linux/tracepoint.h>
9 #include <linux/fs.h>
10 
11 #define CTIME_QUERIED_FLAGS \
12 	{ I_CTIME_QUERIED, "Q" }
13 
14 DECLARE_EVENT_CLASS(ctime,
15 	TP_PROTO(struct inode *inode,
16 		 struct timespec64 *ctime),
17 
18 	TP_ARGS(inode, ctime),
19 
20 	TP_STRUCT__entry(
21 		__field(dev_t,		dev)
22 		__field(ino_t,		ino)
23 		__field(time64_t,	ctime_s)
24 		__field(u32,		ctime_ns)
25 		__field(u32,		gen)
26 	),
27 
28 	TP_fast_assign(
29 		__entry->dev		= inode->i_sb->s_dev;
30 		__entry->ino		= inode->i_ino;
31 		__entry->gen		= inode->i_generation;
32 		__entry->ctime_s	= ctime->tv_sec;
33 		__entry->ctime_ns	= ctime->tv_nsec;
34 	),
35 
36 	TP_printk("ino=%d:%d:%ld:%u ctime=%lld.%u",
37 		MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen,
38 		__entry->ctime_s, __entry->ctime_ns
39 	)
40 );
41 
42 DEFINE_EVENT(ctime, inode_set_ctime_to_ts,
43 		TP_PROTO(struct inode *inode,
44 			 struct timespec64 *ctime),
45 		TP_ARGS(inode, ctime));
46 
47 DEFINE_EVENT(ctime, ctime_xchg_skip,
48 		TP_PROTO(struct inode *inode,
49 			 struct timespec64 *ctime),
50 		TP_ARGS(inode, ctime));
51 
52 TRACE_EVENT(ctime_ns_xchg,
53 	TP_PROTO(struct inode *inode,
54 		 u32 old,
55 		 u32 new,
56 		 u32 cur),
57 
58 	TP_ARGS(inode, old, new, cur),
59 
60 	TP_STRUCT__entry(
61 		__field(dev_t,		dev)
62 		__field(ino_t,		ino)
63 		__field(u32,		gen)
64 		__field(u32,		old)
65 		__field(u32,		new)
66 		__field(u32,		cur)
67 	),
68 
69 	TP_fast_assign(
70 		__entry->dev		= inode->i_sb->s_dev;
71 		__entry->ino		= inode->i_ino;
72 		__entry->gen		= inode->i_generation;
73 		__entry->old		= old;
74 		__entry->new		= new;
75 		__entry->cur		= cur;
76 	),
77 
78 	TP_printk("ino=%d:%d:%ld:%u old=%u:%s new=%u cur=%u:%s",
79 		MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen,
80 		__entry->old & ~I_CTIME_QUERIED,
81 		__print_flags(__entry->old & I_CTIME_QUERIED, "|", CTIME_QUERIED_FLAGS),
82 		__entry->new,
83 		__entry->cur & ~I_CTIME_QUERIED,
84 		__print_flags(__entry->cur & I_CTIME_QUERIED, "|", CTIME_QUERIED_FLAGS)
85 	)
86 );
87 
88 TRACE_EVENT(fill_mg_cmtime,
89 	TP_PROTO(struct inode *inode,
90 		 struct timespec64 *ctime,
91 		 struct timespec64 *mtime),
92 
93 	TP_ARGS(inode, ctime, mtime),
94 
95 	TP_STRUCT__entry(
96 		__field(dev_t,		dev)
97 		__field(ino_t,		ino)
98 		__field(time64_t,	ctime_s)
99 		__field(time64_t,	mtime_s)
100 		__field(u32,		ctime_ns)
101 		__field(u32,		mtime_ns)
102 		__field(u32,		gen)
103 	),
104 
105 	TP_fast_assign(
106 		__entry->dev		= inode->i_sb->s_dev;
107 		__entry->ino		= inode->i_ino;
108 		__entry->gen		= inode->i_generation;
109 		__entry->ctime_s	= ctime->tv_sec;
110 		__entry->mtime_s	= mtime->tv_sec;
111 		__entry->ctime_ns	= ctime->tv_nsec;
112 		__entry->mtime_ns	= mtime->tv_nsec;
113 	),
114 
115 	TP_printk("ino=%d:%d:%ld:%u ctime=%lld.%u mtime=%lld.%u",
116 		MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen,
117 		__entry->ctime_s, __entry->ctime_ns,
118 		__entry->mtime_s, __entry->mtime_ns
119 	)
120 );
121 #endif /* _TRACE_TIMESTAMP_H */
122 
123 /* This part must be outside protection */
124 #include <trace/define_trace.h>
125