On Tue, 24 Dec 2013, Smilen Dimitrov wrote: > Hi all, > > Apologies for somewhat of a cross-post; I have already tried to ask about this here: > > Reliable Linux kernel timestamps (or adjustment thereof) with both usbmon and ftrace? > http://stackoverflow.com/questions/20417897/reliable-linux-kernel-timestamps-or-adjustment-thereof-with-both-usbmon-and-ft > > ... but that question doesn't seem to attract much attention, so hope it's OK to try my luck here. I'll just copy paste that question verbatim below: This was a long and rather rambling message. The main points I gathered from it were: You are using a very old kernel version. You really should use something more up-to-date, if at all possible. You are trying to combine ftrace with usbmon. I know extremely little about ftrace, so I can't help you there. You want to know how to correlate kernel time values with the timestamps produced by usbmon. The last part is easy enough to do. You can call the following subroutine to get a usbmon-style timestamp value, which can then be added to an ftrace message or simply printed in the kernel log: #include <linux/time.h> static unsigned usbmon_timestamp(void) { struct timeval tval; unsigned stamp; do_gettimeofday(&tval); stamp = tval.tv_sec & 0xFFF; stamp = stamp * 1000000 + tval.tv_usec; return stamp; } For example, pr_info("The usbmon time is: %u\n", usbmon_timestamp()); Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html