Print the module load time in Linux Device Driver while unloading
In Linux Kernel, the number of timer interrupts per second is defined by 'HZ' variable.
You can get the value of HZ Variable by running the following command.
grep 'CONFIG_HZ=' /boot/config-$(uname -r)
For example, if the value is 250, it means there will be 250 timer interrupts per second.
Linux kernel maintains a global variable 'jiffies' which will be incremented for every timer interrupt. So, for every second, it will be incremented by HZ.
Header File: #include <linux/jiffies.h>
extern unsigned long volatile jiffies;
You can get the value of HZ Variable by running the following command.
grep 'CONFIG_HZ=' /boot/config-$(uname -r)
For example, if the value is 250, it means there will be 250 timer interrupts per second.
Linux kernel maintains a global variable 'jiffies' which will be incremented for every timer interrupt. So, for every second, it will be incremented by HZ.
Header File: #include <linux/jiffies.h>
extern unsigned long volatile jiffies;
HZ = (number of ticks)/sec
jiffies = number of ticks
To convert from seconds to unit jiffies: HZ * jiffies
Convert from jiffies to seconds: jiffies/HZ
Code to measure the Driver Load Time:
Output:
ReplyDeleteThanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.Nice article i was really impressed by seeing this article, it was very interesting and it is very useful for me..
python internship | web development internship |internship for mechanical engineering students |mechanical engineering internships |java training in chennai |internship for 1st year engineering students |online internships for cse students |online internship for engineering students |internship for ece students|data science internships |