turn off or stop different devices in linux - linux

I need to measure different devices power consumption in Linux. So I plan to measure the power consumption difference when the devices are on and off. But I don't know where to start?

Well, turning off devices might not be feasible only if you're sure about that you're not using that device. There are tools which can help you to find which application is consuming more power (https://01.org/powertop/) but, I'm not sure whether there's any tools for devices. powertop can help you to identify which app is consuming much power and can help you find out what to do. Hope it'll help!

Related

Soft real time optimization for Applications under Windows/Linux possible?

I'm trying to figure out how to optimize different OS and Hardware for latency.
In the past few weeks I've been tinkering with different versions of Windows and different Hardware and became pretty disappointed with what room for improvement these things have to offer in that regard.
I wanted to ask here if maybe I'm missing something or am wrong about something.
Let's say we have a system with all the standard components. All of these components send interrupt requests to the cpu when then want to complete an operation. Cpu spends cycles completing this request. All cycles have fixed length.
Basically, most of how the interrupt requests are handled is written within the drivers for your hardware and if it's badly optimized your only option is to try another version of the drivers.
The most you can do to optimize the system is disconnecting devices you don't need or enabling MSI-Mode through the registry if the hardware supports it.
Are there some advantages that you have when choosing a particular OS (w7/w8/w10/linux) that give you some benefits or more control over your system's latency.
Any input would be greatly appreciated.
Regards

How to mininimize power consumption for a blue tooth remote

I am creating a remote that will send out constant signals over blue tooth. I need to have the signals be sent out with the smallest amount of power consumption possible. What would be the way to send out blue tooth signals with the lowest possible power consumption? I am thinking that I will use an arduino to write some c++ that can run barebones (no operating system). Someone recommended to me that I should write the device in arm assembly, but I don't know how I would go about doing that and am unsure if the performance gain will be that great or worth it. What are some other option?
We ended up using this micro controller

How to use Powertop

I am working on power consumption anaysis of different machines we have in our lab ( servers, power pcs). I came to know about powertop for power analysis. till now, I have used it on my laptop only and analyse power when laptop is on battery and connected to power also(plugged). Now I have to move on servers etc. There are some questions in my mind and searched a lot but stilled confused. Please guide me about these questions.
Can powertop be used on PCs and servers ( having backups or not) 2. I experiment it and it worked on servers but watts etc colunm is not appeared that's what I main problem.
How watts etc can be appeared on powertop when running on servers.
4.If I sum all the power usage (watts etc colunm) on my laptop when plugged.
Is that value total power comsumed on my system.
How much accurate powertop is(%).
What is working principle of powertop i.e. from where it get informations about power usage.Is it read some specific registers? If you donot want to give the answer of this question then just inform me a littlebit. I am a student and not belong to a big company.
Regards
PowerTOP is a software utility designed to measure, explain and minimise a computer's electrical power consumption. It was released by Intel in 2007 under the GPLv2 license. It works for Intel, AMD, ARM and UltraSPARC processors.
in order to use it, type powertop in terminal and it will start for more information you can go to its help command

Online tool for low bandwidth simulation?

I'm looking for an online tool that will allow me to enter a URL and a connection speed (56k, DSL, cable modem, etc) in order to test the performance of a web site under various speeds.
Any help much appreciated. I've tried sloppy (does not work for me behind firewall), and "Firefox Throttle" (not compatible with the latest version of Firefox).
I'm testing from a Windows 7 based PC.
Thanks in advance for the help.
If it doesn't need to be an online tool you can use fiddler to simulate modem speed for example. This guide shows how to set up the speed you wish to test for.
there is a more up to date blogpost on the fiddler technique: http://www.campusmvp.net/blog/simulating-a-slow-connection-with-fiddler

How to do power save on a ARM-based Embedded Linux system?

I plan to develop a nice little application that will run on an arm-based embedded Linux platform; however, since that platform will be battery-powered, I'm searching for relevant information on how to handle power save.
It is kind of important to get decent battery time.
I think the Linux kernel implemented some support for this, but I can't find any documentation on this subject.
Any input on how to design my program and the system is welcome.
Any input on how the Linux kernel tries to solves this type of problem is also welcome.
Other questions:
How much does the program in user space need to do?
And do you need to modify the kernel?
What kernel system calls or APIs are good to know about?
Update:
It seems like the folks involved with the "Free Electrons" site have produced some nice presentations on this subject.
http://free-electrons.com/services/power-management/
http://free-electrons.com/docs/power
http://free-electrons.com/docs/optimizations
But maybe someone else has even more information on this subject?
Update:
It seems like Adam Shiemke's idea to go look at the MeeGo project may be the best tip so far.
It may be the best battery powered Embedded Linux project out there at this moment.
And Nokia is usually kind of good at this type of thing.
Update:
One has to be careful about Android since it has a "modified" Linux kernel in the bottom, and some of the things the folks at Google have done do not use baseline/normal Linux kernels. I think that some of their power management ideas could be troublesome to reuse for other projects.
I haven't actually done this, but I have experience with the two apart (Linux and embedded power management). There are two main Linux distributions that come to mind when thinking about power management, Android and MeeGo. MeeGo uses (as far as I can tell) an unmodified 2.6 kernel with some extras hanging on. I wasn't able to find a lot on exactly what their power management strategy is, although I suspect more will be coming out about it in the near future as the product approaches maturity.
There is much more information available on Android, however. They run a fairly heavily modified 2.6 kernel. You can see a good bit on the different strategies implemented in http://elinux.org/Android_Power_Management (as well as kernel drama). Some other links:
https://groups.google.com/group/android-kernel/browse_thread/thread/ee356c298276ad00/472613d15af746ea?lnk=raot&pli=1
http://www.ok-labs.com/blog/entry/context-switching-in-context/
I'm sure that you can find more links of this nature. Since both projects are open source, you can grab the kernel code, and probably get further information from people who actually know what they are talking about in forms and groups.
At the driver level, you need to make sure that your drivers can properly handle suspend and shut devices off that are not in use. Most devices aimed at the mobile market offer very fine-grained support to turn individual components off, and to tweak clock settings (remember, power is proportional to clock^2).
Hope this helps.
You can do quite a bit of power-saving without requiring any special support from the OS, assuming you are writing (or at least have the source code for) your application and drivers.
Your drivers need to be able to disable their associated devices and bring them back up without requiring a restart or introducing system instability. If your devices are connected to a PCI/PCIe bus, research which power states they support (D0 - D3) and what your driver needs to do to transition between these low-power modes. If you are selecting hardware devices to use, look for devices that adhere to the PCI Power Management Specification or have similar functionality (such as a sleep mode and a "wake up" interrupt signal).
When your device boots up, every device that has the ability to detect whether it is connected to anything needs to do so. If any ports or buses detect that they are not being used, power them down or put them to sleep. A port running at full power but sitting unused can waste more power than you might think it would. Depending on your particular hardware and use case, it might also be useful to have a background app that monitors device usage, identifies unused/idle resources, and acts appropriately (like a "screen saver" for your hardware).
Your application software should make sure to detect whether hardware devices are powered up before attempting to use them. If you need to access a device that might be placed in a low-power mode, your application needs to be able to handle a potentially lengthy delay in waiting for the device to wake up and respond. Your applications should also be considerate of a device's need to sleep. If you need to send a series of commands to a hardware device, try to buffer them up and send them out all at once instead of spacing them out and requiring multiple wakeup->send->sleep cycles.
Don't be afraid to under-clock your system components slightly. Besides saving power, this can help them run cooler (which requires less power for cooling). I have seen some designs that use a CPU that is more powerful than necessary by a decent margin, which is then under-clocked by as much as 40% (bringing the performance down to the original level but at a fraction of the power cost). Also, don't be afraid to spend power to save power. That is, don't be afraid to use CPU time monitoring hardware devices for opportunities to disable/hibernate them (even if it will cause your CPU to use a bit more power). Most of the time, this tradeoff results in a net power savings.
One of the most important things to think of as a power aware application developer is to avoid unnecessary timers. If possible use interrupt driven solutions instead of polled solutions. If a timer must be used then use as long poll interval as is possible.
For example if something special should be done at a certain room temperature it is unnecessary to check the temperature every 100 ms since temperature in a room changes slowly. A more reasonable polling interval is could be 60 s.
This affects the power consumption in several ways. In Linux the CPUIDLE subsystem takes the CPU (SOC) to as deep power saving state as possible depending on when it predicts the next wakeup to occur. Having a lot of timers in a system will fragment the sleep making it impossible to go to the deeper sleep states for longer periods. A typical deep sleep state for CPUIDLE turns the CPU off but keeps the RAM in self refresh. When a timer triggers the CPU will boot and serve the timer of the application.
It's not actually your topic, but it might come in handy to log your progress: i was looking for testing / measuring my embedded linux system. chris desjardins from this forum recommended me this:
I have successfully used bootchart in the past:
http://elinux.org/Bootchart
Here is a list of other things that may also help:
http://elinux.org/Boot_Time

Resources