Page 1 of 1

Access to XMOS G4 CPU Load Statistics

Posted: Tue Feb 07, 2012 12:22 am
by DrNO
Hello all,
I've been prototyping with the XC-1A and wanted to know if there was a register corresponding to instantaneous CPU load of each core and maybe even the instantaneous MIPS per thread on each Core along with the various channel loads? This will help with easily figuring out the limits of my code. If it does exist could you forward me a link to the documentation?

Re: Access to XMOS G4 CPU Load Statistics

Posted: Tue Feb 07, 2012 4:38 pm
by paul
There is no performance monitoring on the hardware. If your software is simulator friendly (i.e. doesn't require external interfaces etc) then you can produce gprof output - this might be useful to you.

Code: Select all

--gprof                  Enable gprof profiling output
Hope that helps.

Re: Access to XMOS G4 CPU Load Statistics

Posted: Thu Feb 16, 2012 11:09 pm
by segher
If you look at the low bit of getps(0x100*t+4), for t=0..7, it will tell you
for each thread if it is running or not. This will take some cycles to run
of course, and a thread as well, keep that in mind when analysing the data.

Re: Access to XMOS G4 CPU Load Statistics

Posted: Fri Feb 17, 2012 12:40 pm
by lilltroll
segher wrote:If you look at the low bit of getps(0x100*t+4), for t=0..7, it will tell you
for each thread if it is running or not. This will take some cycles to run
of course, and a thread as well, keep that in mind when analysing the data.
That was clever!

Re: Access to XMOS G4 CPU Load Statistics

Posted: Mon Nov 07, 2016 9:13 am
by mozcelikors
How do we make the distinction of tiles when using getps to obtain core loads? Thanks

Re: Access to XMOS G4 CPU Load Statistics

Posted: Mon Nov 07, 2016 10:59 am
by mozcelikors

Code: Select all

void Task_GetCoreStatistics (client core_stats_if core_stats_interface)
{
    short int t;
    timer tmr;
    uint32_t timeelapsed;
    tmr :> timeelapsed;
    int core_load[8];
    while(1)
    {
        select {
            case tmr when timerafter(timeelapsed) :> timeelapsed:
                for (t = 0; t <= 7; t++)
                {
                    core_load[t] = getps(0x100*t+4);  ///I'm not sure how to get lower byte.
                }
                printf("%d %d %d %d %d %d %d %d", core_load[0],
                                                  core_load[1],
                                                  core_load[2],
                                                  core_load[3],
                                                  core_load[4],
                                                  core_load[5],
                                                  core_load[6],
                                                  core_load[7]);
                timeelapsed += 800 * MILLISECOND;
                break;
        }
    }
}
Would something like this help? I wasn't sure how to get the lower byte.

Edit:
Should it be like this?

Code: Select all

core_load[t] = (int) getps(0x100*t+4) >> 4;