0

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?

MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
  • More details would be useful - what range do the timings change over? Do they change for every change you make to the code, or only some bits. Do they change when you don't change the code from run to run? How complex are the functions? Are you using an OS or bare-metal? What kind of memory are you executing from? – Martin Thompson Jul 21 '11 at 15:00
  • No OS, using my own functions, that is, no external libs. – MetallicPriest Jul 21 '11 at 16:48
  • OK, are the answers to any of the other questions instructive? – Martin Thompson Jul 22 '11 at 08:09

1 Answers1

0

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.

Martin Thompson
  • 16,395
  • 1
  • 38
  • 56