Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a question regarding the /proc/interrupts file. Let's say for example I had a server with 2xQuad-Core processors (so we have CPU0 to CPU7 ), and with 5 network interfaces.
SMP affinity to all 5 interfaces was set to "ff", so all interfaces have done interrupts on all the processors.
The network interfaces interrupts counters should look like this:
Now let's say I've set the affinity to each of the network interfaces, so that it balances one per processor, so we have 5 processors working only for the network interfaces each processor with it's own eth.
Now let's assume that the network interfaces generate very few interrupts, and that they show up every 5-6 seconds, so watching cat /proc/interrupts doesn`t exactly underline the modifications unless you look with a ruler.
Is there a way to reset the counters on /proc/interrupts so that they all start at 0, without rebooting the system ?
I was thinking that each change in interrupt values does an echo 'cat /some/path/to/some/file/that/contains/the/last/interrupt/value' + 1 > /same/path , and that reset would be a simple echo 0 > /some/path/to/some/file/that/contains/the/last/interrupt/value , to reset the counters, but it`s clearly much more complicated than this.
I don't know about /proc/interrupts but if you for instance look at the kernel source for the /proc/net/netstat counters you'll see the kernel uses a SNMP-like approach to displaying counters, passively emitting values, and most tunables you'd find with 'sysctl -a'.
Nothing is ever that easy. The (kernelspace) code that create the /proc entry determines it attributes. Whether it is writeable from userspace for example - and what to do with anything that is.
For modules exposing (new) data it's easy - for data that already exists, all that generally gets done is exposing the data. Too many codepoints that already use that structure would need (at least) inspection and modification.
In this case the OP could just save the data, then compare it to the previous data each time. Bash awk, perl, python ... pick your favourite.
You could write a driver to do it. The key is that you have to do it from kernel space.
I don't know what would happen if you reset those counters. Should the kernel be using those values for something, someplace, then you could have unexpected consequences.
Easiest just to do it in userspace, keeping the last count and comparing the count you get this time to see what happened in between times.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.