This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to profile

We are trying to profile code according to spru187S.
In section 3.8.4, it says we need to use "TI_start_pprof_collection", "TI_stop_pprof_collection" to get profile data.
But we don't know which file to include and which lib to link.
Is there a simple sample to demonstrate the profile function?
Thanks.


PS. We are using 6616, cgtools version 7.2.3, ccs version 4.2.3

  • You don't need to include anything.  You link with the ordinary compiler RTS library.  The presentation on this wiki page includes a slide titled Path Profiling, which gives an overview of the process.

    Thanks and regards,

    -George

  • Thanks, I'll try that.

  • I did some search, found _TI_start_pprof_collection and _TI_stop_pprof_collection definition are in Pprof_user.c.

    But there is still some problem when compile with --gen_profile_info.

    When linking, it complains:

    error #10194: symbol "__TI_path_prof_out" used in expression before it has been
       assigned a value

    I also searched for "__TI_path_prof_out", found it is a function in Pprof_cio.c. So why does this happen?

    Best Regargs

    Samhoo

  • Are you compiling pprof_cio.c as part of your build?  Don't do that.  Link the RTS library into your application normally, and the function __TI_path_prof_out will be brought in from that library as needed.

    If that doesn't fix your problem, then I need to see how you are getting this error.  Because I cannot reproduce it.

    Thanks and regards,

    -George

  • I didn't compile pprof_cio.c.

    And the information is strange. If I use a function which has no definition, there would be "error #10234-D: unresolved symbols remain"

    This info “error #10194: symbol "__TI_path_prof_out" used in expression before it has been assigned a value” seems like compiler treat "__TI_path_prof_out" as a variable.

    What information do you need?

    Best Regards

    Samhoo

  • Are you referring to the symbol __TI_path_prof_out in your linker command file?

    -George

  • No. And if not comiling with --gen_profile_info, there would be no problem.

    Best Regards

    Samhoo

  • To summarize ... Everything builds fine.  Then, when you add --gen_profile_info, you get that error message when linking.  Is that right?

    It is likely I will need your whole project to reproduce this.  But let's try one last thing before going to that extreme.  Show me exactly how the compiler is invoked, and everything the compiler dumps out to the command shell, when you build.  I might be able to figure it out from that, but I doubt it.

    Thanks and regards,

    -George 

  • Yes, that's right.

    Maybe I can't provide the project, I'll see what I can do, thanks.

    Best regards

    Samhoo

  • Anyway, we setup another project, and at least we can get pprofout.pdat, generate pprofout.prf. Some codes can generate coverage csv file.

    But in the coverage csv file, all the frequency count are zero.( line number and column number seem to be correct)

    What can be the problem?

    Best regards

    Samhoo

  • Sorry, but I have very little idea what could be wrong.  The data is written out by calling fwrite.  It may not be working properly due to one of the issues described in http://processors.wiki.ti.com/index.php/Tips_for_using_printf .

    Thanks and regards,

    -George

  • We are now using XDS560 emulator. It seems has no "core trace" or "system trace" ability.

    Can it be the reason why we can't get the profile data?

    Best Regards

    Samhoo

  • Neither the path profiling capability, nor the implementation of fwrite, depends upon any trace feature in the emulator.  So, no, that can't be the reason.

    Thanks and regards,

    -George

  • Hi

    I have more or less the same problem with profiling option. 

    I have added the --gen_profile option to the compiler, and I am able to compile and run the code, but I do not get any *.pdat file.

    FYI I do not use a CCS project, instead I invoke the compiler from a command line

    If I call the functions TI_start_pprof_collection() and TI_stop_pprof_collection() from my source code, i get a Linker error

     error LNK2019: unresolved external symbol _TI_start_pprof_collection referenced in function xxx

    I connect to the DSP (C6713) using a XDS510 USB emulator

    Can You tell me which compiler RTC library I need to use?

    Thanks

    Jens Biltoft

  • There is an error in the documentation.  The functions are named _TI_start_pprof_collection and _TI_stop_pprof_collection.  Note the leading underscore.  I apologize for the error.

    As for not getting the .pdat file ...  The data is written by using the fwrite RTS function.  I recommend you write a simple program which does no more than fopen a file and fwrite a line of text to it.  I suspect you will have trouble getting it to work.  Please see this wiki article for help with that.  Once that simple program is working, the profiling fwrite will probably start working.

    Thanks and regards,

    -George

  • Hi

    Thanks for the answer that was helpfull in order to get the correct profil measurement.

    I have also found the reason why I did not get any .pdat file. It was because my code never called the runtime function 'exit()' (or _TI_stop_pprof_collection) , when I made a measurement where I call either of the two functions I end up with a .pdat file in the same directory as the .out file.

    So now I have managed to make a version of my application that is optimized with the --use_profile_info option, but unfortunately it does not reduce my CPU load, in fact the CPU load is increased by 2-3% compared to a version with optimization level -o3.

    regards

    Jens

  • Hi,

    I'm trying to process the profile data generated using the emulator for C6455. The application is compiled for big endian. I'm using CCSV5.1 version. 

    pdd6x -e app.out -o pprofout.prf pprofout.pdat

    I'm getting an error  

    fatal error: Invalid endianness for dataset TIPPRD

    Am I missing something ?

     

    Thanks,

    Balaji

     

  • Balaji Arumugam said:
    fatal error: Invalid endianness for dataset TIPPRD

    The pprofout.pdat file is probably corrupt.  My guess is the fwrite RTS call which dumps out the data is not working properly.  See if this wiki article can help.

    Thanks and regards,

    -George

  • Hi jens,

    I have the exact same problem as you describe in your post. I compile with the option "--gen_profile_info" and use the function TI_start_pprof_collection() but I get the linking error you specified.

    DO you remember how did you solve it? How did you link the RTS library?

    Thanks in advance
    Javier
  • There is an error in the compiler manual.  The RTS implementation of these functions names them _TI_start_pprof_collection and _TI_stop_pprof_collection . The names in the manual are the same, but without the leading underscore "_".  So you need to add "_" to the beginning of the function name.  I apologize for the error.  I filed CODEGEN-1705 in the SDOWP system to have this addressed. You are welcome to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George