代码修改后,Microblaze 上的运行时间有所不同
当我对在 Microblaze 上运行的代码进行一些修改时,有时会发现遵循相同路径的代码执行在运行时存在很大差异。为了说明,我所说的相同路径的真正含义,以这个例子为例,
if ( condition )
execute_this();
else
execute_that(); // Modified this function
也就是说,如果我修改了函数 execute_that
的代码,即使 condition
为set 和函数 execute_this
尚未修改。什么会导致这种情况?函数的内存对齐?缓存?有什么线索吗?
When I do some modifications in my code that runs on Microblaze, I sometimes see a large discrepancy in runtime for the execution of code that follows the same path. To illustrate, what I really mean by same path, take this example,
if ( condition )
execute_this();
else
execute_that(); // Modified this function
So say if I modified the code for function execute_that
, I would see change in runtime even when condition
was set and function execute_this
has not been modified. What can cause this? Memory Alignment of Functions? Cache? Any clue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您更改其他函数时,时间是否仅发生变化,或者无论如何它都是可变的?
您正在运行操作系统吗?其他任务会抢先你的任务吗?
中断正在运行吗?函数期间的中断将改变运行时间。
是的,缓存效应可能会导致这种情况。
Does the timing only change when you change the other function, or is it variable anyway?
Are you running an OS? Could other tasks pre-empt yours?
Are interrupts running? An interrupt during your function will change the runtime.
And, yes, cache effects could cause this.