禁用Linux Scheduler以计量特定机器代码指令的功耗

时间:2021-11-09 02:13:26

how can i run a programm in linux thats runs about 10000 times a shift instruction without it being interrupted by the scheduler? I want to do so in order to examine power consumption of the native shift instruction.

我如何在linux中运行一个程序,运行大约10000次移位指令而不被调度程序中断?我想这样做是为了检查原生移位指令的功耗。

1 个解决方案

#1


0  

The scheduler is not going to interrupt your task unless something else needs to run. Hardware interrupts (e.g. timers) will happen though, and they interrupt it for a while, but not very long normally.

除非需要运行其他东西,否则调度程序不会中断您的任务。硬件中断(例如定时器)会发生,并且它们会中断一段时间,但通常不会很长。

However, I'm really not sure how measuring the power of a particular instruction is relevant; modern CPUs don't really work like that - they don't ever run just one instruction at once, and no "real" program uses just a single type of instruction.

但是,我真的不确定如何测量特定指令的功效是否相关;现代CPU并没有真正起作用 - 它们不会一次只运行一条指令,而“真正的”程序只使用一种类型的指令。

I don't think the impact of hardware interrupts is going to be very much, especially if you're running a "tickless" kernel (which is usually enabled by default on newer systems).

我不认为硬件中断的影响会非常大,特别是如果你运行的是“无空闲”内核(通常在新系统上默认启用)。

#1


0  

The scheduler is not going to interrupt your task unless something else needs to run. Hardware interrupts (e.g. timers) will happen though, and they interrupt it for a while, but not very long normally.

除非需要运行其他东西,否则调度程序不会中断您的任务。硬件中断(例如定时器)会发生,并且它们会中断一段时间,但通常不会很长。

However, I'm really not sure how measuring the power of a particular instruction is relevant; modern CPUs don't really work like that - they don't ever run just one instruction at once, and no "real" program uses just a single type of instruction.

但是,我真的不确定如何测量特定指令的功效是否相关;现代CPU并没有真正起作用 - 它们不会一次只运行一条指令,而“真正的”程序只使用一种类型的指令。

I don't think the impact of hardware interrupts is going to be very much, especially if you're running a "tickless" kernel (which is usually enabled by default on newer systems).

我不认为硬件中断的影响会非常大,特别是如果你运行的是“无空闲”内核(通常在新系统上默认启用)。