#include "icq_task_report.h" icq_task_report_t* icq_task_report_init(void){ icq_task_report_t* task_report; task_report = malloc(sizeof(icq_task_report_t)); task_report->timing_execution_trace = icq_timing_execution_trace_init(); icq_timing_execution_trace_initTimingExecutionEntries(task_report->timing_execution_trace, NULL, 10000, 0); return task_report; } void icq_task_report_add_event(icq_task_report_t* task_report, uint32_t event_type){ icq_timing_execution_trace_addTimingExecutionEventIfActive(task_report->timing_execution_trace, event_type); } void icq_task_report_add_event_with_param(icq_task_report_t* task_report, uint32_t event_type, uint8_t param_id){ icq_timing_execution_trace_addTimingExecutionEventIfActiveWithParam(task_report->timing_execution_trace, event_type, param_id); } void icq_task_report_add_event_with_param_and_time(icq_task_report_t* task_report, uint32_t event_type, uint8_t param_id, uint64_t time){ icq_timing_execution_trace_addTimingExecutionEventIfActiveWithParamAndTime(task_report->timing_execution_trace, event_type, param_id, time); } void icq_task_report_timing_execution_event_str(uint32_t timingExecutionEvent, char* str){ if(timingExecutionEvent == 0) memcpy(str, "STOPPED", sizeof("STOPPED")); if(timingExecutionEvent == 1) memcpy(str, "EXECUTING", sizeof("EXECUTING")); if(timingExecutionEvent == 2) memcpy(str, "MESSAGE_RECEIVED", sizeof("MESSAGE_RECEIVED")); if(timingExecutionEvent == 3) memcpy(str, "MESSAGE_SENT", sizeof("MESSAGE_SENT")); if(timingExecutionEvent == 4) memcpy(str, "PRIORITY_MESSAGE_RECEIVED", sizeof("PRIORITY_MESSAGE_RECEIVED")); if(timingExecutionEvent == 5) memcpy(str, "PRIORITY_MESSAGE_SENT", sizeof("PRIORITY_MESSAGE_SENT")); if(timingExecutionEvent == 6) memcpy(str, "MESSAGE_PROCESSING_START", sizeof("MESSAGE_PROCESSING_START")); if(timingExecutionEvent == 7) memcpy(str, "MESSAGE_PROCESSING_END", sizeof("MESSAGE_PROCESSING_END")); if(timingExecutionEvent == 8) memcpy(str, "SPIN_LOCK_START", sizeof("SPIN_LOCK_START")); if(timingExecutionEvent == 9) memcpy(str, "SPIN_LOCK_END", sizeof("SPIN_LOCK_END")); if(timingExecutionEvent == 10) memcpy(str, "SPIN_UNLOCK", sizeof("SPIN_UNLOCK")); if(timingExecutionEvent == 11) memcpy(str, "SHARED_RESOURCE_LOCK_START", sizeof("SHARED_RESOURCE_LOCK_START")); if(timingExecutionEvent == 12) memcpy(str, "SHARED_RESOURCE_LOCK_END", sizeof("SHARED_RESOURCE_LOCK_END")); if(timingExecutionEvent == 13) memcpy(str, "SHARED_RESOURCE_UNLOCK", sizeof("SHARED_RESOURCE_UNLOCK")); if(timingExecutionEvent == 14) memcpy(str, "WAIT_FOR_SIGNAL_START", sizeof("WAIT_FOR_SIGNAL_START")); if(timingExecutionEvent == 15) memcpy(str, "WAIT_FOR_SIGNAL_END", sizeof("WAIT_FOR_SIGNAL_END")); if(timingExecutionEvent == 16) memcpy(str, "RAISE_SIGNAL", sizeof("RAISE_SIGNAL")); if(timingExecutionEvent == 17) memcpy(str, "IRQ_START", sizeof("IRQ_START")); if(timingExecutionEvent == 18) memcpy(str, "IRQ_END", sizeof("IRQ_END")); if(timingExecutionEvent == 19) memcpy(str, "TIMER_START", sizeof("TIMER_START")); if(timingExecutionEvent == 20) memcpy(str, "TIMER_END", sizeof("TIMER_END")); } void icq_task_report_print_timing_execution_trace(uint32_t cpu, char* task_name, icq_task_report_t* task_report){ icq_timing_execution_trace_t* timing_execution_trace = task_report->timing_execution_trace; char timingExecutionEventName[20]; //ADAPT FOR ONE TIMING EXECUTION ENTRIES PER CORE et per task and ask if it is important to get the memory adress of the task locked_printf("\n\n>>>>>>>>>>>> core%d::%sTimingExecutionEntries - (Memory Adress not specified)", cpu, task_name); locked_printf("\n$10 =\t{"); for(uint32_t i=0; ientryCount; i++){ icq_task_report_timing_execution_event_str(timing_execution_trace->timingExecutionEntries[i]->timingExecutionEvent, timingExecutionEventName); locked_printf("\n\t{"); locked_printf("\n\t\ttimestamp = %d,", timing_execution_trace->timingExecutionEntries[i]->timestamp); locked_printf("\n\t\ttimingExecutionEvent = %s,", timingExecutionEventName); locked_printf("\n\t\tparameter = %d \'\\00%d\'\n", timing_execution_trace->timingExecutionEntries[i]->parameter, timing_execution_trace->timingExecutionEntries[i]->parameter); locked_printf("\t},"); } locked_printf("}\n"); } void icq_task_report_print_timing_task_trace_id(uint32_t cpu, char* task_name, icq_queue_t* icq, uint32_t icq_cpu){ if(icq!=0){ #ifdef ICQ_SINGLE_QUEUE locked_printf("\n>>>>>> core%d::%sIcq.traceId = %d\n", cpu, task_name, icq->spinLock._id); #endif #ifdef ICQ_MULTI_QUEUE locked_printf("\n>>>>>> core%d::%sIcqCore%d.traceId = %d\n", cpu, task_name, icq_cpu, icq->spinLock._id); #endif } }