1 |
On Wed, Aug 23, 2017 at 5:49 PM, Alan McKinnon <alan.mckinnon@×××××.com> wrote: |
2 |
> On 24/08/2017 00:29, R0b0t1 wrote: |
3 |
>> As an example, I am interested in characterizing the power consumption |
4 |
>> of rendering a PDF document. I would hopefully only need to run the |
5 |
>> renderer once. |
6 |
>> |
7 |
>> I can use PowerTOP, but it seems to be limited to rough measurements |
8 |
>> on the order of tenths of a watt. This measurement can be divided |
9 |
>> among the wakeup events in an attempt to calculate software power |
10 |
>> consumption but it seems imperfect if I want to monitor a single |
11 |
>> process that may be competing relatively equally for resources with |
12 |
>> the kernel and other user processes. |
13 |
>> |
14 |
>> PMBus is a spinoff of SMBus which is a spinoff of I2C which is found |
15 |
>> on many motherboards. PMBus is supposed to be the interface which |
16 |
>> controls and reports power supply activity. Besides the main kW power |
17 |
>> supply, there is usually a power supply near your processor that steps |
18 |
>> down 3.3V or 5V to 2.8V, 1.8V, or lower (I've seen as low as 0.8V, but |
19 |
>> not on a desktop). I was not aware these had a visible interface. |
20 |
>> |
21 |
>> Apparently you can talk to these, but my searches can only find code |
22 |
>> which seems highly experimental. The other replies seem to be for |
23 |
>> embedded Linux systems running on FPGAs and perhaps Cortex-A parts. |
24 |
>> |
25 |
>> If I were using a microcontroller I could get uA or nA draw per MHz |
26 |
>> and I know my operating voltage and operating time. However, desktop |
27 |
>> processors are much more complex, and I am not sure if they have been |
28 |
>> entirely characterized. The most advanced tool I can find is PowerTOP |
29 |
>> and it does not seem very accurate. |
30 |
>> |
31 |
>> Does anyone have any suggestions? Should I start reading source code |
32 |
>> or post on the forums? |
33 |
> |
34 |
> Both of these sound good |
35 |
> |
36 |
>> Or perhaps someone has used PowerTOP and found |
37 |
>> it to be reasonably accurate? |
38 |
> |
39 |
> No not this. PowerTOP was designed to find badly-behaving programs like |
40 |
> pidgin that woke up and polled it's queue every 1ms or so. It's not for |
41 |
> what you want at all, not even close. |
42 |
> |
43 |
|
44 |
That's kind of unfortunate. It's the only software I was able to find. |
45 |
There's another program, LatencyTOP, that might use API that is |
46 |
relevant for my purposes (interruptible states are important for power |
47 |
management), but it looks like development on it has stalled. |
48 |
|
49 |
|
50 |
PoisonBL, I think my response to Alec touches on some of your points as well. |
51 |
|
52 |
On Wed, Aug 23, 2017 at 8:39 PM, Alec Ten Harmsel |
53 |
<alec@××××××××××××××.com> wrote: |
54 |
> On Wed, Aug 23, 2017 at 05:29:13PM -0500, R0b0t1 wrote: |
55 |
>> As an example, I am interested in characterizing the power consumption |
56 |
>> of rendering a PDF document. I would hopefully only need to run the |
57 |
>> renderer once. |
58 |
> |
59 |
> I remember in college some interesting work in security-related stuff |
60 |
> that was about characterizing power draw in order to crack passwords. |
61 |
> Potentially that could be useful, as you could record the waveforms |
62 |
> going into your power supply while rendering a PDF, but it sure sounds |
63 |
> complicated. |
64 |
> |
65 |
|
66 |
That is an additional application. It's actually amazing how course |
67 |
the information needed is - it was possible to listen to a switch mode |
68 |
power supply's audible frequencies to recover the (asymmetric?) key |
69 |
being used to encrypt data. |
70 |
|
71 |
>> Apparently you can talk to these, but my searches can only find code |
72 |
>> which seems highly experimental. The other replies seem to be for |
73 |
>> embedded Linux systems running on FPGAs and perhaps Cortex-A parts. |
74 |
> |
75 |
> Even if you could talk to these, taking periodic measurements of |
76 |
> current and voltage, then integrating over time would probably give |
77 |
> results with large errors. |
78 |
> |
79 |
|
80 |
Right. However as above, my situation is a poor one, any information |
81 |
is better than what I am looking at now. There are embedded (ranging |
82 |
up to Cortex-A parts) boards that have very detailed power reporting |
83 |
capabilities, but it adds a noticeable amount to the bill of |
84 |
materials. If I am lucky the drive for lower power consumption in |
85 |
laptops and desktops means these things exists in those products. I am |
86 |
not sure I can access them if they do, power management in Linux still |
87 |
lags behind proprietary OSes, unfortunately. |
88 |
|
89 |
I am hoping they offer data streaming or the ability to set maximum |
90 |
power output. If I can cap the power output I could compare |
91 |
performance between two setpoints, although this suffers from a lot of |
92 |
variability as well. |
93 |
|
94 |
I'm not sure I can get data on or from any regulators that exist |
95 |
inside the processor, or any power management facilities that are on |
96 |
the processor die (a popular setup is to control a buck/boost |
97 |
converter directly from the processor, as in it is integrated directly |
98 |
with the processor's power management facilities; modern processors |
99 |
likely have much more than that). If I could do that, that would give |
100 |
me the best data I might be able to get. |
101 |
|
102 |
>> If I were using a microcontroller I could get uA or nA draw per MHz |
103 |
>> and I know my operating voltage and operating time. However, desktop |
104 |
>> processors are much more complex, and I am not sure if they have been |
105 |
>> entirely characterized. The most advanced tool I can find is PowerTOP |
106 |
>> and it does not seem very accurate. |
107 |
> |
108 |
> Due to modern processors having things like pipelines and all of the |
109 |
> caching and memory pre-fetching going on behind the scenes, it's probably |
110 |
> not easy to measure this with any degree of accuracy. |
111 |
> |
112 |
|
113 |
This are things I am hoping to instrument as well. I think some of the |
114 |
rationale behind PowerTOP is that cstates and other interruptible |
115 |
states are the best way to measure power consumption. Those events |
116 |
likely drive all IO access, and some of those wake ups are due to IO |
117 |
request completion events. E.g. most of what the processor should be |
118 |
doing is sleeping, and it makes sense to only know when it's awake. |
119 |
|
120 |
It's possible I might be able to use the API that PowerTOP uses to get |
121 |
far better power draw estimates, but unfortunately, those would still |
122 |
be estimates. I might also be able to use information from the |
123 |
scheduler. I am not sure how to get estimates for power usage at the |
124 |
lowest level, like microwatt per MHz per core, or more advanced |
125 |
estimates involving memory controllers. |
126 |
|
127 |
> Have fun, |
128 |
> |
129 |
> Alec |
130 |
> |
131 |
|
132 |
I hope it is fun. I may not be smart enough to have fun doing this. |
133 |
|
134 |
R0b0t1. |