• 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 INCLUDE_PERFETTO_FTRACE_READER_FTRACE_CONFIG_H_
18 #define INCLUDE_PERFETTO_FTRACE_READER_FTRACE_CONFIG_H_
19 
20 #include <set>
21 #include <string>
22 
23 #include "perfetto/tracing/core/ftrace_config.h"
24 
25 namespace perfetto {
26 
27 // 0 is invalid.
28 using FtraceConfigId = uint64_t;
29 
30 // Utility method for the common case where we don't care about atrace events.
31 FtraceConfig CreateFtraceConfig(std::set<std::string> names);
32 
33 // Get the ftrace events for a config as a set.
34 std::set<std::string> FtraceEventsAsSet(const FtraceConfig&);
35 
36 // Returns true iff the config has any atrace categories or apps.
37 bool RequiresAtrace(const FtraceConfig&);
38 
39 // Returns true iff the config is 'valid'. Spesfically all the
40 // event/categories/app names should not look like:
41 // "../../some/kind/of/directory/escape".
42 bool ValidConfig(const FtraceConfig& config);
43 
44 }  // namespace perfetto
45 
46 #endif  // INCLUDE_PERFETTO_FTRACE_READER_FTRACE_CONFIG_H_
47