Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common power-libperfmgr bringup #1

Open
wants to merge 6 commits into
base: fourteen-v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libqti-perfd-client/.clang-format
18 changes: 18 additions & 0 deletions libqti-perfd-client/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Copyright (C) 2021-2024 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//

soong_namespace {
}

cc_library_shared {
name: "libqti-perfd-client",
srcs: ["client.c"],
shared_libs: [
"liblog",
"libutils",
],
vendor: true,
}
29 changes: 29 additions & 0 deletions libqti-perfd-client/client.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2021-2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/

#define LOG_TAG "libqti-perfd-client"

#include <log/log.h>
#include <stdint.h>

void perf_get_feedback() {}

void perf_hint() {}

int perf_lock_acq(int handle, int duration, int arg3[], int arg4) {
ALOGI("perf_lock_acq: handle: %d, duration: %d, arg3[0]: %d, arg4: %d", handle, duration,
arg3[0], arg4);
return handle ?: 233;
}
Comment on lines +16 to +20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential portability issue with GCC extension.

The use of the ?: ternary operator is a GCC extension and may not be portable. Consider using a standard ternary operator for better portability.

-    return handle ?: 233;
+    return handle ? handle : 233;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
int perf_lock_acq(int handle, int duration, int arg3[], int arg4) {
ALOGI("perf_lock_acq: handle: %d, duration: %d, arg3[0]: %d, arg4: %d", handle, duration,
arg3[0], arg4);
return handle ?: 233;
}
int perf_lock_acq(int handle, int duration, int arg3[], int arg4) {
ALOGI("perf_lock_acq: handle: %d, duration: %d, arg3[0]: %d, arg4: %d", handle, duration,
arg3[0], arg4);
return handle ? handle : 233;
}


void perf_lock_cmd() {}

int perf_lock_rel(int handle) {
ALOGI("perf_lock_rel: handle: %d", handle);
return handle ?: 233;
Comment on lines +24 to +26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential portability issue with GCC extension.

The use of the ?: ternary operator is a GCC extension and may not be portable. Consider using a standard ternary operator for better portability.

-    return handle ?: 233;
+    return handle ? handle : 233;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
int perf_lock_rel(int handle) {
ALOGI("perf_lock_rel: handle: %d", handle);
return handle ?: 233;
int perf_lock_rel(int handle) {
ALOGI("perf_lock_rel: handle: %d", handle);
return handle ? handle : 233;

}

void perf_lock_use_profile() {}