Used Claude Sonnet 3.5 agent to add license and documentation to all
files in the project
This commit is contained in:
@@ -1,3 +1,30 @@
|
||||
// MIT License
|
||||
// Copyright (c) 2025 Mahesh @ HeshApps
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
//! CPU usage monitoring module for Unibar
|
||||
//!
|
||||
//! This module tracks CPU utilization by sampling /proc/stat and calculating
|
||||
//! the percentage of time spent in different CPU states. It provides real-time
|
||||
//! CPU usage information for display in the status bar.
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::{self, BufRead, BufReader};
|
||||
use std::thread;
|
||||
@@ -6,6 +33,11 @@ use std::time::Duration;
|
||||
use crate::common;
|
||||
use crate::bar_modules;
|
||||
|
||||
/// Represents CPU time spent in various states
|
||||
///
|
||||
/// This struct holds counters for different CPU states as reported by /proc/stat.
|
||||
/// Each field represents the amount of time the CPU has spent in that particular state
|
||||
/// since system boot, measured in USER_HZ units (typically 100Hz).
|
||||
#[derive(Debug, Default, Clone)]
|
||||
struct CpuTimes {
|
||||
user: u64,
|
||||
|
Reference in New Issue
Block a user