• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)
28       : channel_name_(channel_name), preprocess_batch_(0), push_first_start_time_("-1"), push_first_end_time_("-1") {}
29 
30   ~MDChannelInfo() = default;
31 
32   std::string ToString();
33 
34   std::string ToFormatString();
35 
36   Status RecordBatchQueue(int64_t batch_queue_size);
37 
38   Status RecordDeviceQueue(int64_t device_queue_size);
39 
40   Status RecordPreprocessBatch(int64_t preprocess_batch);
41 
42   Status RecordPushFirstStartTime();
43 
44   Status RecordPushFirstEndTime();
45 
46   Status RecordPushStartTime();
47 
48   Status RecordPushEndTime();
49 
50  private:
51   std::string channel_name_;
52   std::deque<int64_t> batch_queue_;
53   std::deque<int32_t> device_queue_;
54   int64_t preprocess_batch_;
55   std::string push_first_start_time_;  // record the push start time for first batch
56   std::string push_first_end_time_;    // record the push end time for first batch
57   std::deque<std::string> push_start_time_;
58   std::deque<std::string> push_end_time_;
59 };
60 }  // namespace dataset
61 }  // namespace mindspore
62 
63 #endif  // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_RDR_H_
64