LCOV - code coverage report
Current view: top level - adump/exception - kernel_info_collector.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-07-28 10:54:24 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : #ifndef KERNEL_INFO_COLLECTOR_H
      11              : #define KERNEL_INFO_COLLECTOR_H
      12              : #include <memory>
      13              : #include <string>
      14              : #include <vector>
      15              : #include <elf.h>
      16              : #include "adump_pub.h"
      17              : #include "runtime/rt.h"
      18              : 
      19              : namespace Adx {
      20              : 
      21              : class KernelInfoCollector {
      22              : public:
      23          224 :     KernelInfoCollector()
      24          224 :         : kernelBinHandle_(nullptr),
      25          224 :           kernelBinSize_(0){};
      26          224 :     ~KernelInfoCollector() = default;
      27              :     void LoadKernelInfo(const rtExceptionArgsInfo &argsInfo);
      28              :     int32_t InitFromBinHandle(rtBinHandle BinHandle, const std::string &kernelName);
      29              :     int32_t LoadKernelBinBuffer();
      30              :     int32_t StartCollectKernel(const std::string &dumpPath) const;
      31              :     std::string GetProcessedKernelName() const;
      32              :     std::vector<std::string> GetSearchPath() const;
      33              :     std::string SearchJsonFiles(const std::string &rootPath, const std::string &targetString) const;
      34              : private:
      35              :     bool ContainsString(const std::string &filePath, const std::string &targetString) const;
      36              :     std::string GetFirstItem(const std::string &curLine, size_t& curPlace) const;
      37              :     bool IsTargetLine(const std::string &currentLine, const std::string &key, const std::string &value) const;
      38              :     int32_t DumpHostKernelBin(const std::string &kernelName, const std::string &dumpPath) const;
      39              :     int32_t CollectKernelFile(const std::string &kernelName, const std::string &dumpPath) const;
      40              :     std::vector<std::string> SplitString(const std::string &str, char delimiter) const;
      41              :     rtBinHandle kernelBinHandle_;
      42              :     std::string kernelBinData_;
      43              :     uint32_t kernelBinSize_;
      44              :     std::string kernelName_;
      45              : };
      46              : int32_t StartCollectKernelAsync(std::shared_ptr<KernelInfoCollector> collector, const std::string &dumpPath);
      47              : } // namespace Adx
      48              : #endif // KERNEL_INFO_COLLECTOR_H
        

Generated by: LCOV version 2.0-1