• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef HTRACE_PLUGIN_TIME_PARSER_H
16 #define HTRACE_PLUGIN_TIME_PARSER_H
17 #include "ts_common.h"
18 namespace SysTuning {
19 namespace TraceStreamer {
20 class HtracePluginTimeParser {
21 public:
22     HtracePluginTimeParser();
23     HtracePluginTimeParser(const HtracePluginTimeParser&) = delete;
24     HtracePluginTimeParser& operator=(const HtracePluginTimeParser&) = delete;
25     ~HtracePluginTimeParser() = default;
26     void UpdatePluginTimeRange(ClockId clockId, uint64_t asyncTimestamp, uint64_t syncTimestamp);
27     uint64_t GetPluginStartTime() const;
28     uint64_t GetPluginEndTime() const;
MinTs()29     uint64_t MinTs() const
30     {
31         return minTs_;
32     }
MaxTs()33     uint64_t MaxTs() const
34     {
35         return maxTs_;
36     }
37 
38 private:
39     uint64_t syncHtracePluginStartTime_ = std::numeric_limits<uint64_t>::max();
40     uint64_t syncHtracePluginEndTime_ = 0;
41     uint64_t asyncHtracePluginStartTime_ = std::numeric_limits<uint64_t>::max();
42     uint64_t asyncHtracePluginEndTime_ = 0;
43     uint64_t minTs_ = std::numeric_limits<uint64_t>::max();
44     uint64_t maxTs_ = 0;
45 };
46 } // namespace TraceStreamer
47 } // namespace SysTuning
48 
49 #endif // HTRACE_PLUGIN_TIME_PARSER_H
50