LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 12-07-2010, 09:12 AM   #1
lordbone
LQ Newbie
 
Registered: May 2009
Posts: 13

Rep: Reputation: 0
Clearing /proc/interrupts counters


Hello,

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:

24: 32650776 32670506 50315017 32677739 32672119 32677935 32656299 32667496 IO-APIC-fasteoi eth2
27: 35233448 35285546 35317201 52657622 35315835 35339998 35221092 35246597 IO-APIC-fasteoi eth3
55: 37573056 35870363 35874607 35858010 37728061 35880275 35882340 35882127 PCI-MSI-edge eth1
56: 35861392 35863516 35865123 35865342 35864604 40515822 35861250 35863585 PCI-MSI-edge eth0
58: 30173318 30109146 30002990 30016870 30084937 30034759 46517278 30139103 PCI-MSI-edge eth4

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 ?

Cheers,

Last edited by lordbone; 12-07-2010 at 09:21 AM.
 
Old 12-07-2010, 05:42 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by lordbone View Post
Is there a way to reset the counters on /proc/interrupts so that they all start at 0, without rebooting the system ?
AFAIK not.
 
Old 12-07-2010, 06:04 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
And a quick look at the code would appear to confirm that. It merely passes back the counter - no logic to accept input from userspace.
 
Old 12-08-2010, 09:33 AM   #4
lordbone
LQ Newbie
 
Registered: May 2009
Posts: 13

Original Poster
Rep: Reputation: 0
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.
 
Old 12-08-2010, 10:54 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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'.
 
Old 12-08-2010, 04:07 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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.
 
Old 12-08-2010, 04:21 PM   #7
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/proc/net/dev packet counters question shibeaux Linux - Networking 6 08-25-2010 02:23 PM
Can anyone please explain about "Function call interrupts" entry in /proc/interrupts? cyclops.xmen Linux - Software 2 12-09-2009 12:13 PM
what is /proc/interrupts & /proc/irq/*/spurious mean? nesta Linux - Embedded & Single-board computer 2 06-16-2009 09:33 AM
protential IRQ conflict ??? results of /proc/interrupts feetyouwell Red Hat 1 01-02-2004 09:32 PM
see this output of /proc/interrupts bmahesh Linux - Hardware 5 09-19-2003 02:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration