Ive been trying to determine which functions and/or code sections are the more computationally consuming within a work() function of a block.
For doing this in ubuntu, which is my OS, almost all the references i found recommend to use clock_t clock() found in time.h. This function does not work with seconds, but with clock ticks, however, it is easy to get the corresponding time in seconds by using the CLOCKS_PER_SEC constant. So basically i get the value of clock() before executing a section of code, save it, then get the value after the section is executed, calculate the difference, and normalize by clocks_per_Sec. So far so good, now the problem i am experiencing is that when i manage to optimize a section of code, so its execution time decreases, other section's execution time start to increase, and both sections are independent from each other. This does not make any sense, since i am not measuring the percentage consumed by each section, but the absolute time of execution, and if the sections are independent it should not change. For example, the exact scenario i have is: clockA = clock(); { .. //Section A .. } clockAEnd = clock(); calculatetime(clockA, clockAEnd); clockB = clock(); { .. //Section B .. } clockBEnd = clock(); calculatetime(clockB, clockBEnd); By optimizing section B, for some reason section A supposedly starts consuming more execution time, even though it ALWAYS execute before, so changes in B cannot have any effects whatsoever in A, and also, the function is run exactly the same number of times when comparing the cases with optimization to b, and without optimization to b.
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio