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 SRC_TOOLS_FTRACE_PROTO_GEN_FTRACE_PROTO_GEN_H_ 18 #define SRC_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/tools/ftrace_proto_gen/proto_gen_utils.h" 28 #include "src/traced/probes/ftrace/format_parser/format_parser.h" 29 30 namespace perfetto { 31 32 std::vector<Proto::Field> ToProtoFields(const FtraceEvent& format); 33 34 std::string EventNameToProtoName(const std::string& group, 35 const std::string& name); 36 std::string EventNameToProtoFieldName(const std::string& group, 37 const std::string& name); 38 39 std::vector<FtraceEventName> ReadAllowList(const std::string& filename); 40 void GenerateFtraceEventProto(const std::vector<FtraceEventName>& raw_eventlist, 41 const std::set<std::string>& groups, 42 std::ostream* fout); 43 std::string SingleEventInfo(perfetto::Proto proto, 44 const std::string& group, 45 const uint32_t proto_field_id); 46 void GenerateEventInfo(const std::vector<std::string>& events_info, 47 std::ostream* fout); 48 std::string ProtoHeader(); 49 50 } // namespace perfetto 51 52 #endif // SRC_TOOLS_FTRACE_PROTO_GEN_FTRACE_PROTO_GEN_H_ 53