summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRiana Tauro <riana.tauro@intel.com>2022-10-17 11:05:23 +0530
committerAshutosh Dixit <ashutosh.dixit@intel.com>2022-10-17 15:31:22 -0700
commit8312a2fe3f3287ba4ac4bc8d100de0734480f482 (patch)
treee14898c214d3a21df2d5ec8f330e4c8f7b11b59a /lib
parentb1d19b13ae349b6279686ac6bb1a2d9a4d4b8e6c (diff)
lib/igt_power: clean-up igt_power library
Remove unused rapl functions from igt_power. No functional changes Signed-off-by: Riana Tauro <riana.tauro@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_power.c13
-rw-r--r--lib/igt_power.h58
2 files changed, 12 insertions, 59 deletions
diff --git a/lib/igt_power.c b/lib/igt_power.c
index 3f3633eb9..3b34be406 100644
--- a/lib/igt_power.c
+++ b/lib/igt_power.c
@@ -53,7 +53,7 @@ static int rapl_parse(struct rapl *r, const char *str)
return 0;
}
-int rapl_open(struct rapl *r, const char *domain)
+static int rapl_open(struct rapl *r, const char *domain)
{
r->fd = rapl_parse(r, domain);
if (r->fd < 0)
@@ -72,6 +72,17 @@ err:
return r->fd;
}
+static inline bool rapl_read(struct rapl *r, struct power_sample *s)
+{
+ return read(r->fd, s, sizeof(*s)) == sizeof(*s);
+}
+
+static inline void rapl_close(struct rapl *r)
+{
+ close(r->fd);
+ r->fd = -1;
+}
+
/**
* igt_power_open:
* @fd : device fd
diff --git a/lib/igt_power.h b/lib/igt_power.h
index 0984c2df6..68a05300e 100644
--- a/lib/igt_power.h
+++ b/lib/igt_power.h
@@ -44,72 +44,14 @@ struct igt_power {
int hwmon_fd;
};
-int rapl_open(struct rapl *r, const char *domain);
int igt_power_open(int i915, struct igt_power *p, const char *domain);
void igt_power_close(struct igt_power *p);
-static inline int cpu_power_open(struct rapl *r)
-{
- return rapl_open(r, "cpu");
-}
-
-static inline int gpu_power_open(struct rapl *r)
-{
- return rapl_open(r, "gpu");
-}
-
-static inline int pkg_power_open(struct rapl *r)
-{
- return rapl_open(r, "pkg");
-}
-
-static inline bool rapl_valid(struct rapl *r)
-{
- return r->fd >= 0;
-}
-
-static inline int ram_power_open(struct rapl *r)
-{
- return rapl_open(r, "ram");
-}
-
-static inline bool rapl_read(struct rapl *r, struct power_sample *s)
-{
- return read(r->fd, s, sizeof(*s)) == sizeof(*s);
-}
-
-static inline void rapl_close(struct rapl *r)
-{
- close(r->fd);
- r->fd = -1;
-}
-
static inline bool igt_power_valid(struct igt_power *p)
{
return (p->rapl.fd >= 0) || (p->hwmon_fd >= 0);
}
-static inline double power_J(const struct rapl *r,
- const struct power_sample *p0,
- const struct power_sample *p1)
-{
- return (p1->energy - p0->energy) * r->scale;
-}
-
-static inline double power_s(const struct rapl *r,
- const struct power_sample *p0,
- const struct power_sample *p1)
-{
- return (p1->time - p0->time) * 1e-9;
-}
-
-static inline double power_W(const struct rapl *r,
- const struct power_sample *p0,
- const struct power_sample *p1)
-{
- return power_J(r, p0, p1) / power_s(r, p0, p1);
-}
-
void igt_power_get_energy(struct igt_power *p, struct power_sample *s);
double igt_power_get_mJ(const struct igt_power *power,