Home | History | Annotate | Download | only in ftrace_proto_gen
      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.h"
     28 #include "tools/ftrace_proto_gen/proto_gen_utils.h"
     29 
     30 namespace perfetto {
     31 
     32 std::string EventNameToProtoName(const std::string&);
     33 std::string EventNameToProtoFieldName(const std::string&);
     34 
     35 void PrintFtraceEventProtoAdditions(const std::set<std::string>& events);
     36 void PrintEventFormatterMain(const std::set<std::string>& events);
     37 void PrintEventFormatterUsingStatements(const std::set<std::string>& events);
     38 void PrintEventFormatterFunctions(const std::set<std::string>& events);
     39 void PrintInodeHandlerMain(const std::string& event_name,
     40                            const perfetto::Proto& proto);
     41 
     42 std::vector<FtraceEventName> ReadWhitelist(const std::string& filename);
     43 void GenerateFtraceEventProto(const std::vector<FtraceEventName>& raw_whitelist,
     44                               const std::set<std::string>& groups,
     45                               std::ostream* fout);
     46 std::string SingleEventInfo(perfetto::Proto proto,
     47                             const std::string& group,
     48                             const uint32_t proto_field_id);
     49 void GenerateEventInfo(const std::vector<std::string>& events_info,
     50                        std::ostream* fout);
     51 std::string ProtoHeader();
     52 
     53 }  // namespace perfetto
     54 
     55 #endif  // TOOLS_FTRACE_PROTO_GEN_FTRACE_PROTO_GEN_H_
     56