forked from nemequ/vala-extra-vapis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpufreq.vapi
127 lines (109 loc) · 4.11 KB
/
cpufreq.vapi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* cpufreq.vapi
*
* Copyright (C) 2011 Nikolay Orlyuk
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Nikolay Orlyuk <virkony@gmail.com>
*/
// note that this vapi is based on headers and sources of cpufrequtils-008
[CCode (lower_case_cprefix = "cpufreq_", cheader_filename = "cpufreq.h")]
namespace CpuFreq {
// units
[SimpleType]
[CCode (cname = "unsigned long")]
public struct Hz : ulong {
public MHz mhz { get { return this / 1000000f; } }
}
[SimpleType]
[CCode (cname = "float")]
public struct MHz : float {
public Hz hz { get { return (Hz)(this * 1000000f); } }
}
[Compact]
[CCode (cname = "char", free_function = "cpufreq_put_driver")]
public class Driver : string {
}
[Compact]
[CCode (cname = "struct cpufreq_policy", free_function = "cpufreq_put_policy")]
public class Policy {
public Hz min;
public Hz max;
public unowned string governor;
}
[Compact]
[CCode (cname = "struct cpufreq_available_governors", free_function = "cpufreq_put_available_governors")]
public class AvailableGovernors {
public unowned string governor;
public unowned AvailableGovernors next;
public unowned AvailableGovernors first;
}
[Compact]
[CCode (cname = "struct cpufreqb_available_frequencies", free_function = "cpufreq_put_available_frequencies")]
public class AvailableFrequencies {
public Hz frequency;
public unowned AvailableFrequencies next;
public unowned AvailableFrequencies first;
}
[Compact]
[CCode (cname = "struct cpufreq_affected_cpus", free_function = "cpufreq_put_affected_cpus")]
public class AffectedCpus {
public Cpu cpu;
public unowned AffectedCpus next;
public unowned AffectedCpus first;
}
[Compact]
[CCode (cname = "struct cpufreq_affected_cpus", free_function = "cpufreq_put_related_cpus")]
public class RelatedCpus {
public Cpu cpu;
public unowned RelatedCpus next;
public unowned RelatedCpus first;
}
[Compact]
[CCode (cname = "struct cpufreq_stats", free_function = "cpufreq_put_stats")]
public class Stats {
public Hz frequency;
public uint64 time_in_state;
public unowned Stats next;
public unowned Stats first;
}
[SimpleType]
[CCode (cname = "unsigned int", lower_case_cprefix = "cpufreq_")]
public struct Cpu : uint {
public int cpu_exists();
public bool exists { get { return cpu_exists() == 0; } }
public Hz freq_kernel { get; }
public Hz freq_hardware { get; }
public Hz frequency {
[CCode (cname = "cpufreq_get")]
get;
set;
}
public ulong transition_latency { get; }
public int get_hardware_limits(out Hz min, out Hz max);
public Driver driver { owned get; }
public Policy policy { owned get; set; }
public int modify_policy_min(Hz min_freq);
public int modify_policy_max(Hz min_freq);
public int modify_policy_governor(string governor);
public AvailableGovernors available_governors { owned get; }
public AvailableFrequencies available_frequencies { owned get; }
public AffectedCpus affected_cpus { owned get; }
public RelatedCpus related_cpus { owned get; }
public Stats stats { owned get; }
public ulong transitions { get; }
}
}