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_MINDDATA_DATASET_UTIL_RDR_H_ 17 #define MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_RDR_H_ 18 19 #include <deque> 20 #include <mutex> 21 #include "minddata/dataset/util/status.h" 22 23 namespace mindspore { 24 namespace dataset { 25 class MDChannelInfo { 26 public: MDChannelInfo(std::string channel_name)27 explicit MDChannelInfo(std::string channel_name) : channel_name_(channel_name), preprocess_batch_(0) {} 28 29 ~MDChannelInfo() = default; 30 31 std::string ToString(); 32 33 Status RecordBatchQueue(int64_t batch_queue_size); 34 35 Status RecordPreprocessBatch(int64_t preprocess_batch); 36 37 Status RecordPushStartTime(); 38 39 Status RecordPushEndTime(); 40 41 private: 42 std::string channel_name_; 43 std::deque<int64_t> batch_queue_; 44 int64_t preprocess_batch_; 45 std::deque<std::string> push_start_time_; 46 std::deque<std::string> push_end_time_; 47 std::mutex mutex_; 48 }; 49 } // namespace dataset 50 } // namespace mindspore 51 52 #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_RDR_H_ 53