Merge tag 'for-linus-5.14-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / include / trace / trace_events.h
index 8268bf7..acc1719 100644 (file)
@@ -358,6 +358,21 @@ TRACE_MAKE_SYSTEM_STR();
        trace_print_hex_dump_seq(p, prefix_str, prefix_type,            \
                                 rowsize, groupsize, buf, len, ascii)
 
+#undef __print_ns_to_secs
+#define __print_ns_to_secs(value)                      \
+       ({                                              \
+               u64 ____val = (u64)(value);             \
+               do_div(____val, NSEC_PER_SEC);          \
+               ____val;                                \
+       })
+
+#undef __print_ns_without_secs
+#define __print_ns_without_secs(value)                 \
+       ({                                              \
+               u64 ____val = (u64)(value);             \
+               (u32) do_div(____val, NSEC_PER_SEC);    \
+       })
+
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
 static notrace enum print_line_t                                       \
@@ -736,6 +751,16 @@ static inline void ftrace_test_probe_##call(void)                  \
 #undef __print_array
 #undef __print_hex_dump
 
+/*
+ * The below is not executed in the kernel. It is only what is
+ * displayed in the print format for userspace to parse.
+ */
+#undef __print_ns_to_secs
+#define __print_ns_to_secs(val) (val) / 1000000000UL
+
+#undef __print_ns_without_secs
+#define __print_ns_without_secs(val) (val) % 1000000000UL
+
 #undef TP_printk
 #define TP_printk(fmt, args...) "\"" fmt "\", "  __stringify(args)