Hi, How can i compute the ROM, RAM size and runtime consumed by a function in C. For example: void main() { ... f(); } f() { ... ... } How can i compute the RAM, ROM and runtime consumed by the function f() from the listing file and the map file? Please help me. Thanks
If you are using compiler optimisations this is a futile exercise as it can change as you modify other parts of your program. Stefan
hi, Thanks. Iam computing the ROM, RAM and Runtime for both the cases 1. with optimization. 2. Without optimization. With regards Siva
Would you care to tell us why you want to know? This may make it easier to answer your question. Stefan
Sounds like a homework question. RAM would be variables. ROM would be the code and constants. The listing file (.lst) for a .c file generated by the compiler makes this fairly explicit:
MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 1395 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = 24 18 PDATA SIZE = ---- ---- DATA SIZE = ---- 20 IDATA SIZE = ---- ---- BIT SIZE = ---- ---- EDATA SIZE = ---- ---- HDATA SIZE = ---- ---- XDATA CONST SIZE = ---- ---- FAR CONST SIZE = ---- ---- END OF MODULE INFORMATION.
Program Size: data=117.6 xdata=12881 const=977 code=61452 LX51 RUN COMPLETE. 1 WARNING(S), 0 ERROR(S)
Hi, Thank you very much for your reply. First i want to answer Stefan's question. Iam doing my masters thesis in which iam asked to optimize the interfaces (function calls, Macros) of embedded systems inorder to reduce the development cost. It involves the following steps: step 1. Measuring the resources (RAM, ROM and Run time) consumed by different type of function calls. for example Function call with no return value. Function call with return value. Function call with one or more argument with return value and Function call with one or more argument with no return value. step 2. I replace the functions by macros and measure the resources (RAM, ROM and Run time). step3: I repeat the above mentioned steps for different compiler and processor pairs and study the dependencies. Step 4: Provide a methodology or a set of rules which will help in minimizing the development cost. For example: I provide a table at the end of my thesis and the developer can look into the table and say for a fuction call with one argument this much amount of ROM, RAM and runtime is consumed. Iam now in the first step. with regards Siva
Is there someone who is working in the same area. Please let me know. Thanks. --siva
View all questions in Keil forum