Last active
January 22, 2016 11:27
-
-
Save stefano-garzarella/c35c9f7263dbb8d19f11 to your computer and use it in GitHub Desktop.
Linux kprintf with some debug info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _dprintk(_fmt, ... )\ | |
do { \ | |
struct timeval _t0; \ | |
do_gettimeofday(&_t0); \ | |
printk(KERN_ERR "%03d.%06d %s():%d - " _fmt "%s\n", \ | |
(int)(_t0.tv_sec % 1000), (int)_t0.tv_usec, \ | |
__func__, __LINE__, __VA_ARGS__); \ | |
} while (0); | |
#define sprintk(...) _dprintk(__VA_ARGS__, "") | |
#ifdef PDEBUG | |
#define dprintk(...) _dprintk(__VA_ARGS__, "") | |
#else | |
#define dprintk(...) do {} while(0); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment