chuck icon indicating copy to clipboard operation
chuck copied to clipboard

Feature loadavg

Open dbadb opened this issue 2 years ago • 1 comments

Here is a simple proof-of-concept that provides a portable loadavg-like facility for chuck. This topic was raised on the chuck-users listserv and commented on by @spencersalazar.

I've tried this on three platforms (mac, linux, win32) and it seems to produce very consistent, useful, interpretable results. Since I can run the same chuck script on my various machines, it also provides a handy-dandy benchmarking capability.

This prototype utilized the global manager and updates a "secret" global variable named float _ckLoadAvg. Values produced range between .02 and .85 (but I haven't pushed it to the limit).

Here's a trivial test. Obviously this is more useful if you use otf and have the "real script" running simultaneously.

global float _ckLoadAvg;
while(1)
{
    <<<"_ckLoadAvg", _ckLoadAvg>>>;
    1000::ms => now;
}

dbadb avatar Apr 23 '22 00:04 dbadb

Comments from ChucK engine-experts more than welcome. Is the globals-manager the best way to do this? Should it be made more first-class? (I explored adding it to chuck_types, but punted on the grounds of proof-of-concept atm).

dbadb avatar Apr 23 '22 00:04 dbadb