• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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 TOOLS_FTRACE_PROTO_GEN_FTRACE_PROTO_GEN_H_
18 #define TOOLS_FTRACE_PROTO_GEN_FTRACE_PROTO_GEN_H_
19 
20 #include <google/protobuf/descriptor.h>
21 #include <map>
22 #include <set>
23 #include <sstream>
24 #include <string>
25 #include <vector>
26 
27 #include "src/traced/probes/ftrace/format_parser/format_parser.h"
28 #include "tools/ftrace_proto_gen/proto_gen_utils.h"
29 
30 namespace perfetto {
31 
32 bool GenerateProto(const std::string& group,
33                    const FtraceEvent& format,
34                    Proto* proto_out);
35 
36 std::string EventNameToProtoName(const std::string& group,
37                                  const std::string& name);
38 std::string EventNameToProtoFieldName(const std::string& group,
39                                       const std::string& name);
40 
41 std::vector<FtraceEventName> ReadAllowList(const std::string& filename);
42 void GenerateFtraceEventProto(const std::vector<FtraceEventName>& raw_eventlist,
43                               const std::set<std::string>& groups,
44                               std::ostream* fout);
45 std::string SingleEventInfo(perfetto::Proto proto,
46                             const std::string& group,
47                             const uint32_t proto_field_id);
48 void GenerateEventInfo(const std::vector<std::string>& events_info,
49                        std::ostream* fout);
50 std::string ProtoHeader();
51 
52 }  // namespace perfetto
53 
54 #endif  // TOOLS_FTRACE_PROTO_GEN_FTRACE_PROTO_GEN_H_
55