• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
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_NETWORK_PARSER_H
16 #define HTRACE_NETWORK_PARSER_H
17 #include <cstdint>
18 #include <map>
19 #include <string>
20 #include <vector>
21 #include "common_types.h"
22 #include "event_parser_base.h"
23 #include "htrace_plugin_time_parser.h"
24 #include "trace_streamer_config.h"
25 #include "trace_streamer_filters.h"
26 namespace SysTuning {
27 namespace TraceStreamer {
28 class PbreaderNetworkParser : public EventParserBase, public HtracePluginTimeParser {
29 public:
30     PbreaderNetworkParser(TraceDataCache *dataCache, const TraceStreamerFilters *ctx);
31     ~PbreaderNetworkParser();
32     void Parse(ProtoReader::BytesView tracePacket, uint64_t ts);
33     void Finish();
34     struct TsNetworkData {
35         uint64_t ts;
36         uint64_t tv_sec;
37         uint64_t tv_nsec;
38         uint64_t rx_bytes;
39         uint64_t rx_packets;
40         uint64_t tx_bytes;
41         uint64_t tx_packets;
42     };
43     std::vector<TsNetworkData> networkData_;
44 };
45 } // namespace TraceStreamer
46 } // namespace SysTuning
47 
48 #endif // HTRACE_NETWORK_PARSER_H
49