1 /** 2 * Copyright 2020 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_BACKEND_KERNEL_COMPILER_GPU_DATASET_DATASET_PROFILING_H_ 17 #define MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_GPU_DATASET_DATASET_PROFILING_H_ 18 19 #include <memory> 20 #include <string> 21 #include <utility> 22 #include <vector> 23 #include "profiler/device/gpu/gpu_profiling.h" 24 25 using mindspore::profiler::gpu::ProfilingOp; 26 27 namespace mindspore { 28 namespace kernel { 29 class GetNextProfiling : public ProfilingOp { 30 public: 31 explicit GetNextProfiling(const std::string &path); 32 ~GetNextProfiling() = default; 33 void SaveProfilingData(); 34 void GetDeviceId(); 35 uint64_t GetTimeStamp() const; 36 void RecordData(uint32_t queue_size, uint64_t start_time_stamp, uint64_t end_time_stamp); 37 void Init(); 38 void ChangeFileMode(); 39 40 private: 41 std::string profiling_path_; 42 std::string file_name_; 43 std::vector<uint32_t> queue_size_; 44 std::vector<std::pair<uint64_t, uint64_t>> time_stamp_; // First value of std::pair is the start time stamp, 45 // Second value of std::pair is the stop time stamp 46 std::string device_id_; 47 }; 48 } // namespace kernel 49 } // namespace mindspore 50 51 #endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_GPU_DATASET_DATASET_PROFILING_H_ 52