1 /** 2 * Copyright 2021 Huawei Technologies Co., Ltd 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 */ 16 #ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_RDR_BASE_RECORDER_H_ 17 #define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_RDR_BASE_RECORDER_H_ 18 #include <memory> 19 #include <string> 20 #include <sstream> 21 #include <iomanip> 22 #include "include/common/debug/common.h" 23 #include "include/common/visible.h" 24 #include "utils/log_adapter.h" 25 26 namespace mindspore { 27 class COMMON_EXPORT BaseRecorder { 28 public: 29 BaseRecorder(); 30 BaseRecorder(const std::string &module, const std::string &name); ~BaseRecorder()31 virtual ~BaseRecorder() {} 32 GetModule()33 std::string GetModule() const { return module_; } GetName()34 std::string GetName() const { return name_; } GetTimeStamp()35 std::string GetTimeStamp() const { return timestamp_; } 36 std::optional<std::string> GetFileRealPath(const std::string &suffix = "") const; 37 Export()38 virtual void Export() {} 39 40 protected: 41 std::string module_; 42 std::string name_; 43 std::string directory_; 44 std::string filename_; 45 std::string timestamp_; // year,month,day,hour,minute,second 46 std::string delimiter_{"."}; 47 }; 48 using BaseRecorderPtr = std::shared_ptr<BaseRecorder>; 49 50 class CNode; 51 using CNodePtr = std::shared_ptr<CNode>; 52 class FuncGraph; 53 using FuncGraphPtr = std::shared_ptr<FuncGraph>; 54 } // namespace mindspore 55 #endif // MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_RDR_BASE_RECORDER_H_ 56