2 * Copyright © 2019 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
48 int igt_power_open(int i915
, struct igt_power
*p
, const char *domain
);
49 void igt_power_close(struct igt_power
*p
);
51 int igt_power_bat_open(struct igt_power
*p
, int index
);
53 static inline bool igt_power_valid(struct igt_power
*p
)
55 return p
->rapl
.fd
>= 0 || p
->hwmon_fd
>= 0 || p
->bat_fd
>= 0;
58 void igt_power_get_energy(struct igt_power
*p
, struct power_sample
*s
);
60 double igt_power_get_mJ(const struct igt_power
*power
,
61 const struct power_sample
*p0
,
62 const struct power_sample
*p1
);
63 double igt_power_get_mW(const struct igt_power
*power
,
64 const struct power_sample
*p0
,
65 const struct power_sample
*p1
);
66 double igt_power_get_s(const struct power_sample
*p0
,
67 const struct power_sample
*p1
);
68 #endif /* IGT_POWER_H */