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

Support FW logs extended format #12688

Merged
merged 16 commits into from
Mar 31, 2024
Merged

Conversation

OhadMeir
Copy link
Contributor

Tracked on [RSDEV-1642] + [RSDEV-1643] + [RSDEV-1645]

This PR introduces the extended FW log structure.
It introduces the option that we will get FW logs from several sources, each source sending logs from several modules with dynamic number and type of parameters.

API was updated to get FW log module. To minimize API change it was decided that to get the log source we will use the rs2_get_fw_log_parsed_thread_name existing API.

Parser now uses a definition XML that points to each source events log parser XML (HWLoggerEventsDS5.xml for D400)

@OhadMeir OhadMeir requested a review from Nir-Az February 20, 2024 13:03
return (uint32_t)_timestamp;
}
const fw_log_binary * log_binary = reinterpret_cast< const fw_log_binary * >( logs_buffer.data() );
if( log_binary->magic_number == 0xA5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how we distinguish d400 from d500?
magic number was changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to support get_severity from the log entry binary data, in case no parser is available.
This is the easiest way I found doing so.

src/fw-logs/fw-log-data.cpp Outdated Show resolved Hide resolved
…ce format xml. fw-log-xml-helper updated, fw-logs-formatting-options gets needed data from it
src/fw-logs/fw-log-data.cpp Outdated Show resolved Hide resolved
src/fw-logs/fw-log-data.cpp Outdated Show resolved Hide resolved
{
_fw_logs_formating_options.initialize_from_xml();
fw_logs_xml_helper helper;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some comments about what is being done here?
TOC file and such

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but can you add the actual example in a comment?
This way if someone will ask how it should look like we can see it in the code?

@@ -1,66 +1,85 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2020 Intel Corporation. All Rights Reserved.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to change the date when you modify a file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is something me and others have been doing as of lately. Trying to google if this is a good practice, I came across mixed opinions if this is necessary or even good to do this.
@Nir-Az, this is a legal issue, who should we contact about this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally I followed a role that a new file gets new year and modified not.
But I am not sure if any restrictions or best practice here.
I will check and update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As instructed, edited files should show range of years. Fixing here to 2020-2024

@@ -1,70 +1,91 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment for date

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same. 2019-2024

uint32_t timestamp;
};

struct fw_log_binary
struct extended_fw_log_binary : public fw_log_binary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the "extended" to "d500"?
Would it be right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to avoid model names as it might not be correct.
The new (extended) format aims to be future proof (within reason). What if this format would be used for D600 models? What about old L500 models using the old format.
But I agree that "legacy" and "extended" are also not that good, as further changes to the format might make these names obsolete.

Lets talk tomorrow and decide on the preferred naming approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussion the naming convention is - "legacy" parser/device/etc.. will have no prefix. New format classes will use "extended_" prefix.
This cause some weird naming in the implementation as I had firmware_logger_device inheriting extended_firmware_logger_device. I have changed the implementation moving functions from base classes to inheritors to reverse this. Now "extended_" classes inherit the no prefix classes.


return false;
}
document->parse< 0 >( buffer.data() ); // Might throw
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this "0"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default flags.

{
if (_xml_content.empty())
return false;
xml_node<> * get_first_node( const xml_document<> * document )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean by xml_node<> ? is it partial specialization? It does not seem so, since the xml_node class if not template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xml_node is a template with default type.

template
class xml_node: public xml_base

Copy link
Contributor

@remibettan remibettan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few comments - impressive work!

@remibettan remibettan self-requested a review March 31, 2024 07:54
Copy link
Contributor

@remibettan remibettan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OhadMeir OhadMeir merged commit 052cc57 into IntelRealSense:development Mar 31, 2024
16 checks passed
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

Successfully merging this pull request may close these issues.

3 participants