Access to XMOS G4 CPU Load Statistics

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
Post Reply
DrNO
Member++
Posts: 31
Joined: Mon Feb 06, 2012 11:42 pm

Access to XMOS G4 CPU Load Statistics

Post 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?


User avatar
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am
Contact:

Post 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.
Paul

On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am
Contact:

Post 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.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post 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!
Probably not the most confused programmer anymore on the XCORE forum.
mozcelikors
Experienced Member
Posts: 75
Joined: Sat May 07, 2016 11:47 am

Post by mozcelikors »

How do we make the distinction of tiles when using getps to obtain core loads? Thanks
mozcelikors
Experienced Member
Posts: 75
Joined: Sat May 07, 2016 11:47 am

Post 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;
Post Reply