> http://ecos.sourceware.org/cgi-bin/cvsweb.cgi/ecos/packages/kernel/current/host/instr/readme.txt?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=ecos
>
>        Andrew
>
Thank you Mr. Andrew! I did all steps listed at readme file. But, I
couldn't solve my problem.

Let me give you more information what/how I am doing.
I am using Single Producer and Single Consumer application as a test.
Here is the code, where I enabled only CYG_INSTRUMENT_CLASS_THREAD
macro. Currently, I need number of thread exchanges only.

[...]
cyg_instrument_enable(CYG_INSTRUMENT_CLASS_THREAD, 0);
diag_printf("Consumer started\n");
int k = 0;
while (k<10)
{
        cyg_semaphore_wait(&sem_wrote);
        diag_printf("consumed = %d\n", data);
        cyg_semaphore_post(&sem_read);
        cyg_thread_delay(100);
        k++;
}
cyg_instrument_disable(CYG_INSTRUMENT_CLASS_THREAD, 0);
[...]

I have a similar code for producer thread as well.
Based on your link, I have built my instrument_desc.h file and I could
see event types and number are made as dictionary (key and value).
Here is the excerpt.

struct instrument_desc_s {
    char *   msg;
    CYG_WORD num;
};
struct instrument_desc_s instrument_desc[] = {
{"ALARM",   0x0900},
{"ALARM_ADD",   1},
{"ALARM_CALL",   3},
{"ALARM_INIT",   4},
{"ALARM_INTERVAL",   6},
{"ALARM_REM",   2},
{"ALARM_TRIGGER",   5},
[...]

If I am not wrong, *CYG_WORD num* of *instrument_desc_s* should be
equal to instrument_buffer[INDEX].type of Instrument_Record:

struct Instrument_Record
{
 CYG_WORD16 type; // record type
 CYG_WORD16 thread; // current thread id
 CYG_WORD timestamp; // 32 bit timestamp
 CYG_WORD arg1; // first arg
 CYG_WORD arg2; // second arg
};
struct Instrument_Record instrument_buffer[100];

So, I made a simple function, where I got name of the instrumentation
event based on its number. Here is function code:

void print_instr(){

        int i =0, j=0;
        bool found = false;
        char *message;

        intr_count = 0;
        while (instrument_desc[j].num != 0)
        {
                intr_count++;   j++;
        }
        for (i = 0; i <instrument_buffer_size; i++) {
                j = 0;          found = false;
                while ((!found) && (j<intr_count))
                {
                        if (instrument_buffer[i].type == instrument_desc[j].num)
                        {
                                message = instrument_desc[j].msg;
                                found = true;
                        } else
                                message = "unknown event";
                        j++;
                        diag_printf("j=%d\n",j);
                }
                printf("Record %02d: type %s, thread %d, ",
                        i, message, instrument_buffer[i].thread);
                printf("time %5d, arg1 0x%08x, arg2 0x%08x\n",
                        instrument_buffer[i].timestamp, 
instrument_buffer[i].arg1,
                        instrument_buffer[i].arg2);
        }
}

Now I have two problems.
1) All of the events are "unknown event". instrument_buffer[i].type
and instrument_desc[j].num does not match.
2) If you look to struct instrument_desc_s instrument_desc[] there are
125 instrumentation event types and for several event types, it has
the same number. So, my print_instr() I am taking the first occurred
one, while it is not always correct.

How can have "instrumentation event names" as it is given at
http://sourceware.org/ml/ecos-discuss/2005-07/msg00036.html ?

Thanks,
Nodir.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply via email to