Hi, Here is the link to the changes I have made to PowerTop to support Turbo mode. Please take a look and give me your comments.
http://jurassic-x4600.sfbay/net/zday/export/vd224797/TurboMode/webrev/index.html Just to give a brief background, APERF/MPERF registers are used to detect turbo mode. APERF increments proportional to actual frequency while MPERF proportional to max non turbo frequency. Sampling these registers one can determine if we entered turbo mode over the last sampling interval. If the ratio APERF/MPERF > 1 we are in turbo mode and the average frequency is (APERF/MPERF) * Max Non-Turbo frequency. Ideally when we are in P0 and turbo mode is disabled the ratio APERF/MPERF should be one. However this is not the case as the two registers cannot be read concurrently. Hence there is always a skew between the two reads. Due to this we need to introduce a "threshold" which determines whether or not the difference between APERF and MPERF is due to the skew or due to turbo mode. So in summary we are trying to display (a) Average Frequency in P0 when turbo mode is enabled (b) The time spent here I have attached two snapshots, -one where the system is in P0, but does not go into turbo mode. You can see, we correctly display 100% in frequency 2400 as opposed to 100% in 2401 in the version of powertop that does not support turbo mode. Here the "threshold" was set to 1000Hz. -As we currently do not have deep C state support which is required to go to turbo mode on Penryn machines, I just set the "threshold" to 0 as a workaround. You can see when APERF > MPERF, the average frequency and the time spent is displayed by powertop. The turbo mode frequency displayed is just a few Hz above 2400, because the difference is from the skew and not intel dynamic acceleration (IDA). With IDA, the difference is expected to be more. Please review the code and let me know on any suggestions/questions you have. Thanks, Vinay -------------- next part -------------- A non-text attachment was scrubbed... Name: Turbo.png Type: image/png Size: 138448 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/tesla-dev/attachments/20080812/6ed58934/attachment.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: nonTurbo.png Type: image/png Size: 116796 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/tesla-dev/attachments/20080812/6ed58934/attachment-0001.png>
