Talk:Linux CPU utilization: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎OS specific task: Virtualbox was my friend :-))
m (→‎OS specific task: Opps, forgot to sign my entry)
Line 13: Line 13:
Some programming languages may provide OS agnostic routines/libraries to get similar information
Some programming languages may provide OS agnostic routines/libraries to get similar information
(which would be superior to grepping around in <tt>/proc/stat</tt> IMO).
(which would be superior to grepping around in <tt>/proc/stat</tt> IMO).
&mdash;[[User:dchapes|dchapes]] ([[User talk:dchapes|talk]] | [[Special:Contributions/dchapes|contribs]]) 13:35, 27 May 2015‎ (UTC)


: Actually, it's probably better to have something like this be OS-specific. I've seen plenty of other tasks which are written in a way which implies they are OS-agnostic but where the difficulty of implementation is trivial for implementations which assume a specific OS context and near to implement portably without such assumptions. It'll never be perfect. And this one seems simple enough.
: Actually, it's probably better to have something like this be OS-specific. I've seen plenty of other tasks which are written in a way which implies they are OS-agnostic but where the difficulty of implementation is trivial for implementations which assume a specific OS context and near to implement portably without such assumptions. It'll never be perfect. And this one seems simple enough.

Revision as of 16:11, 28 May 2015

I think this task is pretty much ready to go... but as its the first task I've added to Rosetta Code, I'd like to get someone to review it first :) --Paul (talk) 09:49, 27 May 2015 (UTC)

OS specific task

I don't think OS specific tasks are a good idea. Does this really need to be OS specific?

For starters, /proc is not unique to Linux, although other OSes may provide other/better ways to get similar information (e.g. getloadavg(3)).

Some programming languages may provide OS agnostic routines/libraries to get similar information (which would be superior to grepping around in /proc/stat IMO). —dchapes (talk | contribs) 13:35, 27 May 2015‎ (UTC)

Actually, it's probably better to have something like this be OS-specific. I've seen plenty of other tasks which are written in a way which implies they are OS-agnostic but where the difficulty of implementation is trivial for implementations which assume a specific OS context and near to implement portably without such assumptions. It'll never be perfect. And this one seems simple enough.
That said, this one can be a pain if you don't have access to a linux implementation of your language. You can approximate, though, by using a surrogate file (representing /proc/stat) and code against that (changing it between reads). --Rdm (talk) 16:04, 27 May 2015 (UTC)
I fired up virtualbox with an Ubuntu image to create the Python version. --Paddy3118 (talk) 16:59, 27 May 2015 (UTC)