summaryrefslogtreecommitdiffstats
path: root/core/jni/org_codeaurora_Performance.cpp
diff options
context:
space:
mode:
authorDavid Ng <dave@codeaurora.org>2012-02-29 20:55:41 -0800
committerGiulio Cervera <giulio.cervera@gmail.com>2012-03-23 22:46:36 +0100
commit6afa5c05de436f13f56c8932a0ca8af044d5d77b (patch)
treee056f6b4bd48342a1c28c492cb34eeeaa6b7fa07 /core/jni/org_codeaurora_Performance.cpp
parent4849e25131ae6fdaa6ac1129f7109791eb3f8174 (diff)
downloadframeworks_base-6afa5c05de436f13f56c8932a0ca8af044d5d77b.zip
frameworks_base-6afa5c05de436f13f56c8932a0ca8af044d5d77b.tar.gz
frameworks_base-6afa5c05de436f13f56c8932a0ca8af044d5d77b.tar.bz2
Add cpuSetOptions API to org.codeaurora.Performance class
Change-Id: I66f7e910f4fee0a9d443356b00b452872628d3f0
Diffstat (limited to 'core/jni/org_codeaurora_Performance.cpp')
-rw-r--r--core/jni/org_codeaurora_Performance.cpp35
1 files changed, 27 insertions, 8 deletions
diff --git a/core/jni/org_codeaurora_Performance.cpp b/core/jni/org_codeaurora_Performance.cpp
index 6a562be..496972a 100644
--- a/core/jni/org_codeaurora_Performance.cpp
+++ b/core/jni/org_codeaurora_Performance.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -46,8 +46,9 @@ namespace android
// ----------------------------------------------------------------------------
-static void (*cpu_boost)(int) = NULL;
-static void *dlhandle = NULL;
+static void (*cpu_boost)(int) = NULL;
+static int (*cpu_setoptions)(int, int) = NULL;
+static void *dlhandle = NULL;
// ----------------------------------------------------------------------------
@@ -79,11 +80,15 @@ org_codeaurora_performance_native_init()
dlerror();
- *(void **) (&cpu_boost) = dlsym(dlhandle, "perf_cpu_boost");
+ cpu_boost = (void (*) (int))dlsym(dlhandle, "perf_cpu_boost");
if ((rc = dlerror()) != NULL) {
goto cleanup;
}
- *(void **) (&init) = dlsym(dlhandle, "libqc_opt_init");
+ cpu_setoptions = (int (*) (int, int))dlsym(dlhandle, "perf_cpu_setoptions");
+ if ((rc = dlerror()) != NULL) {
+ goto cleanup;
+ }
+ init = (void (*) ())dlsym(dlhandle, "libqc_opt_init");
if ((rc = dlerror()) != NULL) {
goto cleanup;
}
@@ -91,7 +96,8 @@ org_codeaurora_performance_native_init()
return;
cleanup:
- cpu_boost = NULL;
+ cpu_boost = NULL;
+ cpu_setoptions = NULL;
if (dlhandle) {
dlclose(dlhandle);
dlhandle = NULL;
@@ -104,9 +110,10 @@ org_codeaurora_performance_native_deinit(JNIEnv *env, jobject clazz)
void (*deinit)(void);
if (dlhandle) {
- cpu_boost = NULL;
+ cpu_boost = NULL;
+ cpu_setoptions = NULL;
- *(void **) (&deinit) = dlsym(dlhandle, "libqc_opt_deinit");
+ deinit = (void (*) ())dlsym(dlhandle, "libqc_opt_deinit");
if (deinit) {
(*deinit)();
}
@@ -124,10 +131,22 @@ org_codeaurora_performance_native_cpu_boost(JNIEnv *env, jobject clazz, jint nta
}
}
+static jint
+org_codeaurora_performance_native_cpu_setoptions(JNIEnv *env, jobject clazz,
+ jint reqtype, jint reqvalue)
+{
+ if (cpu_setoptions) {
+ return (*cpu_setoptions)(reqtype, reqvalue);
+ }
+ return 0;
+}
+
+
// ----------------------------------------------------------------------------
static JNINativeMethod gMethods[] = {
{"native_cpu_boost", "(I)V", (void *)org_codeaurora_performance_native_cpu_boost},
+ {"native_cpu_setoptions", "(II)I", (int *)org_codeaurora_performance_native_cpu_setoptions},
{"native_deinit", "()V", (void *)org_codeaurora_performance_native_deinit},
};