summaryrefslogtreecommitdiff
path: root/power/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'power/utils.c')
-rw-r--r--power/utils.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/power/utils.c b/power/utils.c
index 202b718..ac73edd 100644
--- a/power/utils.c
+++ b/power/utils.c
@@ -33,6 +33,7 @@
#include <errno.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/stat.h>
#include "utils.h"
#include "list.h"
@@ -42,6 +43,9 @@
#define LOG_TAG "QCOM PowerHAL"
#include <utils/Log.h>
+#define USINSEC 1000000L
+#define NSINUS 1000L
+
#define SOC_ID_0 "/sys/devices/soc0/soc_id"
#define SOC_ID_1 "/sys/devices/system/soc/soc0/id"
@@ -391,6 +395,14 @@ void start_prefetch(int pid, const char* packageName) {
}
}
+long long calc_timespan_us(struct timespec start, struct timespec end)
+{
+ long long diff_in_us = 0;
+ diff_in_us += (end.tv_sec - start.tv_sec) * USINSEC;
+ diff_in_us += (end.tv_nsec - start.tv_nsec) / NSINUS;
+ return diff_in_us;
+}
+
int get_soc_id(void)
{
int fd;