Matt Spinler | 711d51d | 2019-11-06 09:36:51 -0600 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2019 IBM Corporation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 16 | #include "pel.hpp" |
| 17 | |
| 18 | #include "bcd_time.hpp" |
Matt Spinler | c63e2e8 | 2019-12-02 15:50:12 -0600 | [diff] [blame] | 19 | #include "extended_user_header.hpp" |
Matt Spinler | aa65947 | 2019-10-23 09:26:48 -0500 | [diff] [blame] | 20 | #include "failing_mtms.hpp" |
Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 21 | #include "json_utils.hpp" |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 22 | #include "log_id.hpp" |
Matt Spinler | f1e85e2 | 2019-11-01 11:31:31 -0500 | [diff] [blame] | 23 | #include "pel_rules.hpp" |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 24 | #include "pel_values.hpp" |
Matt Spinler | 131870c | 2019-09-25 13:29:04 -0500 | [diff] [blame] | 25 | #include "section_factory.hpp" |
Matt Spinler | bd716f0 | 2019-10-15 10:54:11 -0500 | [diff] [blame] | 26 | #include "src.hpp" |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 27 | #include "stream.hpp" |
Matt Spinler | afa857c | 2019-10-24 13:03:46 -0500 | [diff] [blame] | 28 | #include "user_data_formats.hpp" |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 29 | |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 30 | #include <iostream> |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 31 | #include <phosphor-logging/log.hpp> |
| 32 | |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 33 | namespace openpower |
| 34 | { |
| 35 | namespace pels |
| 36 | { |
Matt Spinler | b832363 | 2019-09-20 15:11:04 -0500 | [diff] [blame] | 37 | namespace message = openpower::pels::message; |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 38 | namespace pv = openpower::pels::pel_values; |
Matt Spinler | b832363 | 2019-09-20 15:11:04 -0500 | [diff] [blame] | 39 | |
| 40 | PEL::PEL(const message::Entry& entry, uint32_t obmcLogID, uint64_t timestamp, |
Matt Spinler | bd716f0 | 2019-10-15 10:54:11 -0500 | [diff] [blame] | 41 | phosphor::logging::Entry::Level severity, |
Matt Spinler | aa65947 | 2019-10-23 09:26:48 -0500 | [diff] [blame] | 42 | const AdditionalData& additionalData, |
| 43 | const DataInterfaceBase& dataIface) |
Matt Spinler | b832363 | 2019-09-20 15:11:04 -0500 | [diff] [blame] | 44 | { |
| 45 | _ph = std::make_unique<PrivateHeader>(entry.componentID, obmcLogID, |
| 46 | timestamp); |
| 47 | _uh = std::make_unique<UserHeader>(entry, severity); |
| 48 | |
Matt Spinler | bd716f0 | 2019-10-15 10:54:11 -0500 | [diff] [blame] | 49 | auto src = std::make_unique<SRC>(entry, additionalData); |
Matt Spinler | c63e2e8 | 2019-12-02 15:50:12 -0600 | [diff] [blame] | 50 | |
| 51 | auto euh = std::make_unique<ExtendedUserHeader>(dataIface, entry, *src); |
| 52 | |
Matt Spinler | bd716f0 | 2019-10-15 10:54:11 -0500 | [diff] [blame] | 53 | _optionalSections.push_back(std::move(src)); |
Matt Spinler | c63e2e8 | 2019-12-02 15:50:12 -0600 | [diff] [blame] | 54 | _optionalSections.push_back(std::move(euh)); |
Matt Spinler | b832363 | 2019-09-20 15:11:04 -0500 | [diff] [blame] | 55 | |
Matt Spinler | aa65947 | 2019-10-23 09:26:48 -0500 | [diff] [blame] | 56 | auto mtms = std::make_unique<FailingMTMS>(dataIface); |
| 57 | _optionalSections.push_back(std::move(mtms)); |
Matt Spinler | bd716f0 | 2019-10-15 10:54:11 -0500 | [diff] [blame] | 58 | |
Matt Spinler | 4dcd3f4 | 2020-01-22 14:55:07 -0600 | [diff] [blame^] | 59 | auto ud = util::makeSysInfoUserDataSection(additionalData, dataIface); |
| 60 | _optionalSections.push_back(std::move(ud)); |
| 61 | |
Matt Spinler | afa857c | 2019-10-24 13:03:46 -0500 | [diff] [blame] | 62 | if (!additionalData.empty()) |
| 63 | { |
Matt Spinler | 4dcd3f4 | 2020-01-22 14:55:07 -0600 | [diff] [blame^] | 64 | ud = util::makeADUserDataSection(additionalData); |
Matt Spinler | 6d66382 | 2020-01-22 14:50:46 -0600 | [diff] [blame] | 65 | |
| 66 | // To be safe, check there isn't too much data |
| 67 | if (size() + ud->header().size <= _maxPELSize) |
| 68 | { |
| 69 | _optionalSections.push_back(std::move(ud)); |
| 70 | } |
Matt Spinler | afa857c | 2019-10-24 13:03:46 -0500 | [diff] [blame] | 71 | } |
| 72 | |
Matt Spinler | 97d19b4 | 2019-10-29 11:34:03 -0500 | [diff] [blame] | 73 | _ph->setSectionCount(2 + _optionalSections.size()); |
Matt Spinler | f1e85e2 | 2019-11-01 11:31:31 -0500 | [diff] [blame] | 74 | |
| 75 | checkRulesAndFix(); |
Matt Spinler | b832363 | 2019-09-20 15:11:04 -0500 | [diff] [blame] | 76 | } |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 77 | |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 78 | PEL::PEL(std::vector<uint8_t>& data) : PEL(data, 0) |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 79 | { |
| 80 | } |
| 81 | |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 82 | PEL::PEL(std::vector<uint8_t>& data, uint32_t obmcLogID) |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 83 | { |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 84 | populateFromRawData(data, obmcLogID); |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 85 | } |
| 86 | |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 87 | void PEL::populateFromRawData(std::vector<uint8_t>& data, uint32_t obmcLogID) |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 88 | { |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 89 | Stream pelData{data}; |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 90 | _ph = std::make_unique<PrivateHeader>(pelData); |
| 91 | if (obmcLogID != 0) |
| 92 | { |
Matt Spinler | 97d19b4 | 2019-10-29 11:34:03 -0500 | [diff] [blame] | 93 | _ph->setOBMCLogID(obmcLogID); |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | _uh = std::make_unique<UserHeader>(pelData); |
Matt Spinler | 131870c | 2019-09-25 13:29:04 -0500 | [diff] [blame] | 97 | |
| 98 | // Use the section factory to create the rest of the objects |
| 99 | for (size_t i = 2; i < _ph->sectionCount(); i++) |
| 100 | { |
| 101 | auto section = section_factory::create(pelData); |
| 102 | _optionalSections.push_back(std::move(section)); |
| 103 | } |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | bool PEL::valid() const |
| 107 | { |
| 108 | bool valid = _ph->valid(); |
| 109 | |
| 110 | if (valid) |
| 111 | { |
| 112 | valid = _uh->valid(); |
| 113 | } |
| 114 | |
Matt Spinler | 131870c | 2019-09-25 13:29:04 -0500 | [diff] [blame] | 115 | if (valid) |
| 116 | { |
| 117 | if (!std::all_of(_optionalSections.begin(), _optionalSections.end(), |
| 118 | [](const auto& section) { return section->valid(); })) |
| 119 | { |
| 120 | valid = false; |
| 121 | } |
| 122 | } |
| 123 | |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 124 | return valid; |
| 125 | } |
| 126 | |
| 127 | void PEL::setCommitTime() |
| 128 | { |
| 129 | auto now = std::chrono::system_clock::now(); |
Matt Spinler | 97d19b4 | 2019-10-29 11:34:03 -0500 | [diff] [blame] | 130 | _ph->setCommitTimestamp(getBCDTime(now)); |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | void PEL::assignID() |
| 134 | { |
Matt Spinler | 97d19b4 | 2019-10-29 11:34:03 -0500 | [diff] [blame] | 135 | _ph->setID(generatePELID()); |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 136 | } |
| 137 | |
Matt Spinler | 0688545 | 2019-11-06 10:35:42 -0600 | [diff] [blame] | 138 | void PEL::flatten(std::vector<uint8_t>& pelBuffer) const |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 139 | { |
| 140 | Stream pelData{pelBuffer}; |
Matt Spinler | b832363 | 2019-09-20 15:11:04 -0500 | [diff] [blame] | 141 | |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 142 | if (!valid()) |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 143 | { |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 144 | using namespace phosphor::logging; |
| 145 | log<level::WARNING>("Unflattening an invalid PEL"); |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 146 | } |
| 147 | |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 148 | _ph->flatten(pelData); |
Matt Spinler | b832363 | 2019-09-20 15:11:04 -0500 | [diff] [blame] | 149 | _uh->flatten(pelData); |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 150 | |
| 151 | for (auto& section : _optionalSections) |
| 152 | { |
| 153 | section->flatten(pelData); |
| 154 | } |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 155 | } |
| 156 | |
Matt Spinler | 0688545 | 2019-11-06 10:35:42 -0600 | [diff] [blame] | 157 | std::vector<uint8_t> PEL::data() const |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 158 | { |
Matt Spinler | 07eefc5 | 2019-09-26 11:18:26 -0500 | [diff] [blame] | 159 | std::vector<uint8_t> pelData; |
| 160 | flatten(pelData); |
| 161 | return pelData; |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 162 | } |
| 163 | |
Matt Spinler | f1b46ff | 2020-01-22 14:10:04 -0600 | [diff] [blame] | 164 | size_t PEL::size() const |
| 165 | { |
| 166 | size_t size = 0; |
| 167 | |
| 168 | if (_ph) |
| 169 | { |
| 170 | size += _ph->header().size; |
| 171 | } |
| 172 | |
| 173 | if (_uh) |
| 174 | { |
| 175 | size += _uh->header().size; |
| 176 | } |
| 177 | |
| 178 | for (const auto& section : _optionalSections) |
| 179 | { |
| 180 | size += section->header().size; |
| 181 | } |
| 182 | |
| 183 | return size; |
| 184 | } |
| 185 | |
Matt Spinler | bd716f0 | 2019-10-15 10:54:11 -0500 | [diff] [blame] | 186 | std::optional<SRC*> PEL::primarySRC() const |
| 187 | { |
| 188 | auto src = std::find_if( |
| 189 | _optionalSections.begin(), _optionalSections.end(), [](auto& section) { |
| 190 | return section->header().id == |
| 191 | static_cast<uint16_t>(SectionID::primarySRC); |
| 192 | }); |
| 193 | if (src != _optionalSections.end()) |
| 194 | { |
| 195 | return static_cast<SRC*>(src->get()); |
| 196 | } |
| 197 | |
| 198 | return std::nullopt; |
| 199 | } |
| 200 | |
Matt Spinler | f1e85e2 | 2019-11-01 11:31:31 -0500 | [diff] [blame] | 201 | void PEL::checkRulesAndFix() |
| 202 | { |
| 203 | auto [actionFlags, eventType] = |
| 204 | pel_rules::check(_uh->actionFlags(), _uh->eventType(), _uh->severity()); |
| 205 | |
| 206 | _uh->setActionFlags(actionFlags); |
| 207 | _uh->setEventType(eventType); |
| 208 | } |
| 209 | |
Matt Spinler | acb7c10 | 2020-01-10 13:49:22 -0600 | [diff] [blame] | 210 | void PEL::printSectionInJSON(const Section& section, std::string& buf, |
| 211 | std::map<uint16_t, size_t>& pluralSections) const |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 212 | { |
| 213 | char tmpB[5]; |
Aatir Manzur | ad0e047 | 2019-10-07 13:18:37 -0500 | [diff] [blame] | 214 | uint8_t id[] = {static_cast<uint8_t>(section.header().id >> 8), |
| 215 | static_cast<uint8_t>(section.header().id)}; |
| 216 | sprintf(tmpB, "%c%c", id[0], id[1]); |
| 217 | std::string sectionID(tmpB); |
| 218 | std::string sectionName = pv::sectionTitles.count(sectionID) |
| 219 | ? pv::sectionTitles.at(sectionID) |
| 220 | : "Unknown Section"; |
Matt Spinler | acb7c10 | 2020-01-10 13:49:22 -0600 | [diff] [blame] | 221 | |
| 222 | // Add a count if there are multiple of this type of section |
| 223 | auto count = pluralSections.find(section.header().id); |
| 224 | if (count != pluralSections.end()) |
| 225 | { |
| 226 | sectionName += " " + std::to_string(count->second); |
| 227 | count->second++; |
| 228 | } |
| 229 | |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 230 | if (section.valid()) |
| 231 | { |
Aatir Manzur | ad0e047 | 2019-10-07 13:18:37 -0500 | [diff] [blame] | 232 | auto json = section.getJSON(); |
| 233 | if (json) |
| 234 | { |
Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 235 | buf += "\n\"" + sectionName + "\": {\n"; |
| 236 | buf += *json + "\n},\n"; |
Aatir Manzur | ad0e047 | 2019-10-07 13:18:37 -0500 | [diff] [blame] | 237 | } |
| 238 | else |
| 239 | { |
Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 240 | buf += "\n\"" + sectionName + "\": [\n"; |
Aatir Manzur | ad0e047 | 2019-10-07 13:18:37 -0500 | [diff] [blame] | 241 | std::vector<uint8_t> data; |
| 242 | Stream s{data}; |
| 243 | section.flatten(s); |
| 244 | std::string dstr = dumpHex(std::data(data), data.size()); |
| 245 | buf += dstr + "],\n"; |
| 246 | } |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 247 | } |
| 248 | else |
| 249 | { |
Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 250 | buf += "\n\"Invalid Section\": [\n \"invalid\"\n],\n"; |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 251 | } |
| 252 | } |
| 253 | |
Matt Spinler | acb7c10 | 2020-01-10 13:49:22 -0600 | [diff] [blame] | 254 | std::map<uint16_t, size_t> PEL::getPluralSections() const |
| 255 | { |
| 256 | std::map<uint16_t, size_t> sectionCounts; |
| 257 | |
| 258 | for (const auto& section : optionalSections()) |
| 259 | { |
| 260 | if (sectionCounts.find(section->header().id) == sectionCounts.end()) |
| 261 | { |
| 262 | sectionCounts[section->header().id] = 1; |
| 263 | } |
| 264 | else |
| 265 | { |
| 266 | sectionCounts[section->header().id]++; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | std::map<uint16_t, size_t> sections; |
| 271 | for (const auto& [id, count] : sectionCounts) |
| 272 | { |
| 273 | if (count > 1) |
| 274 | { |
| 275 | // Start with 0 here and printSectionInJSON() |
| 276 | // will increment it as it goes. |
| 277 | sections.emplace(id, 0); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | return sections; |
| 282 | } |
| 283 | |
Matt Spinler | 0688545 | 2019-11-06 10:35:42 -0600 | [diff] [blame] | 284 | void PEL::toJSON() const |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 285 | { |
Matt Spinler | acb7c10 | 2020-01-10 13:49:22 -0600 | [diff] [blame] | 286 | auto sections = getPluralSections(); |
| 287 | |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 288 | std::string buf = "{"; |
Matt Spinler | acb7c10 | 2020-01-10 13:49:22 -0600 | [diff] [blame] | 289 | printSectionInJSON(*(_ph.get()), buf, sections); |
| 290 | printSectionInJSON(*(_uh.get()), buf, sections); |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 291 | for (auto& section : this->optionalSections()) |
| 292 | { |
Matt Spinler | acb7c10 | 2020-01-10 13:49:22 -0600 | [diff] [blame] | 293 | printSectionInJSON(*(section.get()), buf, sections); |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 294 | } |
| 295 | buf += "}"; |
| 296 | std::size_t found = buf.rfind(","); |
| 297 | if (found != std::string::npos) |
| 298 | buf.replace(found, 1, ""); |
| 299 | std::cout << buf << std::endl; |
| 300 | } |
Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 301 | |
Matt Spinler | c7c3e40 | 2020-01-22 15:07:25 -0600 | [diff] [blame] | 302 | namespace util |
| 303 | { |
| 304 | |
Matt Spinler | 4dcd3f4 | 2020-01-22 14:55:07 -0600 | [diff] [blame^] | 305 | std::unique_ptr<UserData> makeJSONUserDataSection(const nlohmann::json& json) |
| 306 | { |
| 307 | auto jsonString = json.dump(); |
| 308 | std::vector<uint8_t> jsonData(jsonString.begin(), jsonString.end()); |
| 309 | |
| 310 | // Pad to a 4 byte boundary |
| 311 | while ((jsonData.size() % 4) != 0) |
| 312 | { |
| 313 | jsonData.push_back(0); |
| 314 | } |
| 315 | |
| 316 | return std::make_unique<UserData>( |
| 317 | static_cast<uint16_t>(ComponentID::phosphorLogging), |
| 318 | static_cast<uint8_t>(UserDataFormat::json), |
| 319 | static_cast<uint8_t>(UserDataFormatVersion::json), jsonData); |
| 320 | } |
| 321 | |
Matt Spinler | c7c3e40 | 2020-01-22 15:07:25 -0600 | [diff] [blame] | 322 | std::unique_ptr<UserData> makeADUserDataSection(const AdditionalData& ad) |
| 323 | { |
| 324 | assert(!ad.empty()); |
| 325 | nlohmann::json json; |
| 326 | |
| 327 | // Remove the 'ESEL' entry, as it contains a full PEL in the value. |
| 328 | if (ad.getValue("ESEL")) |
| 329 | { |
| 330 | auto newAD = ad; |
| 331 | newAD.remove("ESEL"); |
| 332 | json = newAD.toJSON(); |
| 333 | } |
| 334 | else |
| 335 | { |
| 336 | json = ad.toJSON(); |
| 337 | } |
| 338 | |
Matt Spinler | 4dcd3f4 | 2020-01-22 14:55:07 -0600 | [diff] [blame^] | 339 | return makeJSONUserDataSection(json); |
| 340 | } |
Matt Spinler | c7c3e40 | 2020-01-22 15:07:25 -0600 | [diff] [blame] | 341 | |
Matt Spinler | 4dcd3f4 | 2020-01-22 14:55:07 -0600 | [diff] [blame^] | 342 | void addProcessNameToJSON(nlohmann::json& json, |
| 343 | const std::optional<std::string>& pid, |
| 344 | const DataInterfaceBase& dataIface) |
| 345 | { |
| 346 | std::string name = "Unknown"; |
| 347 | |
| 348 | try |
Matt Spinler | c7c3e40 | 2020-01-22 15:07:25 -0600 | [diff] [blame] | 349 | { |
Matt Spinler | 4dcd3f4 | 2020-01-22 14:55:07 -0600 | [diff] [blame^] | 350 | if (pid) |
| 351 | { |
| 352 | auto n = dataIface.getProcessName(*pid); |
| 353 | if (n) |
| 354 | { |
| 355 | name = *n; |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | catch (std::exception& e) |
| 360 | { |
Matt Spinler | c7c3e40 | 2020-01-22 15:07:25 -0600 | [diff] [blame] | 361 | } |
| 362 | |
Matt Spinler | 4dcd3f4 | 2020-01-22 14:55:07 -0600 | [diff] [blame^] | 363 | json["Process Name"] = std::move(name); |
| 364 | } |
| 365 | |
| 366 | std::unique_ptr<UserData> |
| 367 | makeSysInfoUserDataSection(const AdditionalData& ad, |
| 368 | const DataInterfaceBase& dataIface) |
| 369 | { |
| 370 | nlohmann::json json; |
| 371 | |
| 372 | addProcessNameToJSON(json, ad.getValue("_PID"), dataIface); |
| 373 | |
| 374 | return makeJSONUserDataSection(json); |
Matt Spinler | c7c3e40 | 2020-01-22 15:07:25 -0600 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | } // namespace util |
| 378 | |
Matt Spinler | cb6b059 | 2019-07-16 15:58:51 -0500 | [diff] [blame] | 379 | } // namespace pels |
| 380 | } // namespace openpower |