Use perf report taking symbols from a specific binary file












1















I'm collecting data with



perf record -o "filename.here" -a --call-graph dwarf -p `pidof binary.here`


And reading it with



perf report -i "filename.here"


However this stops working when my live binary gets changed/rebuilt (due to me constantly updating it since it's a work in progress) saying "binary with build id XXX cannot be found". I am saving the old binary for which I collected data but it seems there's no way for perf report to explicitly load a specific binary (there's the --symfs option but that's to look for ALL debug symbols there for all libraries/etc which is also not a solution).



One other solution would be to stop the live binary and copy paste the backed up binary instead of it, but I can't afford to stop the live binary just to do this. Another solution would be to copy the backed up binary on a different server so I can store it in the same path perf is trying to search for it.



Is there any actual better solution for this?










share|improve this question


















  • 1





    Why would you have to stop the live binary? You could temporarily rename it, and symlink or hardlink the binary that matches your profile data to that name. (Ugly, but works fine unless the running process tries to re-exec itself right then.) You can even unlink a binary while processes are running from it, but then you won't be able to link it back into the filesystem.) There's hopefully a better solution with perf command line options, but I haven't looked.

    – Peter Cordes
    Jan 1 at 22:11











  • I remember doing that long time ago and it instantly crashed (worth mentioning I run it under gdb all the time, maybe related?). However I did that now and seeks to be ok, thanks. Still, a perf command line would be better

    – Shocker
    Jan 2 at 12:42


















1















I'm collecting data with



perf record -o "filename.here" -a --call-graph dwarf -p `pidof binary.here`


And reading it with



perf report -i "filename.here"


However this stops working when my live binary gets changed/rebuilt (due to me constantly updating it since it's a work in progress) saying "binary with build id XXX cannot be found". I am saving the old binary for which I collected data but it seems there's no way for perf report to explicitly load a specific binary (there's the --symfs option but that's to look for ALL debug symbols there for all libraries/etc which is also not a solution).



One other solution would be to stop the live binary and copy paste the backed up binary instead of it, but I can't afford to stop the live binary just to do this. Another solution would be to copy the backed up binary on a different server so I can store it in the same path perf is trying to search for it.



Is there any actual better solution for this?










share|improve this question


















  • 1





    Why would you have to stop the live binary? You could temporarily rename it, and symlink or hardlink the binary that matches your profile data to that name. (Ugly, but works fine unless the running process tries to re-exec itself right then.) You can even unlink a binary while processes are running from it, but then you won't be able to link it back into the filesystem.) There's hopefully a better solution with perf command line options, but I haven't looked.

    – Peter Cordes
    Jan 1 at 22:11











  • I remember doing that long time ago and it instantly crashed (worth mentioning I run it under gdb all the time, maybe related?). However I did that now and seeks to be ok, thanks. Still, a perf command line would be better

    – Shocker
    Jan 2 at 12:42
















1












1








1








I'm collecting data with



perf record -o "filename.here" -a --call-graph dwarf -p `pidof binary.here`


And reading it with



perf report -i "filename.here"


However this stops working when my live binary gets changed/rebuilt (due to me constantly updating it since it's a work in progress) saying "binary with build id XXX cannot be found". I am saving the old binary for which I collected data but it seems there's no way for perf report to explicitly load a specific binary (there's the --symfs option but that's to look for ALL debug symbols there for all libraries/etc which is also not a solution).



One other solution would be to stop the live binary and copy paste the backed up binary instead of it, but I can't afford to stop the live binary just to do this. Another solution would be to copy the backed up binary on a different server so I can store it in the same path perf is trying to search for it.



Is there any actual better solution for this?










share|improve this question














I'm collecting data with



perf record -o "filename.here" -a --call-graph dwarf -p `pidof binary.here`


And reading it with



perf report -i "filename.here"


However this stops working when my live binary gets changed/rebuilt (due to me constantly updating it since it's a work in progress) saying "binary with build id XXX cannot be found". I am saving the old binary for which I collected data but it seems there's no way for perf report to explicitly load a specific binary (there's the --symfs option but that's to look for ALL debug symbols there for all libraries/etc which is also not a solution).



One other solution would be to stop the live binary and copy paste the backed up binary instead of it, but I can't afford to stop the live binary just to do this. Another solution would be to copy the backed up binary on a different server so I can store it in the same path perf is trying to search for it.



Is there any actual better solution for this?







linux perf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 1 at 20:44









ShockerShocker

1,230921




1,230921








  • 1





    Why would you have to stop the live binary? You could temporarily rename it, and symlink or hardlink the binary that matches your profile data to that name. (Ugly, but works fine unless the running process tries to re-exec itself right then.) You can even unlink a binary while processes are running from it, but then you won't be able to link it back into the filesystem.) There's hopefully a better solution with perf command line options, but I haven't looked.

    – Peter Cordes
    Jan 1 at 22:11











  • I remember doing that long time ago and it instantly crashed (worth mentioning I run it under gdb all the time, maybe related?). However I did that now and seeks to be ok, thanks. Still, a perf command line would be better

    – Shocker
    Jan 2 at 12:42
















  • 1





    Why would you have to stop the live binary? You could temporarily rename it, and symlink or hardlink the binary that matches your profile data to that name. (Ugly, but works fine unless the running process tries to re-exec itself right then.) You can even unlink a binary while processes are running from it, but then you won't be able to link it back into the filesystem.) There's hopefully a better solution with perf command line options, but I haven't looked.

    – Peter Cordes
    Jan 1 at 22:11











  • I remember doing that long time ago and it instantly crashed (worth mentioning I run it under gdb all the time, maybe related?). However I did that now and seeks to be ok, thanks. Still, a perf command line would be better

    – Shocker
    Jan 2 at 12:42










1




1





Why would you have to stop the live binary? You could temporarily rename it, and symlink or hardlink the binary that matches your profile data to that name. (Ugly, but works fine unless the running process tries to re-exec itself right then.) You can even unlink a binary while processes are running from it, but then you won't be able to link it back into the filesystem.) There's hopefully a better solution with perf command line options, but I haven't looked.

– Peter Cordes
Jan 1 at 22:11





Why would you have to stop the live binary? You could temporarily rename it, and symlink or hardlink the binary that matches your profile data to that name. (Ugly, but works fine unless the running process tries to re-exec itself right then.) You can even unlink a binary while processes are running from it, but then you won't be able to link it back into the filesystem.) There's hopefully a better solution with perf command line options, but I haven't looked.

– Peter Cordes
Jan 1 at 22:11













I remember doing that long time ago and it instantly crashed (worth mentioning I run it under gdb all the time, maybe related?). However I did that now and seeks to be ok, thanks. Still, a perf command line would be better

– Shocker
Jan 2 at 12:42







I remember doing that long time ago and it instantly crashed (worth mentioning I run it under gdb all the time, maybe related?). However I did that now and seeks to be ok, thanks. Still, a perf command line would be better

– Shocker
Jan 2 at 12:42














1 Answer
1






active

oldest

votes


















2














That message:



binary with build id XXX cannot be found


Is there because perf record will, at the end of the recording phase, save a copy of the binaries with samples, so that if you later update it, no problem, that specific binary was saved under ~/.debug/.build/id/AA/BBCCDDEEFF001122 and that is what perf report and other consumers will lookup.



Then this is a matter of figuring out why that build id is not being found. Are you using both 'perf record' and 'perf report' in the same machine?



Also what:



perf buildid-list -i filename.here


Says?



Look at your ~/.debug/ directory for that file.



perf buildid-list -i /path/to/binary


will tell you the buildid for a binary.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53998800%2fuse-perf-report-taking-symbols-from-a-specific-binary-file%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    That message:



    binary with build id XXX cannot be found


    Is there because perf record will, at the end of the recording phase, save a copy of the binaries with samples, so that if you later update it, no problem, that specific binary was saved under ~/.debug/.build/id/AA/BBCCDDEEFF001122 and that is what perf report and other consumers will lookup.



    Then this is a matter of figuring out why that build id is not being found. Are you using both 'perf record' and 'perf report' in the same machine?



    Also what:



    perf buildid-list -i filename.here


    Says?



    Look at your ~/.debug/ directory for that file.



    perf buildid-list -i /path/to/binary


    will tell you the buildid for a binary.






    share|improve this answer






























      2














      That message:



      binary with build id XXX cannot be found


      Is there because perf record will, at the end of the recording phase, save a copy of the binaries with samples, so that if you later update it, no problem, that specific binary was saved under ~/.debug/.build/id/AA/BBCCDDEEFF001122 and that is what perf report and other consumers will lookup.



      Then this is a matter of figuring out why that build id is not being found. Are you using both 'perf record' and 'perf report' in the same machine?



      Also what:



      perf buildid-list -i filename.here


      Says?



      Look at your ~/.debug/ directory for that file.



      perf buildid-list -i /path/to/binary


      will tell you the buildid for a binary.






      share|improve this answer




























        2












        2








        2







        That message:



        binary with build id XXX cannot be found


        Is there because perf record will, at the end of the recording phase, save a copy of the binaries with samples, so that if you later update it, no problem, that specific binary was saved under ~/.debug/.build/id/AA/BBCCDDEEFF001122 and that is what perf report and other consumers will lookup.



        Then this is a matter of figuring out why that build id is not being found. Are you using both 'perf record' and 'perf report' in the same machine?



        Also what:



        perf buildid-list -i filename.here


        Says?



        Look at your ~/.debug/ directory for that file.



        perf buildid-list -i /path/to/binary


        will tell you the buildid for a binary.






        share|improve this answer















        That message:



        binary with build id XXX cannot be found


        Is there because perf record will, at the end of the recording phase, save a copy of the binaries with samples, so that if you later update it, no problem, that specific binary was saved under ~/.debug/.build/id/AA/BBCCDDEEFF001122 and that is what perf report and other consumers will lookup.



        Then this is a matter of figuring out why that build id is not being found. Are you using both 'perf record' and 'perf report' in the same machine?



        Also what:



        perf buildid-list -i filename.here


        Says?



        Look at your ~/.debug/ directory for that file.



        perf buildid-list -i /path/to/binary


        will tell you the buildid for a binary.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 4 at 8:44









        osgx

        58.1k33246410




        58.1k33246410










        answered Jan 2 at 21:41









        Arnaldo MeloArnaldo Melo

        412




        412
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53998800%2fuse-perf-report-taking-symbols-from-a-specific-binary-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            'app-layout' is not a known element: how to share Component with different Modules

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            WPF add header to Image with URL pettitions [duplicate]