Strange Power Consumption


24 posts
by jgriff » Wed Mar 06, 2013 10:57 pm
Not really sure where this is meant to go, so I've gone with off topic as its the safest bet.
Basically, for my final year uni project I'm using the Pi as a LAMP server, and measuring the power consumption in different scenarios. When using Siege, the power went from about 3.4w to 3.5w, however this was with a low number of users, which i cannot increase let alone replicate anymore thanks to apache's harakiri, but thats another issue. After moving on and deciding to use Ettcp, i noticed that the power consumption was dropping during the tests from 3.3 to 3/3.1w, which is something I'm finding difficult to explain. It uses about 40% CPU on the Pi when its running, virtually no RAM usage, and has a throughput of 11491KB/s. I can replicate the results consistently, and as it rises during other tests, such as the Quake 3 demo, I would say it rules out the measuring device as being faulty.
Its a 512MB Pi, with Raspbian, a bunch of stuff removed, and the LAMP stack & samba on it. Turbo mode is enabled, a CMA split is being used, and its all up-to date. Tests are run from a machine running an Ubuntu live disk, and an energy meter is used to measure the power. The HDMI, keyboard and mouse are only connected when Quake is going to be used, otherwise its just the ethernet and SD card. Power is from a nokia AC-10X charger.
./ettcp -t -s 192.168.1.54 -n 10000000 -f M is run from the Ubuntu live disk
./ettcp -r -s -f -M is run from the Pi
The main thing I'm after is a reason as to why it drops instead of rises, because if i cant explain it I'm going to look pretty silly. If anybody needs anymore information or a video showing the drop I can make one. Thanks
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by jgriff » Thu Mar 07, 2013 10:06 am
Just in case anybody thinks I'm crazy...
http://youtu.be/CkAAknEzjk4
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by malakai » Thu Mar 07, 2013 12:51 pm
The main thing I'm after is a reason as to why it drops instead of rises, because if i cant explain it I'm going to look pretty silly. If anybody needs anymore information or a video showing the drop I can make one. Thanks


Why would you look silly just say the power bugs eat it. :D I wish I could answer I really don't know. But is it that it reads an average so lets say it reads 3.03 then 3.05 it will show 3.0 then 3.1 I believe it rounds up and down not sure if that is an absolute truth but that's my understanding of meters also it's accuracy may come into question. You would really need to monitor it at the hardware level to get truly accurate results. A very intensive program like Quake should pull more power as it stresses out the system and reads from the SD Card if you only pulling from memory in the GPU/Memory then ideally it doesn't need power to the SD Card and other items and can release these resources randomly so you run your test. It sees that the activity is just network traffic and it could release the other resources. Then during a timeout it pulls the resources back and releases them again.

