• 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 #include "perfetto/ext/trace_processor/importers/memory_tracker/raw_process_memory_node.h"
18 
19 #include <stdio.h>
20 #include <stdlib.h>
21 
22 #include <cinttypes>
23 #include <functional>
24 #include <memory>
25 
26 #include "perfetto/base/logging.h"
27 
28 namespace perfetto {
29 namespace trace_processor {
30 
RawProcessMemoryNode(LevelOfDetail level_of_detail,AllocatorNodeEdgesMap && edges_map,MemoryNodesMap && nodes_map)31 RawProcessMemoryNode::RawProcessMemoryNode(LevelOfDetail level_of_detail,
32                                            AllocatorNodeEdgesMap&& edges_map,
33                                            MemoryNodesMap&& nodes_map)
34     : level_of_detail_(level_of_detail),
35       allocator_nodes_edges_(std::move(edges_map)),
36       allocator_nodes_(std::move(nodes_map)) {}
37 
38 RawProcessMemoryNode::RawProcessMemoryNode(RawProcessMemoryNode&&) = default;
39 RawProcessMemoryNode::~RawProcessMemoryNode() = default;
40 RawProcessMemoryNode& RawProcessMemoryNode::operator=(RawProcessMemoryNode&&) =
41     default;
42 
GetAllocatorNode(const std::string & absolute_name) const43 RawMemoryGraphNode* RawProcessMemoryNode::GetAllocatorNode(
44     const std::string& absolute_name) const {
45   auto it = allocator_nodes_.find(absolute_name);
46   if (it != allocator_nodes_.end())
47     return it->second.get();
48   return nullptr;
49 }
50 
51 }  // namespace trace_processor
52 }  // namespace perfetto
53