Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8333541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:04:12+00:00 2026-06-09T03:04:12+00:00

Do all of the BSDs have a common way to get CPU stats (time

  • 0

Do all of the BSDs have a common way to get CPU stats (time spend in kernel, idle, user, etc) like Linux has in the first line of /proc/stats?

I’m trying to detect a system under load and not perform computations when it is active (above a certain threshold). I’ve figured out how to do it on Windows/Linux.

I think I’ll need to use sysctl somehow. I’ve found this:

http://osdir.com/ml/darwin-kernel/2009-06/msg00036.html

Is this cross-platform? I’m trying to target these BSDs in particular:

  • Mac OS 10.6+
  • FreeBSD 8+
  • OpenBSD 5+

I’m only marginally familiar with the BSDs (I played with FreeBSD for a bit as a teenager), so any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:04:13+00:00Added an answer on June 9, 2026 at 3:04 am

    Nope – those things are not quite that portable. Though

          sysctl vm.loadavg 
          vm.loadavg: { 0.98 1.39 1.50 }
    

    happens to work for the above set and is somewhat comparable.

    If you need something simple yet broad – I’d consider the parsing of the command uptime (that behind the scenes relies on sysctls which are subtly different between platforms) – and extracting the load numbers:

          uptime
          11:38AM  up 18 days, 15:50, 2 users, load averages: 0.04, 0.01, 0.00
    

    That is pretty cross platform – and has very similar semantics.

    If that is not good enough – what you could do is ensure that the system runs an SNMP agent which exposes the host resources MIB. That gets you an easy platform independent way of getting load. If you really want to do this from your code – consider taking this bit of code from net-snmp – as it has the various flavours of /proc and sysctl for a lot of platforms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All- I am trying to get the user's current location than display that on
All , I have html like below . I want H2 element and Div
All, If I run a query like the following: $qry = Select wrong_column from
All -- I have these two methods in one of my classes: public static
all. We're trying to get some intersect collisions working, but the problem experience is
ALL, is there any solution to get the number of opened files in my
All, I have the following class so to check to see if the form
All, I have a guestbook feature on my site and I keep getting spammed.
All, I am trying to create a table to receive user inputs (UGC). This
All, I have the following code: $fetch = mysql_query(SELECT * FROM calendar_events where event_status='booked'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.