• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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_PRELUDE_TABLE_FUNCTIONS_EXPERIMENTAL_FLAMEGRAPH_H_
18 #define SRC_TRACE_PROCESSOR_PRELUDE_TABLE_FUNCTIONS_EXPERIMENTAL_FLAMEGRAPH_H_
19 
20 #include "src/trace_processor/prelude/table_functions/flamegraph_construction_algorithms.h"
21 #include "src/trace_processor/prelude/table_functions/table_function.h"
22 #include "src/trace_processor/storage/trace_storage.h"
23 
24 namespace perfetto {
25 namespace trace_processor {
26 
27 class TraceProcessorContext;
28 
29 class ExperimentalFlamegraph : public TableFunction {
30  public:
31   enum class ProfileType { kGraph, kHeapProfile, kPerf };
32 
33   struct InputValues {
34     ProfileType profile_type;
35     int64_t ts;
36     std::vector<TimeConstraints> time_constraints;
37     std::optional<UniquePid> upid;
38     std::optional<std::string> upid_group;
39     std::string focus_str;
40   };
41 
42   explicit ExperimentalFlamegraph(TraceProcessorContext* context);
43   virtual ~ExperimentalFlamegraph() override;
44 
45   Table::Schema CreateSchema() override;
46   std::string TableName() override;
47   uint32_t EstimateRowCount() override;
48   base::Status ValidateConstraints(const QueryConstraints&) override;
49   base::Status ComputeTable(const std::vector<Constraint>& cs,
50                             const std::vector<Order>& ob,
51                             const BitVector& cols_used,
52                             std::unique_ptr<Table>& table_return) override;
53 
54  private:
55   TraceProcessorContext* context_ = nullptr;
56 };
57 
58 }  // namespace trace_processor
59 }  // namespace perfetto
60 
61 #endif  // SRC_TRACE_PROCESSOR_PRELUDE_TABLE_FUNCTIONS_EXPERIMENTAL_FLAMEGRAPH_H_
62