博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
对网卡中断绑定的脚本
阅读量:6267 次
发布时间:2019-06-22

本文共 3185 字,大约阅读时间需要 10 分钟。

1 service irqbalance stop 2  3 #@irqnum:网卡eth2的中断数 4 #@cpunum:CPU数目 5 irqnum=`cat /proc/interrupts | grep eth2.*- | awk -F : '{print $1}' | awk '{print $1}'` 6 cpunum=`cat /proc/cpuinfo | grep processor | wc -l` 7 param=1 8 count=0 9 10 for n in $irqnum11 do12         value=`printf "%08x" $param`   //转化为16进制13         awk -F , -v a=$value 'BEGIN{OFS=","}{$NF="";print $0 a}' /proc/irq/$n/smp_affinity > /proc/irq/$n/smp_affinity14         param=`expr $param \* 2`15         count=`expr $count + 1`16         if [ $count -eq $cpunum ];then  17                 count=018                 param=119         fi20         echo `cat /proc/irq/$n/smp_affinity`21 done

 

1.irqbalance 的介绍
irqbalance 用于优化中断分配,它会自动收集系统数据以分析使用模式,并依据系统负载状况将工作状态置于 Performance mode 或 Power-save mode.处于 Performance mode时irqbalance 会将中断尽可能均匀地分发给各个CPU以充分利用 CPU 多核,提升性能.处于 Power-save mode时,irqbalance 会将中断集中分配给第一个 CPU,以保证其它空闲 CPU 的睡眠时间,降低能耗
 
2.AWK中
 
There is an important difference between
 
print $2 $3
 
and
 
print $2, $3
 
The first example prints out one field, and the second prints out two fields. In the first case, the two positional parameters are concatenated together and output without a space. In the second case, AWK prints two fields, and places the output field separator between them. Normally this is a space, but you can change this by modifying the variable "OFS".
 
3. AWK中 
 
The essential organization of an AWK program follows the form:
 
pattern { action }
 
The pattern specifies when the action is performed. Like most UNIX utilities, AWK is line oriented. That is, the pattern specifies a test that is performed with each line read as input. If the condition is true, then the action is taken. The default pattern is something that matches every line. This is the blank or null pattern. Two other important patterns are specified by the keywords "BEGIN" and "END". As you might expect, these two words specify actions to be taken before any lines are read, and after the last line is read. The AWK program below:
 
BEGIN { print "START" }
      { print        }
END  { print "STOP"  }
 
adds one line before and one line after the input file. This isn't very useful, but with a simple change, we can make this into a typical AWK program:
 
BEGIN { print "File\tOwner"}
{ print $8, "\t", $3}
END { print " - DONE -" }
 
4. AWK中 
 
1.It is useful to know how many fields are on a line.
 
2.Don't forget the variable can be prepended with a "$". This allows you to print the last field of any column
 
 
问题:
1.为什么要将中断绑定到固定CPU
In order to achieve the best performance, it is recommended that all the interruptions generated by a device
queue is handled by the same CPU, instead of IRQ balancing. Although it is not expected, round robin IRQ
distribution is not good for performance because when the interruption go to another fresh CPU, the new CPU
probably will not have the interrupt handler function in the cache, and a long time will be required to get the
properly interrupt handler from the main memory and run it. On the other hand, if the same CPU handles the
same IRQ almost all the time, the IRQ handler function will unlikely leave the CPU cache, boosting the kernel
performance。
 
参考:
 
 
 
 

 

转载于:https://www.cnblogs.com/lxgeek/p/4105234.html

你可能感兴趣的文章
前端如何接收 websocket 发送过来的实时数据
查看>>
JavaWeb下载文件response
查看>>
Laravel的三种安装方法总结
查看>>
SpringMVC加载配置Properties文件的几种方式
查看>>
C#设计模式总结 C#设计模式(22)——访问者模式(Vistor Pattern) C#设计模式总结 .NET Core launch.json 简介 利用Bootstrap Paginat...
查看>>
java 项目相关 学习笔记
查看>>
numpy opencv matlab eigen SVD结果对比
查看>>
WPF获取某控件的位置,也就是偏移量
查看>>
Boost C++ 库 中文教程(全)
查看>>
solr查询优化(实践了一下效果比较明显)
查看>>
jdk目录详解及其使用方法
查看>>
说说自己对RESTful API的理解s
查看>>
通过layout实现可拖拽自动排序的UICollectionView
查看>>
服务器错误码
查看>>
javascript中的面向对象
查看>>
Splunk作为日志分析平台与Ossec进行联动
查看>>
yaffs文件系统
查看>>
Mysql存储过程
查看>>
NC营改增
查看>>
Lua
查看>>