src/fw-logs/fw-logs-parser.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 #include "fw-logs-parser.h"
4 #include <regex>
5 #include <sstream>
6 #include "fw-string-formatter.h"
7 #include "stdint.h"
8 
9 using namespace std;
10 
11 namespace librealsense
12 {
13  namespace fw_logs
14  {
15  fw_logs_parser::fw_logs_parser(string xml_content)
16  : _fw_logs_formating_options(xml_content),
17  _last_timestamp(0),
18  _timestamp_factor(0.00001)
19  {
21  }
22 
23 
25  {
26  }
27 
29  {
30  fw_log_data log_data;
31 
32  if (!fw_log_msg || fw_log_msg->logs_buffer.size() == 0)
33  return log_data;
34 
35  log_data = fill_log_data(fw_log_msg);
36 
37  //message
39  fw_log_event log_event_data;
40  _fw_logs_formating_options.get_event_data(log_data._event_id, &log_event_data);
41 
42  uint32_t params[3] = { log_data._p1, log_data._p2, log_data._p3 };
43  reg_exp.generate_message(log_event_data.line, log_event_data.num_of_params, params, &log_data._message);
44 
45  //file_name
47 
48  //thread_name
50 
51  return log_data;
52  }
53 
55  {
56  fw_log_data log_data;
57 
58  auto* log_binary = reinterpret_cast<const fw_logs::fw_log_binary*>(fw_log_msg->logs_buffer.data());
59 
60  //parse first DWORD
61  log_data._magic_number = static_cast<uint32_t>(log_binary->dword1.bits.magic_number);
62  log_data._severity = static_cast<uint32_t>(log_binary->dword1.bits.severity);
63  log_data._thread_id = static_cast<uint32_t>(log_binary->dword1.bits.thread_id);
64  log_data._file_id = static_cast<uint32_t>(log_binary->dword1.bits.file_id);
65  log_data._group_id = static_cast<uint32_t>(log_binary->dword1.bits.group_id);
66 
67  //parse second DWORD
68  log_data._event_id = static_cast<uint32_t>(log_binary->dword2.bits.event_id);
69  log_data._line = static_cast<uint32_t>(log_binary->dword2.bits.line_id);
70  log_data._sequence = static_cast<uint32_t>(log_binary->dword2.bits.seq_id);
71 
72  //parse third DWORD
73  log_data._p1 = static_cast<uint32_t>(log_binary->dword3.p1);
74  log_data._p2 = static_cast<uint32_t>(log_binary->dword3.p2);
75 
76  //parse forth DWORD
77  log_data._p3 = static_cast<uint32_t>(log_binary->dword4.p3);
78 
79  //parse fifth DWORD
80  log_data._timestamp = log_binary->dword5.timestamp;
81 
82  log_data._delta = (_last_timestamp == 0) ?
84 
85  _last_timestamp = log_data._timestamp;
86 
87  return log_data;
88  }
89  }
90 }
bool get_event_data(int id, fw_log_event *log_event_data) const
fw_log_data parse_fw_log(const fw_logs_binary_data *fw_log_msg)
fw_logs_formating_options _fw_logs_formating_options
unsigned int uint32_t
Definition: stdint.h:80
GLenum const GLfloat * params
bool get_thread_name(uint32_t thread_id, std::string *thread_name) const
fw_log_data fill_log_data(const fw_logs_binary_data *fw_log_msg)
std::unordered_map< std::string, std::vector< kvp > > get_enums() const


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:15