• 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 "clock_filter.h"
18 #include "event_parser_base.h"
19 #include "trace_data/trace_data_cache.h"
20 
21 namespace SysTuning {
22 namespace TraceStreamer {
23 class HtracePluginTimeParser : public EventParserBase {
24 public:
25     HtracePluginTimeParser(TraceDataCache* dataCache, const TraceStreamerFilters* ctx);
26     HtracePluginTimeParser(const HtracePluginTimeParser&) = delete;
27     HtracePluginTimeParser& operator=(const HtracePluginTimeParser&) = delete;
28     ~HtracePluginTimeParser() = default;
29     void UpdatePluginTimeRange(ClockId clockId, uint64_t asyncTimestamp, uint64_t syncTimestamp);
30     uint64_t GetPluginStartTime();
31     uint64_t GetPluginEndTime();
MinTs()32     uint64_t MinTs()
33     {
34         return minTs_;
35     }
MaxTs()36     uint64_t MaxTs()
37     {
38         return maxTs_;
39     }
40 
41 private:
42     uint64_t syncHtracePluginStartTime_ = std::numeric_limits<uint64_t>::max();
43     uint64_t syncHtracePluginEndTime_ = 0;
44     uint64_t asyncHtracePluginStartTime_ = std::numeric_limits<uint64_t>::max();
45     uint64_t asyncHtracePluginEndTime_ = 0;
46     uint64_t minTs_ = std::numeric_limits<uint64_t>::max();
47     uint64_t maxTs_ = 0;
48 };
49 } // namespace TraceStreamer
50 } // namespace SysTuning
51 
52 #endif // HTRACE_PLUGIN_TIME_PARSER_H
53