Welcome to the Linux Foundation Forum!

How could I get my program's functions when using perf and converting the data in JSON?

Hello,
I'd like to use the tool perf to know how much time was needed to execute each method of a program I've made in Smalltalk (Pharo), however I'd also like to get the data in JSON through the perf data convert --to-json command after having done perf record ....
For now, it only gives the system calls whereas if I do the perf report > file.txt I get the Smalltalk's methods but the data is not really parsable.
Does anyone have any idea of how I could fix that?

Answers

  • matburnx
    matburnx Posts: 2

    The version of my kernel is 6.8.0
    From the txt file I get something like this :

        12.42%     0.00%  pharo            libPharoVMCore.so                            [.] runOnMainThread (inlined)
                |
                ---runOnMainThread (inlined)
                   runVMThread (inlined)
                   |          
                   |--8.50%--loadPharoImage
                   |          readImageNamed
                   |          allocateMemoryForImagewithHeader.isra.0
                   |          initializeObjectMemory
                   |          |          
                   |           --0.51%--lastPointerOfWhileSwizzling
                   |          
                    --3.93%--interpret
                              enterSmalltalkExecutiveImplementation
                              interpret
                              |          
                               --3.24%--primitiveAllInstances
                                         allInstancesOf
    

    And the JSON file gives me something like this (they do not represent the same sample but come from the same perf.data file) :

    {
    "timestamp": 19015602195292,
    "pid": 19473,
    "tid": 19473,
    "comm": "pharo",
    "callchain": [
    {
        "ip": "0xffffffff92611bfa",
        "symbol": "handle_mm_fault",
        "dso": "[kernel.kallsyms]"
    },
    {
        "ip": "0xffffffff922cb588",
        "symbol": "do_user_addr_fault",
        "dso": "[kernel.kallsyms]"
    },
    {
        "ip": "0xffffffff933e2693",
        "symbol": "exc_page_fault",
        "dso": "[kernel.kallsyms]"
    },
    {
        "ip": "0xffffffff93400ba7",
        "symbol": "asm_exc_page_fault",
        "dso": "[kernel.kallsyms]"
    }
    ]
    },
    

Categories

Upcoming Training