[Toybox] patch: taskset-work-as-nice (was Re: new toy: taskset)

Rob Landley rob at landley.net
Fri Jul 20 15:44:50 PDT 2012


On 07/20/2012 02:51 AM, Elie De Brauwer wrote:
> On 07/19/2012 03:41 AM, Rob Landley wrote:
>>> Meaning to works as renice, rather than nice. I'm open to suggestions, I
>>> can as well the 'work-as-nice' functionality,
>>
>> Is there more to it than:
>>
>>    if (opt.argc>2) xexec(toys.optargs+2);
>>
>> Well, taskset getpid() and then exec. And detect -p... ok there's a bit
>> of work.
>>
>> I'd prefer if you could add the new work-as-nice stuff since you know
>> what the UI should be like, and I'll hold off converting to the raw
>> syscall until then. Sound good?
>>
> 
> In attach a patch which makes taskset work as both nice (and renice, the
> existing behavior).

Applied.

> The following example which spawns four loops:

It'd be nice if there was a way to add a test to scripts/test, but that
assumes at least a 2-processor machine.

Hmmm... I suppose that's easy enough to test for:

  if [ "$(echo /sys/devices/system/cpu/cpu[0-9] | wc -w" -lt 2 ]
  then
    exit 0
  fi

Or similar...

Rob
-- 
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation.  Pick one.

 1342824290.0


More information about the Toybox mailing list