Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid MetaData in CFE_es_perf #2637

Open
sslegel4398 opened this issue Feb 18, 2025 · 0 comments
Open

Invalid MetaData in CFE_es_perf #2637

sslegel4398 opened this issue Feb 18, 2025 · 0 comments

Comments

@sslegel4398
Copy link

At some point the perf code that writes the data buffer to a file was rewritten. At this time they changed the logic to reorder the data in the buffer. This is fine except they did not update the MetaData to match the new data buffer order.

The MetaData is used to parse and process the data file. It includes a data start index and a data end index. Since this is a circular buffer the start and end can be anywhere in the buffer, it all depends on when the data collection was stopped. So the data start and data end indicates where in buffer the data starts and ends.

The code that writes the buffer to a file used to just dump the buffer as is to the file. The code now uses the data start index to initialize the first entry in the loop that writes each entry to the file, so the data in the file is now ordered starting with the start entry.

The data start and end index in the metadata is still initialized to the original start and end index values and so now does not match the actual order of the data in the file. This results in the existing applications that read the file will only process entries from the start index to the end of the buffer, skipping entries before the start index. The number of entries that are loaded will vary depending on the location of the start index in the buffer when the data collection was stopped.

Solution: Don't reorder the entries in the buffer

File: cfe_es_perf.c
Function: CFE_ES_RunPerfLogDump
Change:
case CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES:
State->DataPos = Perf->MetaData.DataStart;
State->StateCounter = Perf->MetaData.DataCount;
break;

to:
case CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES:
State->DataPos = 0;
State->StateCounter = Perf->MetaData.DataCount;
break;

Steven Slegel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant