Set tracking window to 5s, rearranged code so it's alphabetical (IO before MEM)
This commit is contained in:
parent
08c476910f
commit
e09aacd35f
27
monitor.c
27
monitor.c
@ -6,9 +6,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define CPU_TRACKING_WINDOW_SECS 1
|
#define CPU_TRACKING_WINDOW_SECS 5
|
||||||
#define IO_TRACKING_WINDOW_SECS 1
|
#define IO_TRACKING_WINDOW_SECS 5
|
||||||
#define MEM_TRACKING_WINDOW_SECS 1
|
#define MEM_TRACKING_WINDOW_SECS 5
|
||||||
#define CPU_TRIGGER_THRESHOLD_MS 1000
|
#define CPU_TRIGGER_THRESHOLD_MS 1000
|
||||||
#define IO_TRIGGER_THRESHOLD_MS 1000
|
#define IO_TRIGGER_THRESHOLD_MS 1000
|
||||||
#define MEM_TRIGGER_THRESHOLD_MS 1000
|
#define MEM_TRIGGER_THRESHOLD_MS 1000
|
||||||
@ -51,12 +51,13 @@ void setup_polling() {
|
|||||||
fds[FD_IO_IDX].fd = open(IO_PRESSURE_FILE, O_RDWR | O_NONBLOCK);
|
fds[FD_IO_IDX].fd = open(IO_PRESSURE_FILE, O_RDWR | O_NONBLOCK);
|
||||||
if (fds[FD_IO_IDX].fd < 0)
|
if (fds[FD_IO_IDX].fd < 0)
|
||||||
fatal_error("open(): " IO_PRESSURE_FILE);
|
fatal_error("open(): " IO_PRESSURE_FILE);
|
||||||
|
|
||||||
/* Let's setup our MEM PSI trigger */
|
/* Let's setup our MEM PSI trigger */
|
||||||
fds[FD_MEM_IDX].fd = open(MEM_PRESSURE_FILE, O_RDWR | O_NONBLOCK);
|
fds[FD_MEM_IDX].fd = open(MEM_PRESSURE_FILE, O_RDWR | O_NONBLOCK);
|
||||||
if (fds[FD_MEM_IDX].fd < 0)
|
if (fds[FD_MEM_IDX].fd < 0)
|
||||||
fatal_error("open(): " MEM_PRESSURE_FILE);
|
fatal_error("open(): " MEM_PRESSURE_FILE);
|
||||||
|
|
||||||
fds[FD_CPU_IDX].events = fds[FD_MEM_IDX].events = fds[FD_IO_IDX].events = POLLPRI;
|
fds[FD_CPU_IDX].events = fds[FD_IO_IDX].events = fds[FD_MEM_IDX].events = POLLPRI;
|
||||||
|
|
||||||
char trigger[128];
|
char trigger[128];
|
||||||
|
|
||||||
@ -66,17 +67,17 @@ void setup_polling() {
|
|||||||
if (write(fds[FD_CPU_IDX].fd, trigger, strlen(trigger) + 1) < 0)
|
if (write(fds[FD_CPU_IDX].fd, trigger, strlen(trigger) + 1) < 0)
|
||||||
fatal_error("write(): " CPU_PRESSURE_FILE);
|
fatal_error("write(): " CPU_PRESSURE_FILE);
|
||||||
|
|
||||||
snprintf(trigger, 128, "some %d %d", MEM_TRIGGER_THRESHOLD_MS * 1000, MEM_TRACKING_WINDOW_SECS * 1000000);
|
|
||||||
printf("Trigger: %s\n", trigger);
|
|
||||||
fflush(stdout);
|
|
||||||
if (write(fds[FD_MEM_IDX].fd, trigger, strlen(trigger) + 1) < 0)
|
|
||||||
fatal_error("write(): " MEM_PRESSURE_FILE);
|
|
||||||
|
|
||||||
snprintf(trigger, 128, "some %d %d", IO_TRIGGER_THRESHOLD_MS * 1000, IO_TRACKING_WINDOW_SECS * 1000000);
|
snprintf(trigger, 128, "some %d %d", IO_TRIGGER_THRESHOLD_MS * 1000, IO_TRACKING_WINDOW_SECS * 1000000);
|
||||||
printf("Trigger: %s\n", trigger);
|
printf("Trigger: %s\n", trigger);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (write(fds[FD_IO_IDX].fd, trigger, strlen(trigger) + 1) < 0)
|
if (write(fds[FD_IO_IDX].fd, trigger, strlen(trigger) + 1) < 0)
|
||||||
fatal_error("write(): " IO_PRESSURE_FILE);
|
fatal_error("write(): " IO_PRESSURE_FILE);
|
||||||
|
|
||||||
|
snprintf(trigger, 128, "some %d %d", MEM_TRIGGER_THRESHOLD_MS * 1000, MEM_TRACKING_WINDOW_SECS * 1000000);
|
||||||
|
printf("Trigger: %s\n", trigger);
|
||||||
|
fflush(stdout);
|
||||||
|
if (write(fds[FD_MEM_IDX].fd, trigger, strlen(trigger) + 1) < 0)
|
||||||
|
fatal_error("write(): " MEM_PRESSURE_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,12 +115,12 @@ void wait_for_notification() {
|
|||||||
printf("CPU PSI event %d triggered.\n", cpu_event_counter++);
|
printf("CPU PSI event %d triggered.\n", cpu_event_counter++);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
else if (i == FD_MEM_IDX) {
|
else if (i == FD_IO_IDX) {
|
||||||
printf("MEM PSI event %d triggered.\n", mem_event_counter++);
|
printf("IO PSI event %d triggered.\n", mem_event_counter++);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("IO PSI event %d triggered.\n", io_event_counter++);
|
printf("MEM PSI event %d triggered.\n", io_event_counter++);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user