OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GPU_IPC_COMMON_MEMORY_STATS_H_ | 5 #ifndef GPU_IPC_COMMON_MEMORY_STATS_H_ |
6 #define GPU_IPC_COMMON_MEMORY_STATS_H_ | 6 #define GPU_IPC_COMMON_MEMORY_STATS_H_ |
7 | 7 |
8 // Provides access to the GPU information for the system | 8 // Provides access to the GPU information for the system |
9 // on which chrome is currently running. | 9 // on which chrome is currently running. |
10 | 10 |
11 #include <stddef.h> | 11 #include <stddef.h> |
12 | 12 |
13 #include <map> | 13 #include <map> |
14 | 14 |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
16 #include "gpu/gpu_export.h" | 16 #include "gpu/gpu_export.h" |
17 | 17 |
18 namespace gpu { | 18 namespace gpu { |
19 | 19 |
20 // Note: we use uint64_t instead of size_t for byte count because this struct | 20 // Note: we use uint64_t instead of size_t for byte count because this struct |
21 // is sent over IPC which could span 32 & 64 bit processes. | 21 // is sent over IPC which could span 32 & 64 bit processes. |
22 struct GPU_EXPORT VideoMemoryUsageStats { | 22 struct GPU_EXPORT VideoMemoryUsageStats { |
23 VideoMemoryUsageStats(); | 23 VideoMemoryUsageStats(); |
| 24 VideoMemoryUsageStats(const VideoMemoryUsageStats& other); |
24 ~VideoMemoryUsageStats(); | 25 ~VideoMemoryUsageStats(); |
25 | 26 |
26 struct GPU_EXPORT ProcessStats { | 27 struct GPU_EXPORT ProcessStats { |
27 ProcessStats(); | 28 ProcessStats(); |
28 ~ProcessStats(); | 29 ~ProcessStats(); |
29 | 30 |
30 // The bytes of GPU resources accessible by this process | 31 // The bytes of GPU resources accessible by this process |
31 uint64_t video_memory; | 32 uint64_t video_memory; |
32 | 33 |
33 // Set to true if this process' GPU resource count is inflated because | 34 // Set to true if this process' GPU resource count is inflated because |
34 // it is counting other processes' resources (e.g, the GPU process has | 35 // it is counting other processes' resources (e.g, the GPU process has |
35 // duplicate set to true because it is the aggregate of all processes) | 36 // duplicate set to true because it is the aggregate of all processes) |
36 bool has_duplicates; | 37 bool has_duplicates; |
37 }; | 38 }; |
38 typedef std::map<base::ProcessId, ProcessStats> ProcessMap; | 39 typedef std::map<base::ProcessId, ProcessStats> ProcessMap; |
39 | 40 |
40 // A map of processes to their GPU resource consumption | 41 // A map of processes to their GPU resource consumption |
41 ProcessMap process_map; | 42 ProcessMap process_map; |
42 | 43 |
43 // The total amount of GPU memory allocated at the time of the request. | 44 // The total amount of GPU memory allocated at the time of the request. |
44 uint64_t bytes_allocated; | 45 uint64_t bytes_allocated; |
45 | 46 |
46 // The maximum amount of GPU memory ever allocated at once. | 47 // The maximum amount of GPU memory ever allocated at once. |
47 uint64_t bytes_allocated_historical_max; | 48 uint64_t bytes_allocated_historical_max; |
48 }; | 49 }; |
49 | 50 |
50 } // namespace gpu | 51 } // namespace gpu |
51 | 52 |
52 #endif // GPU_IPC_COMMON_MEMORY_STATS_H_ | 53 #endif // GPU_IPC_COMMON_MEMORY_STATS_H_ |
OLD | NEW |