disable cpu

根据我现在的判断,disable cpu 有两种方式。

第一种,在root的时候,进行 disable

Choose 'e' and you get to a command line where you can add options.

You can also create permanent boot option in grub by making a copy of your current boot option and add maxcpus=1 to the boot parameters. You can name this 'Ubuntu, kernel 2.5.12-9-386 (1 cpu)' and have it amongst the other boot options like the picture shows.

You can verify running on 1 cpu by issuing:

cat /proc/cpuinfo   | grep processor this should show something like this:

第二种,进行 Hotplug

You can dynamically disable CPUs via /sys/devices/system/cpu/cpuN/online, for example to disable CPU 1, use:

echo 0 | sudo tee /sys/devices/system/cpu/cpu1/online

cat /sys/devices/system/cpu/online (to check online cpu)
cat /sys/devices/system/cpu/offline (to check offline cpu)
re
-enable, use: echo 1 | sudo tee /sys/devices/system/cpu/cpu1/online

 

见网页:http://askubuntu.com/questions/46011/is-it-possible-to-disable-a-cpu-not-a-core  

    https://www.cyberciti.biz/faq/debian-rhel-centos-redhat-suse-hotplug-cpu/

 

tee 是需要有sudo 权限才能运行的。

转载于:https://www.cnblogs.com/xingzifei/p/6143329.html

看 main() 函数:初始化顺序(时钟→GPIO→PWM→ADC→中断→外设)和 主循环 while(1) 里干啥(通常非实时任务,如保护检测)。关键线索: 找到 中断服务函数(ISR)的名字(比如 PWM1_ISR 或 adc_isr()) 代码如下: #include "DSP28x_Project.h" // Device Headerfile and Examples Include File #include <stdio.h> #include <math.h> // Prototype statements for functions found within this file. /*void InitEPwm1Example(void); void InitEPwm2Example(void); void InitEPwm3Example(void); */ interrupt void epwm1_isr(void); interrupt void adc_isr(void); /*void InitEPwm1SPWM(void); void InitEPwm2SPWM(void); void InitEPwm3SPWM(void); void InitEPwm4SPWM(void); void InitEPwm5SPWM(void); void InitEPwm6SPWM(void); */ //extern volatile Uint16 ePWM_Timer_TBPRD;//? void main(void) { InitSysCtrl(); //第一:初始化PLL得SYSCLKOUT=150MHz,看门狗。且使能ePWM模块时钟。 //更改高速时钟预定标寄存器的值。 EALLOW; SysCtrlRegs.HISPCP.all = 0x3; // HSPCLK = SYSCLKOUT/2*3=25MHZ EDIS; InitEPwmGpio(); InitTzGpio(); //第二:初始化GPIO口,将EPwm设为EPwm输出。 // 第三:中断初始化 Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; // This function is found in the DSP2833x_PieCtrl.c file. InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; InitPieVectTable(); EALLOW; PieVectTable.EPWM1_INT = &epwm1_isr; PieVectTable.ADCINT = &adc_isr; EDIS; // This is needed to disable write to EALLOW protected registers //ePWM模块的初始化 EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; EDIS; InitEPwm(); InitAdc(); EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;//目的就是保证ePWM各模块时钟同步 EDIS; // Step 5. User specific code, enable interrupts // Enable CPU INT3 which is connected to EPWM1-3 INT: IER |= M_INT3; IER |= M_INT1; // Enable EPWM INTn in the PIE: Group 3 interrupt 1-3 PieCtrlRegs.PIEIER3.bit.INTx1 = 1; //使能ePWM1中断,第三行,第一个 PieCtrlRegs.PIEIER1.bit.INTx6 = 1; //使能ADC中断,第一行,第六个 // Enable global Interrupts and higher priority real-time debug events: EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM // Step 6. IDLE loop. Just sit and loop forever (optional): for(;;) { asm(" NOP"); } } //=========================================================================== // No more. //===========================================================================
最新发布
06-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值