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

            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 ADUMP_COMMON_SYS_UTILS_H
      11              : #define ADUMP_COMMON_SYS_UTILS_H
      12              : #include <string>
      13              : #include <cstdint>
      14              : #include "mmpa_api.h"
      15              : 
      16              : namespace Adx {
      17              : const std::string DEFAULT_MILLISECOND_TIME = "19700101000000000";
      18              : class SysUtils {
      19              : public:
      20              :     static std::string GetCurrentWorkDir();
      21              :     static std::string HandleEnv(const char* env);
      22              :     static uint64_t GetTimestamp();
      23              :     static std::string GetCurrentTime();
      24              :     static std::string GetCurrentTimeWithMillisecond();
      25              :     static std::string GetPid();
      26              :     template<typename TO, typename TI>
      27            2 :     static TO *ReinterpretCast(TI *ptr)
      28              :     {
      29            2 :         return reinterpret_cast<TO *>(ptr);
      30              :     }
      31              : };
      32              : 
      33              : #define ADX_GET_ENV(IDNAME, envStr)        \
      34              :     do {                                   \
      35              :         const char *env = nullptr;         \
      36              :         MM_SYS_GET_ENV(IDNAME, env);       \
      37              :         envStr = SysUtils::HandleEnv(env); \
      38              :     } while (0)
      39              : 
      40              : }  // namespace Adx
      41              : #endif  // ADUMP_COMMON_SYS_UTILS_H
        

Generated by: LCOV version 2.0-1