From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6790C138CA2 for ; Tue, 21 Apr 2015 01:05:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 00453E08EA; Tue, 21 Apr 2015 01:05:24 +0000 (UTC) Received: from ironport2-out.teksavvy.com (ironport2-out.teksavvy.com [206.248.154.181]) by pigeon.gentoo.org (Postfix) with ESMTP id DBF08E0854 for ; Tue, 21 Apr 2015 01:05:22 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRLd/a7/2dsb2JhbAA3gVOhb4EIgjYcXxMhBSUkExuUAZV1i3UDAxEVAgcLEAgCAgIdA4M+AwoyglFjBI1Vh2GFbYhAhFg X-IPAS-Result: AgUFAGvvdVRLd/a7/2dsb2JhbAA3gVOhb4EIgjYcXxMhBSUkExuUAZV1i3UDAxEVAgcLEAgCAgIdA4M+AwoyglFjBI1Vh2GFbYhAhFg X-IronPort-AV: E=Sophos;i="5.11,557,1422939600"; d="scan'208";a="116937027" Received: from 75-119-246-187.dsl.teksavvy.com (HELO waltdnes.org) ([75.119.246.187]) by ironport2-out.teksavvy.com with SMTP; 20 Apr 2015 21:05:20 -0400 Received: by waltdnes.org (sSMTP sendmail emulation); Mon, 20 Apr 2015 21:05:06 -0400 From: "Walter Dnes" Date: Mon, 20 Apr 2015 21:05:06 -0400 To: Gentoo Users List Subject: [gentoo-user] Questions about cpu frequency utils scripting Message-ID: <20150421010506.GA11689@waltdnes.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Archives-Salt: b23c6a1e-006d-474e-b655-12b13481bab6 X-Archives-Hash: 26184d6a6b219ad176a22d106ff67f0f It seems like many of the cpu speed/governor switcher utilities in /usr/portage/sys-power don't work due to being too old. I cobbled together a simple bash script (YES!) that sort of emulates the eselect interface, and allows me to switch between userspace/powersave/performance/ondemend/conservative governors. Root permission is required, of course, to write to the /sys pseudo filesystem. I want to add some basic error-checking and documentation in the comments before releasing it in the wild. The only thing I can't get working is setting specific speeds. I do set the governor to "userspace" first. I can't think of any other problem. Given that I can switch between performance and powersave and ondemand/conservative, I'm not too worried about this, but I'd like to know for completeness. Another item I'm missing is wildcarding directories in bash. The selected values are applied to the CPUs in a loop that goes like so... for core in /sys/devices/system/cpu/cpu[0-9]/ do echo "${governor[${choiceminus}]}" > ${core}cpufreq/scaling_governor echo -n "CPU ${core:27:1} set to " cat ${core}cpufreq/scaling_governor done That works fine for notebooks with say 8 cores. But what happens when you hit 16 cores? I can't come up with one bash wildcard expression that handles "/sys/devices/system/cpu/cpu[0-9]/" and "/sys/devices/system/cpu/cpu[0-9][0-9]/" simultaneously. There's probably an elegant solution right under my nose, but my Google-fu is failing me right now. In a worst-case-scenario, I could have one loop for "/sys/devices/system/cpu/cpu[0-9]/". Then test for the existance of "/sys/devices/system/cpu/cpu10]/". If it exists, run a separate loop for "/sys/devices/system/cpu/cpu[0-9][0-9]/". Ugly, but it would work. -- Walter Dnes I don't run "desktop environments"; I run useful applications