Unable to get gprof working

Unable to get gprof working

par Andrej Gorjan,
Nombre de réponses : 4
Good evening.

I am not sure if the information about 23.5. being the "real" deadline is correct, but if there really is still time, I would like to get the profiler to work.

The first problem I have is that both of the tutorials and other resources I found reference a "System Library" section in the project properties in Eclipse. I am not sure if I have an older or newer version of Eclipse, but I was not able to find this section anywhere.

Instead, I followed this guide
https://www.intel.com/content/dam/altera-www/global/en_US/uploads/3/36/Profiling_Nios_II_Systems_%281%29.pdf
which explains how to do the same thing via command line. I set hal.enable_gprof and hal.enable_exit to true in the settings.bsp file and ran

./create-this-bsp
./create-this-app

respectively. After running make, it looks like the library is being linked, but I am really not sure. In any case, the gmon.out file is not being created. According to this resource
http://cse.unl.edu/~witty/class/csce351/assignment/NIOS/tutorial/ug_nios2_ide_help.pdf
the program must terminate "gracefully" with a call to exit() in order for gmon.out to be created.

I suspect that this is the problem I am having. I have tried both return 0 and exit(0) at the end of main(). After running "nios2-download -g --write-gmon gmon.out *.elf" the gmon.out file is nowhere. Is this program termination really a problem or does this mean that the profiling library was not linked after all? Any help or advice is appreciated.

Best regards,
Andrej Gorjan

En réponse à Andrej Gorjan

Re: Unable to get gprof working

par Isaac Bernardino Dinis,

Hi,

I think full command line is "nios2-download -g --write-gmon gmon_0.out *.elf&&nios2-elf-gprof *.elf gmon_0.out > report_0.txt;"

Hope this helps.

Isaac

En réponse à Isaac Bernardino Dinis

Re: Unable to get gprof working

par Andrej Gorjan,

Thanks for the advice. I was running the two commands separately, but I tried this single one just in case. Sadly I got the same result. The && operator only runs the second command if the first one finishes without errors and since my problem is that the first command is not terminating, it sort of makes sense why it isn't working.

En réponse à Andrej Gorjan

Re: Unable to get gprof working

par René Beuchat,

Hello,

are you running with SDRAM or SRAM. You must have enough memory to have profiling working. 32kiB is enough.

With the 18.1 version of the tools, it should work.

Did you put your Altera timer for gprof, With delay of more than 50-100us for sampling time.

RB

En réponse à René Beuchat

Re: Unable to get gprof working

par Andrej Gorjan,

Hello.

Thank you for the reply. I am using SDRAM, so memory size should not be an issue. Instead, it was a really stupid mistake where I would download the .elf without having a nios2 terminal open in another console. After fixing this, gprof would sometimes work (as described in another forum post), but I was getting all 0% in the report. I think the problem was my timer, since I set the period to be only 1us. According to one of the documents


so I thought a shorter period would lead to more accurate results. When I changed it to 100us like you recommended, I actually managed to get some numbers. Thank you again for the help.

Andrej Gorjan