Skip to content

phenomenology-of-code/pmset-analyzer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pmset-analyzer

A Python tool to analyze macOS sleep logs generated by pmset -g and provide insights into wake-up events and their causes.

Installation

This project uses uv for dependency management. Install uv first if you haven't already:

curl -LsSf https://astral.sh/uv/install.sh | sh

Then install the project:

uv sync

Usage

Generate a sleep log

First, generate a sleep log from your Mac:

pmset -g > sleep-log.txt

Analyze the log

uv run pmset_analyzer.py sleep-log.txt

Example Output

=== macOS Sleep Log Analysis ===

📊 Total wake events: 4866
📅 Log period: 2025-06-24 19:25:22 to 2025-06-25 08:12:22

🔍 Wake Sources:
  • Deep Idle [CDN]: 4866 times (100.0%)

🚨 Top Wake Causes:
  • wifibt: 9733 times (39.2%)
  • SMC.OutboxNotEmpty: 5102 times (20.6%)
  • smc.70070000: 4866 times (19.6%)
  • SMC.OutboxNotEmpty/: 4630 times (18.7%)

⏱️  Average wake duration: 6.3 seconds
🔄 Shortest wake: 5 seconds
⏰ Longest wake: 81 seconds

🔄 Wake Frequency Analysis:
  • Average time between wakes: 0.2 minutes
  • Frequent wakes (< 5 min apart): 4862 occurrences

⚠️  Most Active Drivers/Components:
  • SMC (System Management Controller): 14599 wake events (58.9%)
  • Wireless (WiFi/Bluetooth): 9737 wake events (39.3%)
  • Other: 467 wake events (1.9%)

📋 Recent Wake Events:
  • 2025-06-25 08:09:38: smc.70070000 wifibt SMC.OutboxNotEmpty/UserActivit... (0s)
  • 2025-06-25 08:09:32: smc.70070000 wifibt SMC.OutboxNotEmpty/ (6s)
  • 2025-06-25 08:09:23: smc.70070000 wifibt SMC.OutboxNotEmpty/ (6s)

Verbose Output with Examples

When using the -v flag, the tool also shows example log entries for each top wake cause:

🚨 Top Wake Causes:
  • wifibt: 9733 times (39.2%)
    📝 Example log entries:
       2025-06-24 19:25:22 +0200 DarkWake: DarkWake from Deep Idle [CDN] : due to smc.70070000 wifibt SM...
       DriverReason: DriverReason:wifibt - DriverDetails:
       2025-06-24 19:25:34 +0200 DarkWake: DarkWake from Deep Idle [CDN] : due to smc.70070000 wifibt SM...

  • SMC.OutboxNotEmpty: 5102 times (20.6%)
    📝 Example log entries:
       2025-06-24 19:25:22 +0200 DarkWake: DarkWake from Deep Idle [CDN] : due to smc.70070000 wifibt SM...
       DriverReason: DriverReason:SMC.OutboxNotEmpty - DriverDetails:
       2025-06-24 19:25:34 +0200 DarkWake: DarkWake from Deep Idle [CDN] : due to smc.70070000 wifibt SM...

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with your own sleep logs
  5. Submit a pull request

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Apache License 2.0

Copyright 2025 pmset-analyzer contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%