Without a complete understanding of what the entire system is doing understanding why the power raises and drops cannot be understood hence monitoring at the hardware level would give better answers. Sorry long answer but took me a bit to get through any logic in what could be happening. Guess we're both figuring things out together :)
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)
User avatar
Posts: 1383
Joined: Sat Sep 15, 2012 10:35 am
by jgriff » Thu Mar 07, 2013 1:37 pm
I might have to "locate" some sources on these powers bugs you speak of, so I can reference them in the report as the source of confusion! ;)
based on what I've seen from using it, I wouldn't say it uses averages, as turning things off and on jumps it up and down, and an average would be smoother.
the tests are run as soon as it's booted and the power stabilized, so whether it's just a magic window where the power does get cutoff to other areas is something I'll have to look at, giving it an hour before testing it etc should be enough time.
I won't be able to test it again until tonight now, but if it does go up after being left for a while instead of down at least it'll make for a good read! :D
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by abishur » Thu Mar 07, 2013 2:23 pm
You said the power was dropping during "the tests" when you swapped to Ettcp, can you describe the nature of the tests?
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4263
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by jgriff » Thu Mar 07, 2013 2:48 pm
as far as I am aware, ettcp is used to measure throughput between 2 devices on the network, and sends a volume of packets from one to the other. the command used on the pi puts it into "receive" mode, and the other machine acts a the server. if the pi isn't in receive mode, the test fails and nothing happens. when running it uses a miniscule amount of ram, and ~40% CPU, so I would assume it just counts up what it receives then does some calculations. all network related lights blink furiously when it runs, so it does give the ethernet Port a good beatting :twisted: !
i'm sending this off my phone, so apologies in advance for what is probably a single wall of text
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by abishur » Thu Mar 07, 2013 8:01 pm
ah, how long after starting the tests does it take for the power to decrease? Does it increase again when the test stops?
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4263
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by jgriff » Thu Mar 07, 2013 8:26 pm
virtually instant, the YouTube link shows me running it briefly, with a torch wedged under my chin because the meter has no backlight :(
it's straight up again then as soon as it's finished, so it's not a spontaneous change
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by jgriff » Fri Mar 08, 2013 11:10 am
After leaving the Pi on for 12 hours, the power change is still the same, so i would say its not simply a magic window or anything like that either.
I've tried out Iperf as well, and the results are the same with a drop during the test. the CPU is about 55% with this test, with the same minimal RAM usage. However, if i do the test the opposite way, with the Pi acting as a client, the power increases! After trying it reversed with Ettcp the result it the same, with the power going up by the same margin it goes down if its the receiver. The pi also uses about half the CPU, according to top, when its the sender, so maybe its an issue with what the pi does when it receives the data? :?
I'll upload a video shortly showing the Iperf test being run both ways, so everyone can see the jump when it changes from receive to send.
If i run the same test in UDP mode, the bandwidth drops from about 96Mbit/s to 1.05Mbit/s, with CPU use minimal and no power change, so i'm not sure if its related at all, but i can record that as well if anybody wants it.
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by RaTTuS » Fri Mar 08, 2013 11:15 am
you dont have the on demand overclocking enabled do you
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX - Prosliver FTW
"That's not right, the badgers have moved the goalposts."
User avatar
Posts: 5003
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
by jgriff » Fri Mar 08, 2013 11:41 am
the only overclocking i have is the turbo mode, but that only kicks in with high CPU load as far as i know, and as the test which increases the power uses about half of the one that decreases it, so i wouldn't be inclined to blame that.
Once i can find a torch to light up the power display i'll make a video, unfortunately my brothers Thomas the Tank torch has let me down in my time of need :cry:
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by jgriff » Fri Mar 08, 2013 12:33 pm
Here's the video showing Iperf both ways
http://youtu.be/GzPtM9Xc77k
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by jgriff » Fri Mar 08, 2013 2:11 pm
If a mod or someone want's to move this to a different section i.e General or Troubleshooting, that would be handy as it might get noticed a bit more :)
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by gsh » Fri Mar 08, 2013 2:27 pm
It could be the GPU clock that is dropping, if the code is not kicking the GPU whilst you are running the test then it may not be being held artificially high,

Will ask Dom...

Otherwise it'd be very interesting to find out _which_ of the supplies is the one changing, the 1.2, 1.8 or 3.3V

If its

1.2 then its the core (ARM + GPU)
1.8 then its the SDRAM + GPIO
3.3 then HDMI + USB + SMSC9512

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 782
Joined: Sat Sep 10, 2011 11:43 am
by jgriff » Fri Mar 08, 2013 2:38 pm
I wouldn't have thought the GPU was being used in the tests, but even if it was the cause, wouldn't the power drop in both circumstances, and not just when receiving data?
My project tutor suggested that when the test runs, it could be blocking some background process that polls other hardware, and so the overall power drops, but with the power going up now when the Pi does the sending, I think it rules that out as the cause
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by jgriff » Sat Mar 09, 2013 5:47 pm
I've run 2 more tests, FTPing both ways, and again the receiving is throwing the power all over the place! :evil:
http://youtu.be/EqCWjFznefw
this video is the pi getting the test file from the other machine ( just a 100MB text file ) and the power is up and down during the test, which i can only assume is something to do with writing the file to the SD card, also lowering the transfer rate
http://www.youtube.com/watch?v=x5yaVC35gAo
the second video is the Ubuntu machine getting the same file back from the Pi, with a more normal power usage, and at a much higher speed.
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by malakai » Sat Mar 09, 2013 6:33 pm
The suspense on this thread is killing me but I'm sticking with Raspberry Cane Borer as the culprit.
Image
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)
User avatar
Posts: 1383
Joined: Sat Sep 15, 2012 10:35 am
by jgriff » Wed Mar 13, 2013 9:58 pm
Tried out the oldest raspbian image i had, 2012-07-15, and the problem was gone!
using that image and rpi-update, the power starts messing around again, and it also idles at 3.3w instead of 3.0w :evil:
this puts the blame squarely on the firmware imho, and as much as i would love to iterate through them and find out where it went wrong, i just don't have the time :(
if someone else wants to try it to verify the problem, that would be handy!
all i did was write the image, update the raspi-config, expand partition, enable turbo mode, and install ettcp
ran the tests with the power going up as it's meant to do, then installed rpi-update, updated, and re-tested
Looks like the power bugs and raspberry cane borer's can be spared this time ;)
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by abishur » Thu Mar 14, 2013 3:07 am
I don't know if that really confirms anything... I mean its possible (probable) that one of the new images with a newer firmware release addressed some issue with the usb (which the ethernet is attached to) causing a more efficient use of power. Changing to the old one might only mean that you're not getting that advantage any more ;-)
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4263
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by jgriff » Thu Mar 14, 2013 11:12 am
I'd have to disagree with you there, as the old image idled at 3.0w, and with just a firmware update it now idles at 3.3w, which is a 10% increase at idle! Not what i would call more efficient ;)
But also that the power only decreases when the Pi receives data (goes down to ~3.0w oddly enough) would make me think it wasn't intentional, because if it was, wouldn't you just have it in that state at idle as well ?
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by abishur » Thu Mar 14, 2013 3:07 pm
Ah, but is it the firmware causing the new image to idle at a higher wattage or is it that there might be an additional service running by default that causes slightly more cpu demand in the newer image? Know what I do about what goes into the firmware, my money would be on the latter ;-)

