禁用 Linux 调度程序来测量特定机器代码指令的功耗
我怎样才能在Linux中运行一个程序,该程序运行大约10000次移位指令而不被调度程序中断?我想这样做是为了检查本机移位指令的功耗。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非需要运行其他任务,否则调度程序不会中断您的任务。不过,硬件中断(例如定时器)会发生,并且会中断一段时间,但通常不会很长时间。
然而,我真的不确定衡量特定指令的能力有何相关性;现代CPU实际上并不是这样工作的——它们不会一次只运行一条指令,并且没有“真正的”程序只使用单一类型的指令。
我认为硬件中断的影响不会很大,特别是如果您正在运行“无滴答”内核(通常在较新的系统上默认启用)。
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.
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).