From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964860Ab2JXAlc (ORCPT ); Tue, 23 Oct 2012 20:41:32 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55045 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933591Ab2JXAla (ORCPT ); Tue, 23 Oct 2012 20:41:30 -0400 From: Thomas Renninger To: Pawel Moll Cc: Amit Daniel Kachhap , Zhang Rui , Viresh Kumar , Daniel Lezcano , Jean Delvare , Guenter Roeck , Steven Rostedt , Frederic Weisbecker , Ingo Molnar , Jesper Juhl , Jean Pihet , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, lm-sensors@lm-sensors.org, linaro-dev@lists.linaro.org Subject: Re: [RFC] Energy/power monitoring within the kernel Date: Wed, 24 Oct 2012 02:40:49 +0200 Message-ID: <4317776.evLpJapyim@hammer82.arch.suse.de> User-Agent: KMail/4.8.5 (Linux/3.4.11-2.16-desktop; KDE/4.8.5; x86_64; ; ) In-Reply-To: <1351013449.9070.5.camel@hornet> References: <1351013449.9070.5.camel@hornet> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tuesday, October 23, 2012 06:30:49 PM Pawel Moll wrote: > Greetings All, > > More and more of people are getting interested in the subject of power > (energy) consumption monitoring. We have some external tools like > "battery simulators", energy probes etc., but some targets can measure > their power usage on their own. > > Traditionally such data should be exposed to the user via hwmon sysfs > interface, and that's exactly what I did for "my" platform - I have > a /sys/class/hwmon/hwmon*/device/energy*_input and this was good > enough to draw pretty graphs in userspace. Everyone was happy... > > Now I am getting new requests to do more with this data. In particular > I'm asked how to add such information to ftrace/perf output. Why? What is the gain? Perf events can be triggered at any point in the kernel. A cpufreq event is triggered when the frequency gets changed. CPU idle events are triggered when the kernel requests to enter an idle state or exits one. When would you trigger a thermal or a power event? There is the possibility of (critical) thermal limits. But if I understand this correctly you want this for debugging and I guess you have everything interesting one can do with temperature values: - read the temperature - draw some nice graphs from the results Hm, I guess I know what you want to do: In your temperature/energy graph, you want to have some dots when relevant HW states (frequency, sleep states, DDR power,...) changed. Then you are able to see the effects over a timeline. So you have to bring the existing frequency/idle perf events together with temperature readings Cleanest solution could be to enhance the exisiting userspace apps (pytimechart/perf timechart) and let them add another line (temperature/energy), but the data would not come from perf, but from sysfs/hwmon. Not sure whether this works out with the timechart tools. Anyway, this sounds like a userspace only problem. Thomas