Not that it matters too much in the end, but my general guess of the situation is:

Old Image, better idling power usage because the newer image has an additional process causing higher cpu demand. Power usage goes up with networking usage

Newer image, better handling of usb transaction, therefore less additional power needed for ethernet, as more resources required for ethernet, other processes that take up cpu when idle are put on the back burners, overall power reduction.

Obviously this is just one (very rough) theory. It's just that there's a lot more to the pi than the firmware and using this to say there's an issue with the firmware when things might be operating exactly as expected is premature :-)
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4263
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by jgriff » Thu Mar 14, 2013 4:41 pm
I think there may be a slight misunderstanding here, that i shall clarify! :)
Using the old stock image, the power idled lower, and increased under use.
When i ran rpi-update, without doing a dist-upgrade etc, the power after the reboot is then the same as it is on my fully updated version. This is why i've blamed the firmware, as it was the only thing that i changed.
So just to summarize, the old image uses less power at idle, but more after a run of rpi-update :!:
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales
by IIVQ » Thu Mar 14, 2013 4:57 pm
I have no idea whether this has anything to do with it, but it *might* be hints at a solution:

- Most USB power supplies nowadays are not transformers, but Switched Mode Power Suplies (SMPS). These basically quickly switch on and off the 230/120V power supply to load or unload a capacitor; result is that the input becomes less sine wavy. This is not a problem normally as SMPS'es only work well at low wattages. But, due to induction load effects of other power consumers (possibly even the pickup coil of the power meter) you might get all kind of weird inductive effects once the SMPS switches on and off.

- Ethernet runs at voltages of ±1V. So inside the Pi, there's another power converter. Ethernet takes (relatively) quite a high wattage, mainly to overcome the (relatively) high resistance of long copper cables. This power converter might lead to power consumtion spikes which "kick back" into the main SMPS (230/120>5V) and produce a different timing of the switching on and off. You could test this by trying processor-easy but ethernet-heavy processes such as a ping flood from another machine.

- I find that "cheap" power meters made to handle larger loads (up to the kW range, such as in your power block) are not so reliable when having to measure loads under 5-10W)

Anyway.. just my two cents.
Posts: 9
Joined: Thu Mar 14, 2013 2:12 pm
by jgriff » Thu Mar 14, 2013 5:42 pm
If you watch the video's I've posted, depending on the test the power either increases as expected, or it drops to below idle levels.
With the older image I've used without any upgrades, the power increases in all circumstances.
After running rpi-update on the older image, the power then changes as it does in the fully upgraded version i use. :twisted:
So even though the measurements might not be the most accurate, its still good enough for what I'm doing.
Thanks for the input :D but I'm not currently blaming the power supply/measuring hardware!
Posts: 15
Joined: Wed Mar 06, 2013 9:48 pm
Location: Swansea, Wales