Skip to content

Commit

Permalink
Log non-idle usage to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
h313 committed Oct 22, 2024
1 parent 61b0178 commit dea08f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int main(int argc, char **argv) {
float usage = active_time / (active_time + idle_time);

// Check if usage is idle
if (usage < 0.05f && usage > 0.00f) {
if (usage < 0.1f && usage > 0.00f) {
std::cout << "CPU active time low" << std::endl;
// Increase trigger count now that idle is detected
output_data.trigger_count += 1;
Expand All @@ -106,6 +106,8 @@ int main(int argc, char **argv) {
// Sleep for the next 3 minutes before detecting again
sleep(180);
} else {
std::cout << "Only " << usage << " idle" << std::endl;
// Check again next minute
sleep(60);
}
}
Expand Down

0 comments on commit dea08f8

Please sign in to comment.