[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / components / power_metrics / resource_coalition_internal_types_mac.h
1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file defines data types used to retrieve coalition metrics from the OS.
6
7 #ifndef COMPONENTS_POWER_METRICS_RESOURCE_COALITION_INTERNAL_TYPES_MAC_H_
8 #define COMPONENTS_POWER_METRICS_RESOURCE_COALITION_INTERNAL_TYPES_MAC_H_
9
10 #include <stdint.h>
11
12 // Comes from osfmk/mach/coalition.h
13 #define COALITION_TYPE_RESOURCE (0)
14 #define COALITION_TYPE_JETSAM (1)
15 #define COALITION_TYPE_MAX (1)
16
17 #define COALITION_NUM_TYPES (COALITION_TYPE_MAX + 1)
18
19 #define COALITION_NUM_THREAD_QOS_TYPES 7
20
21 // Comes from osfmk/mach/thread_policy.h
22 #define THREAD_QOS_UNSPECIFIED 0
23 #define THREAD_QOS_DEFAULT THREAD_QOS_UNSPECIFIED /* Temporary rename */
24 #define THREAD_QOS_MAINTENANCE 1
25 #define THREAD_QOS_BACKGROUND 2
26 #define THREAD_QOS_UTILITY 3
27 #define THREAD_QOS_LEGACY 4 /* i.e. default workq threads */
28 #define THREAD_QOS_USER_INITIATED 5
29 #define THREAD_QOS_USER_INTERACTIVE 6
30
31 #define THREAD_QOS_LAST 7
32
33 static_assert(COALITION_NUM_THREAD_QOS_TYPES == THREAD_QOS_LAST,
34               "Unexpected number of QoS levels.");
35
36 // Comes from bsd/sys/coalition.h
37 struct coalition_resource_usage {
38   uint64_t tasks_started;
39   uint64_t tasks_exited;
40   uint64_t time_nonempty;
41   uint64_t cpu_time;
42   uint64_t interrupt_wakeups;
43   uint64_t platform_idle_wakeups;
44   uint64_t bytesread;
45   uint64_t byteswritten;
46   uint64_t gpu_time;
47   uint64_t cpu_time_billed_to_me;
48   uint64_t cpu_time_billed_to_others;
49   uint64_t energy;
50   uint64_t logical_immediate_writes;
51   uint64_t logical_deferred_writes;
52   uint64_t logical_invalidated_writes;
53   uint64_t logical_metadata_writes;
54   uint64_t logical_immediate_writes_to_external;
55   uint64_t logical_deferred_writes_to_external;
56   uint64_t logical_invalidated_writes_to_external;
57   uint64_t logical_metadata_writes_to_external;
58   uint64_t energy_billed_to_me;
59   uint64_t energy_billed_to_others;
60   uint64_t cpu_ptime;
61   uint64_t cpu_time_eqos_len; /* Stores the number of thread QoS types */
62   uint64_t cpu_time_eqos[COALITION_NUM_THREAD_QOS_TYPES];
63   uint64_t cpu_instructions;
64   uint64_t cpu_cycles;
65   uint64_t fs_metadata_writes;
66   uint64_t pm_writes;
67 };
68
69 struct proc_pidcoalitioninfo {
70   uint64_t coalition_id[COALITION_NUM_TYPES];
71   uint64_t reserved1;
72   uint64_t reserved2;
73   uint64_t reserved3;
74 };
75
76 // Comes from bsd/sys/proc_info.h
77 #define PROC_PIDCOALITIONINFO 20
78
79 #endif  // COMPONENTS_POWER_METRICS_RESOURCE_COALITION_INTERNAL_TYPES_MAC_H_