33 fprintf(stderr,
"%s: Nullpointer parameter (NULL) !\n",__func__);
41 char *token, *delim =
" \t", *delim2 =
" \t\n", *check;
42 int head_line = 1, first_row = 1, cpu_count = 0, column = 0, buffer_offset = 0;
47 token = strtok(file_buffer, delim);
52 if(strlen(token) > 3 && token[0]==
'C' && token[1]==
'P' && token[2]==
'U')
54 else if(cpu_count <= 0)
56 fprintf(stderr,
"%s: Could not parse CPU count !\n",__func__);
59 else if(strcmp(token,
"\n") == 0)
62 token = strtok(
NULL, delim);
66 int tokenlen = strlen(token);
67 if(token[tokenlen - 1] ==
':')
74 buffer_offset += snprintf(buffer + buffer_offset,
BUFFER_SIZE - buffer_offset,
"\n");
79 buffer_offset += snprintf(buffer + buffer_offset,
BUFFER_SIZE - buffer_offset,
"%.*s;", tokenlen-1, token);
81 else if(column <= cpu_count)
83 long int interrupt_count = strtol(token, &check, 10);
86 fprintf(stderr,
"%s: Could not parse interrupt count for CPU !\n",__func__);
90 buffer_offset += snprintf(buffer + buffer_offset,
BUFFER_SIZE - buffer_offset,
"cpu%d:%ld;", column - 1, interrupt_count);
95 token = strtok(
NULL, delim2);
105 fprintf(stderr,
"%s: dlt_user_log_write_start() returned error\n", __func__);
111 fprintf(stderr,
"%s: dlt_user_log_write_string() returned error\n", __func__);
115 token = strtok(buffer,
"\n");
123 fprintf(stderr,
"%s: dlt_user_log_write_finish() returned error\n", __func__);
129 fprintf(stderr,
"%s: dlt_user_log_write_start() returned error\n", __func__);
135 fprintf(stderr,
"%s: dlt_user_log_write_string() returned error\n", __func__);
140 token = strtok(
NULL,
"\n");
145 fprintf(stderr,
"%s: dlt_user_log_write_finish() returned error\n", __func__);
DltReturnValue dlt_user_log_write_string(DltContextData *log, const char *text)
unsigned char buffer[BUFFER_SIZE]
Buffer for dlt file transfer. The size is defined by BUFFER_SIZE.
#define DLT_LOG(CONTEXT, LOGLEVEL, ARGS...)
DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level)
DltReturnValue dlt_kpi_read_file(char *filename, char *buffer, uint maxLength)
DltReturnValue dlt_user_log_write_finish(DltContextData *log)
DltReturnValue dlt_user_log_write_start(DltContext *handle, DltContextData *log, DltLogLevelType loglevel)