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.

graphing struct members in CCS

I'd like to use the graph-> single time feature in CCS v3.3 to look at a single member from an array of structs for the entire array.  If I use the name of the array of structs as the start address and use the struct size as the index offset, I can examine the first member.  I've tried several different ways to access the other members, but nothing works short of hard coding the member address (as in typing in the hex value, using &structArray + 1 and similar variations gave me garbage).  Is there any other way to accomplish this?

  • Matt,

    I managed to display arrays of structs (which contain arrays as its members) in graphs in CCSv3.3, but I had to use the literal variable names with the array indexes - I could not use an indexer for each member of the array of structs.

    Just FYI, I send the project I used attached and a screenshot is shown at the end of this post. I am using everything static and global, since the graph tool may be confused if a local variable is used (especially because the compiler can potentially store it in a register).

     Hope this helps,

    Rafael

    CPP_test.zip
  • This is not quite what I had in mind.  I am storing a large amount of statistics each iteration of a program, so I used a structure:

    typedef struct {

    Int32 data1;

    Int32 data2;

    ...

    Int32 datan;

    } STAT_ELEMENT;

    And then declared an array of these structs

    STAT_ELEMENT statArray[4096];

    I organized it this way to optimize cache locality, since I would get a cache miss for every element every time through the loop if I had a separate array for each struct member.

    As I said earlier, if I enter "statArray" into the start address and enter the number of elements in the struct into the index increment field, it graphs data1 as I want.  But I can't seem to get it to work for any other elements.

  • Matt,

    Just clarifying: when you enter Start Address: statArray.data1 and Index Increment: n you get displayed statArray[0].data1 thru statArray[4095].data1, is that so?

    You want to enter Start Address: statArray[0].data2  to display statArray[0].data2 thru statArray[4095].data2, right?

    I am just checking, since I managed to display the interleaved graphs using Start Address: &results[0].resultset1, &results[0].resultset2 and so on. (check the attached project and the graph below).

    Hope this helps,

    Rafael

    CPP_test_interleaved.zip
  • I know that this is an old thread so please forgive me for posting if that's a problem.

    I have a nested struct of the form:

    struct complex {

    float real;

    float imag;

    };

    struct buffer {

    complex data[M][N];

    };

    struct buffer input;

    When input is populated with values, should I plot it like this:

    start address: input.data[0][0].real

    if I just want to plot the real members of the complex struct?

    I tried some variations of this with no success.

    If I enter the hex address of the start address of input.data[0][0].real, I get a plot of the imag member of the complex struct as well.

    What am I missing here?

    Many thanks.