Skip to content

Conversation

@endersonmaia
Copy link
Contributor

@endersonmaia endersonmaia commented Nov 17, 2025

This is my first attempt to collaborate with lunatik in an topic I have interest that's metrics collection.

I'm starting with a simple luacpu, so I can get some feedback.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds CPU information query capabilities to the lualinux module by introducing two new functions: nproc() to get the number of online CPUs and cpustat() to retrieve detailed time statistics for individual CPUs.

  • Added nproc() function returning the number of online CPUs
  • Added cpustat() function for fetching per-CPU time statistics (user, system, idle, etc.)
  • Included example demonstrating usage of the new functions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/lualinux.c Implements the new nproc and cpustat functions with appropriate documentation, validation, and kernel API integration
examples/cpustat.lua Provides a working example that demonstrates how to query and display CPU statistics for all online CPUs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@lneto lneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks good to me if you want to merge without the example..

Copy link
Contributor

@lneto lneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just rename the PR's title? Thus, I can merge it. Thanks!

@endersonmaia endersonmaia changed the title Add nproc and cpustat to lualinux Add luacpu module Nov 20, 2025
@lneto lneto merged commit d4cdb08 into luainkernel:master Nov 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants