To view the network card interrupt binding scenario script

Source: Internet
Author: User

#!/usr/bin/rubycpunum =  '  cat /proc/cpuinfo |grep processor|wc -l '. to_i  before = {}while true  file = file.readlines ('/proc/interrupts ')   puts  "ifname        cpu0        cpu1     cpu2    cpu3     cpu4    cpu5    cpu6    cpu7     cpu8    cpu9    cpu10    cpu11  "   file.each do |i|    if i.include? ("Txrx")        lines = i.split (" ")        print  "#{lines[-1]}:  #{lines[1].to_i - before[" #{lines[-1]}-1 "].to_i}  \t "      print " #{lines[2].to_i - before["#{lines[-1]}-2"].to_i} \t "      print " #{lines[3 ].to_i - before["#{lines[-1]}-3"].to_i} \t "      print " #{ lines[4].to_i - before["#{lines[-1]}-4"].to_i} \t "      print   "#{lines[5].to_i - before[" #{lines[-1]}-5 "].to_i} \t"        print  "#{lines[6].to_i - before[" #{lines[-1]}-6 "].to_i} \t"        print  "#{lines[7].to_i - before[" #{lines[-1]}-7 "].to_i} \t"        if cpunum == 8        puts  "#{lines[8" . to_i - before["#{lines[-1]}-8"].to_i} \t "      elsif cpunum  == 12        print  "#{lines[8].to_i - before ["#{lines[-1]}-8"]. to_i} \t "        print " #{lines[9].to_i - before[ "#{lines[-1]}-9"].to_i} \t "        print " #{lines[10].to_i  - before["#{lines[-1]}-10"].to_i} \t "        print   "#{lines[11].to_i - before[" #{lines[-1]}-11 "].to_i} \t"          puts  "#{lines[12].to_i - before[" #{lines[-1]}-12 "].to_i}"        end      before["#{lines[-1]}-1"] = lines[1]       before["#{lines[-1]}-2"] = lines[2]       before["#{lines[-1]}-3"] = lines[3]      before["#{lines[-1]}-4" ] = lines[4]      before["#{lines[-1]}-5"] = lines[5]       before["#{lines[-1]}-6"] = lines[6]      before["#{lines[-1]}-7"]  = lines[7]      before["#{lines[-1]}-8"] = lines[8]       if cpunum == 12         before["#{lines[-1]}-9"] = lines[9]        before["#{lines[- 1]}-10 "] = lines[10]        before[" #{lines[-1]}-11 "] =  lines[11]        before["#{lines[-1]}-12"] = lines[12]       end    end  end  puts      sleep 2end


This article is from the "Xiaofeng Moon" blog, make sure to keep this source http://kinda22.blog.51cto.com/2969503/1584978

To view the network card interrupt binding scenario script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.