Last active
October 31, 2025 10:36
-
-
Save DhruvaG2000/a902b815b5db296bb7096ad7cb093929 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <fcntl.h> | |
| #include <unistd.h> | |
| #include <signal.h> | |
| #define QOS_DEV "/dev/cpu_wakeup_latency" | |
| #define LATENCY_VAL "0x7a110" /* <500000 ?unit? in hex */ | |
| static volatile int keep_running = 1; | |
| void sig_handler(int sig) { | |
| keep_running = 0; | |
| } | |
| int main(void) { | |
| int fd; | |
| signal(SIGINT, sig_handler); | |
| signal(SIGTERM, sig_handler); | |
| fd = open(QOS_DEV, O_RDWR); | |
| if (fd < 0) { | |
| perror("open"); | |
| return 1; | |
| } | |
| if (write(fd, LATENCY_VAL, sizeof(LATENCY_VAL) - 1) < 0) { | |
| perror("write"); | |
| close(fd); | |
| return 1; | |
| } | |
| printf("QoS set to %s. Press Ctrl+C to exit.\n", LATENCY_VAL); | |
| while (keep_running) | |
| sleep(1); | |
| close(fd); | |
| printf("Released.\n"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment