blob: 0632747cc68c6d486c1d07ac958b09e5f98a6856 [file] [log] [blame]
Eric Secklerde589952019-10-17 12:46:07 +01001/*
2 * Copyright (C) 2019 The Android Open Source Project
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
17#ifndef SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_TRACK_EVENT_MODULE_H_
18#define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_TRACK_EVENT_MODULE_H_
19
Eric Secklerde589952019-10-17 12:46:07 +010020#include "src/trace_processor/importers/proto/proto_importer_module.h"
Eric Seckler771960c2019-10-22 15:37:12 +010021#include "src/trace_processor/importers/proto/track_event_parser.h"
22#include "src/trace_processor/importers/proto/track_event_tokenizer.h"
Eric Secklerde589952019-10-17 12:46:07 +010023
Eric Secklerd2af9892019-11-01 10:10:53 +000024#include "protos/perfetto/trace/trace_packet.pbzero.h"
25
Eric Secklerde589952019-10-17 12:46:07 +010026namespace perfetto {
27namespace trace_processor {
28
Mikhail Khokhlov43e5dce2019-12-10 10:10:39 +000029class TrackEventModule : public ProtoImporterModule {
Eric Secklerde589952019-10-17 12:46:07 +010030 public:
Mikhail Khokhlov4b5de1a2019-12-06 16:33:56 +000031 explicit TrackEventModule(TraceProcessorContext* context);
32
33 ~TrackEventModule() override;
Eric Secklerde589952019-10-17 12:46:07 +010034
Eric Seckler771960c2019-10-22 15:37:12 +010035 ModuleResult TokenizePacket(
36 const protos::pbzero::TracePacket::Decoder& decoder,
37 TraceBlobView* packet,
38 int64_t packet_timestamp,
Mikhail Khokhlov4b5de1a2019-12-06 16:33:56 +000039 PacketSequenceState* state,
40 uint32_t field_id) override;
Eric Seckler771960c2019-10-22 15:37:12 +010041
Lalit Maganti62b741f2020-12-10 18:24:00 +000042 void OnIncrementalStateCleared(uint32_t) override;
43
Mikhail Khokhlov4b5de1a2019-12-06 16:33:56 +000044 void ParsePacket(const protos::pbzero::TracePacket::Decoder& decoder,
45 const TimestampedTracePiece& ttp,
46 uint32_t field_id) override;
Eric Seckler771960c2019-10-22 15:37:12 +010047
48 private:
Lalit Maganti62b741f2020-12-10 18:24:00 +000049 std::unique_ptr<TrackEventTracker> track_event_tracker_;
Eric Seckler771960c2019-10-22 15:37:12 +010050 TrackEventTokenizer tokenizer_;
51 TrackEventParser parser_;
Eric Secklerde589952019-10-17 12:46:07 +010052};
53
54} // namespace trace_processor
55} // namespace perfetto
56
57#endif // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_TRACK_EVENT_MODULE_H_