Debian Codegraph @

src/libsysprof/sysprof-energy-usage.c

raw
1 /* sysprof-energy-usage.c
2 *
3 * Copyright 2023 Christian Hergert <[email protected]>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: GPL-3.0-or-later
19 */
20
21 #include "config.h"
22
23 #include "sysprof-proxied-instrument-private.h"
24 #include "sysprof-energy-usage.h"
25
26 struct _SysprofEnergyUsage
27 {
28 SysprofProxiedInstrument parent_instance;
29 };
30
31 struct _SysprofEnergyUsageClass
32 {
33 SysprofProxiedInstrumentClass parent_class;
34 };
35
36 G_DEFINE_FINAL_TYPE (SysprofEnergyUsage, sysprof_energy_usage, SYSPROF_TYPE_PROXIED_INSTRUMENT)
37
38 static void
39 sysprof_energy_usage_class_init (SysprofEnergyUsageClass *klass)
40 {
41 }
42
43 static void
44 sysprof_energy_usage_init (SysprofEnergyUsage *self)
45 {
46 SYSPROF_PROXIED_INSTRUMENT (self)->call_stop_first = TRUE;
47 }
48
49 SysprofInstrument *
50 sysprof_energy_usage_new (void)
51 {
52 return g_object_new (SYSPROF_TYPE_ENERGY_USAGE,
53 "bus-type", G_BUS_TYPE_SYSTEM,
54 "bus-name", "org.gnome.Sysprof3",
55 "object-path", "/org/gnome/Sysprof3/RAPL",
56 NULL);
57 }