 All right. Here we go. My name is Alexandra Yates. I work for the open source technology center at Intel Corporation. I've been with Intel for about six years. And in my time off I do triathlons. And for work I do power management on the Linux kernel. Oh, and I forgot to introduce my talk. So we're going to talk about cases study and basically the way that this came about is I thought, well, how is the Linux kernel doing in terms of power management? And in relationship of the different distributions that are out there. So I took first Ubuntu. They are working with Debian. And the idea is that I go from distribution to distribution doing a similar thing that you're going to see today. So before we begin, I would like to see how many people here use any sort of power management tool to tune your computer. Very good. Very nice. How many of you use power top? Great. Awesome. Good. I went to a talk the other day and there were like three people. So this is good. Right. So the experiment. Of course I use Debian 314. Debian has its own kernel. So in this case I use 314.13.2, which it came with the distribution for Jesse. It's the code name that you give it. And then I took the upstream kernel and then slapped it on the system. And this is the latest 316.1. I also made the same experiments as I mentioned earlier with Ubuntu 3.10, which they come with their own distribution. But I'm not going to come here and tell you all the things about Ubuntu. I'm just going to talk to you about Ubuntu 316.1 in this talk. And then of course everything else on Debian in those two kernels that you see up there. For the experiments I use a really cool machine. This is a Sony Bio Pro 3. It is 13 inches wide. And the best part about this computer is it's super light. And its battery power lasts about six hours and 30 minutes, they claim. But I've made it last a little longer. So if you like to take a look and pass it around. I love it. I really, really like that computer. It has touch screen. It has really nice mouse track buttons. And it seems pretty responsive. And in terms of power, it seems to do very well. It has a Haswell ULT Core i5 4200U. And it has a 128GB SSD drive. Pretty cool computer if you're looking for a system to purchase. And also this one is the computer of choice of Linnester balls. So yet another reason why I wanted to see how did it do in terms of power. Additionally to that I use Yokogawa WT-310. This is a power meter. And I also use a photometer to gauge the brightness of the screen. I use power top. And all my tests are 10 minutes intervals. I'm measuring wall power, suspend power management, idle power. And of course I have to make sure that my battery is fully charged. I did the mistake that at the beginning I was taking this test and the battery wasn't charged. And my numbers were going to the 20 watts range. And of course I was freaking out. So about the results. Well, no animals were harmed in this experiment. I have to give kudos to Debian because they did a really good job. It seems that they are pretty proactive at keeping power top updated every time there is a release. I have noticed with the other distributions I have installed they usually have a very old version of power top. So kudos to them for that. So we're going to talk about in the graphs that I'm going to show you, we're going to have on the x-axis watts. And then we are going to have times. And of course it's 10 minutes I've mentioned before. And so before we go into depth into what this graph means, I took two tests, very simple tests. One is a screen on idle. And the other one is a screen off idle. And the reason why I took those tests to begin with is because if you think about it, probably 80% or 60% of the time your computer is idle, doing sitting there doing nothing. And most of the times you are like on your desk talking on the phone or something and the computer is going to go to sleep and you even go and touch the touch screen so that it doesn't actually go to sleep. And I sometimes do that. So that's what I thought this is the most part where the computer lays. Right. So here in this graph, I took about out of the box, Debian on that computer I'm showing you. I just installed just a distribution and the app and the lower blue line is the screen off idle. And so what I did in here is I only changed the brightness of the computer. So if you look into all these computers that come out of the shop of the store, they come with a very bright screen and they do it so that it looks very from the screen and all that is great and nice. But it turns out that when you are working, you actually don't need all that brightness and you actually don't know that good for your eyes either. So the people from the panel, the panel guru, they say that it's actually good to have your screen in 200 nits. And 200 nits is just like an urban, I'm sorry, 200 lumens. And this is number where you can see the screen and you can work and it looks bright and it's very, very nice and comfortable for you to just do your work. So that's it with the photometer. I went and looked what was the 200 lumens there. And it turns out that in order to change my lumens, I need to go and change my nits on my system. And I do that by changing sys class, backlight. And sometimes if like in instance in this computer we have Intel GPU, so we have Intel back and brightness. But there are some don't use that. And so then you are going to have a CPI taking that for you or the driver that comes with. And then of course brightness. And so in here, I put it into 36. But the one thing that I want you to take away from here is that don't go to your computer to slap in 36 in there because it's not going to work. Big chances is that just look what is the current number that you have. And usually I just half it, put it in half and then add that number. If it is bright or if it is too dark, well then just adjust it as you feel it works for you. But the thing in here is the idea to take away out of this slide is by only doing this, I am saving about 50, 54 minutes of power by only keeping my screen a little darker on the six hours that I have of battery. So that's a pretty good savings if you think about in the long run. So in case the previous slide didn't show your imagination on how much power your panel takes, I put together this slide. And this is basically a pie chart that is showing me in the system how much my panel consumes. And as you can see here is 81%. The second citizen that uses more power is the CPU. And one can argue that one can tune the CPU to make it use less power. But effective our panels are the big consumers. So just keep that present when you use your systems and you tune them for power. So the next step I did is I took the system and I installed Linux kernel 3.16.1. And again I did the two tests, screen on and screen off, both idle, screen on idle and screen off idle for 10 minutes. And in here I found that my screen on idle and, well wait, and then after that I run power top. And then after running power top I figured out that I saved with the screen on idle one hour and 45 minutes. And then I also saved three hours on the screen off idle. So that is a lot of battery time. And if you are like in an airplane, many of you did that to come here to this conference or traveling or in your house or somebody's friend's house without your battery charger, three hours is going to give you a lot of time to work, right? So keep that in mind. And this is also with the change of the backlight. So in here I'm kind of stepping stones on the changes that I'm adding. I'm not only running power top but I added my Linux kernel. I changed my backlight to make it less bright. And then also run power top. So that was pretty neat that I saved one hour and 45 minutes. And then the screen off idle three hours, that's about 48% of difference here in power consumption. That's very good. Now the next slide. I am comparing my out of the box versus the kernel. So the previous slide was that computer with kernel 316 but just by running power top. This one is the kernel that Debian had versus 316 kernel and doing exactly the same things. So in here I know I found out that my screen on I'm saving two hours and 24 minutes. And in screen off idle I save the same amount of time. And that's actually expected. But it is expected because the new releases of the kernel should have more patches. And since Haswell is still only a new platform, there are patches that keep on going upstream for that. So that was nice. So a lot of you use power top and in the different forums I found and even in the mailing list I hear people that they don't know what these numbers mean and how to use it and how to analyze this data. So we're going to go a little bit about that data that you see on power top. And also I'm going to tell you how this computer did with the out of the box kernel and with the screen off. So in this screen we have process idle state report. And basically here it's showing me what is my processor doing when it's supposed to be doing nothing. The processor is partitioned in different models if you will. And it has, this particular processor has four CPUs. There are grouped CPUs are grouped by two in this processor and they are grouped in cores and of course there are two cores and then they are all grouped in a package. And in the CPUs in the core they share memory and interconnects and things and then in the package they share the buses and you probably don't know all these things better than I. Anyway, so here the main idea that I want to show you is that in the screen off idle when it's not tuned my CPUs are reaching 98% on the deep C state. And if you're familiar with power management features of Haskell ULT they added different C states and a C state is basically a place, I call it a place that the software goes and turns off certain things of the system. So for instance C0 is when the system is all fully up. All the power is going through all the systems. C3 to C6, the system is turning off certain buses and the C6 is turning off the memory caches in certain parts of the memory and then it keeps on going down until the memory is totally flushed and turned off all the way to C10 and also the buses and the lines and it just goes down turning off turning off to minimize the amount of power that they use all the way to C10. So the other thing I noticed here is that in my cores I'm reaching C7 residency and that is good. And on my GPU I'm also reaching RC6 residency which is good but if you notice on my package level all my numbers are on C2 residency and that is a problem because that means that the package is just not turning completely down to the idle state that is supposed to go. And if I go and look into the tune after I run power top and did all these things that turn down the screen color and all the things that I just explained I'm still in the same position where I only have my package level 99.1% in C2 residency and the rest of my C my deep C states are not I don't have any percentage. So that's a problem and so I went and asked people around and why would that be and it turns out that the graphics driver usually in these cases the bigger issues lay either on the graphics driver or on the sound drivers and the third resident is the networking. So those usually those three groups are the ones that have the most problems in terms of power management. So I went and asked and it turns out that the Intel driver has panels of refresh setting flag that I can set when I start my kernel and I had to do I had to set that and you also there were a couple of other flags that I'm pointing right here the PCI ESPN force and in this once I set that I should go when I do my screen off I was able to go and do C7 residency which is good before it was done and then when I went and oh well when I went and tuned my machine I should have gotten C10 residency and I didn't update this part but the thing the the point in here is that I didn't get my C10 residency as I was supposed to get it so focus on the left hand side and it should C10 or some sort of residency in there after this soon after you run power top after you turn down your your things and you have this flag set on your kernel to start up your your system um so that that that's a problem because this was uh with kernel 316.0 and so again I went back and asked the people what's going on here we are having a regression sure enough we did have a regression and um the patch was already uploaded into our internal thing up to vf stream in the next version of 3.0 that 16.0 and there is also another regression that I'm working on and just the debugging at the moment um that it has to do with panel cell refresh and it turns out that with the panel cell refresh I notice in this computer I get a lot of flickering screen with kernel 316.0 and it's awful because you can definitely it's just not usable the computer unless you are on like a lower screen level um so they are working out those patches and now I when I did this test we've seen previews uh kernels and also buntu I didn't run in many issues I actually was able to reach my C10 residency by doing these things that I'm explaining here so that's something to take and those are some easy steps that one can do and they just don't take much time so another thing that if it's not the kernel and if you are not sure what's going on then it might be that just the software that you have loaded on your computer is just not behaving properly um a place to go and look into that is power top of course and um you can look into the amount of wake caps that the system has um power top gives you a really nice list of of the software processes that are taking the most amount of of wake ups and if you take a look in here of course the Intel graphics driver is listed in there so that that would be a way to point out if you are debugging this kind of problems but if you are also debugging your driver you can commentize your driver with this and it should tell you if you're being delinquent on the wake ups per second this is a nice art and it's meant to be like that uh another setting that power top has is the ability to tell you what are the device drivers and the devices that are not tuned correctly for power management and so if you go to the last tab of power tab it's called tunables and in what power top shows you here in the html form is um it gives you the script that you should run on your computer so that you can tune that device for power in terms of power management and so once you go and test that every one of them work you could only use run power top auto tune every time you start your computer power top doesn't um keep a memory every time you restart your computer of these things because this is we don't consider this is our job uh power top as a tool it's a tool more to help you identify and get better usage of your computer but we feel that will be more work of the distribution actually than than us i feel distributions will be more should be more um hands on on getting these systems um to tune their software on this on the system so at least on the more um the more common systems that are out there so if you have your Linux system and you are tired of auto tuning or tuning it every time just go ahead and put this into your startup script and that should do it for you after you test every one of them because at times that might break your system so be be aware of that yeah because so and it's not because power top but it's because there are these devices out there that don't have really good drivers and when you go and tune it in terms of power it turns out that the device doesn't behave well so it ends up breaking your system so be careful well now i did um i did um study on what other devices how the devices that i plug into this computer behave like the mouse sd drive um uh the usb card i also took one of those memory cards and slap it in there and left it you know that's the scenario that we usually have as users we just go upload our pictures and then we forget about our card that is still in there then we just take it everywhere with us until it's the next time to go take pictures and we take it out again so in terms of power management how those things affect our system and i think the mouse one is the most common and it's i found it pretty cool oh sorry but first we're gonna talk about the background color so of course the screen is very important and as we already saw before it takes a lot of um of power right so in this in this specific experiment i tested i was curious about how is the out of stock deviant gradient um screen which is pictured above in the screen how does it behave with respect with a solid color and i was thinking well maybe or i could test all the all different colors right if i'm very ambitious but there is only limited time i have so i pick white and black backgrounds to test and um i wanted to do also rgb but again my time was oh of an essence so in here um i have my out of the box deviant and i compare that against um my deviant when it was tuned and that would be the two blue the light blue the light blue line is for the out of the box deviant and the dark blue line is for the deviant after this tune and you can see the big difference in terms of how many watts you're saving here you're saving about four four watts only by you stunning your computer um and that was about yeah four minutes it saves you there is something wrong here anyways then i went and compare my out of the box deviant with my black background and it saves you about uh four four hours and 30 minutes of battery if you have a single black or white background i actually uh went and test both and they both approximate to four four and a half hours of battery savings if you just go into into from a gradient color to a black uh one color background and the reason for this is because the um there is some of this is uh because the frame buffer compression and of course the GPU needs to work a little hard to get these colors and and these colors of the the gradient process and if you have only one color well then it's much easier for the GPU the memory and all these things to get only the one color presented throughout the whole screen um so that was actually pretty interesting that by changing my background uh brightness and also my background color to a solid color i'm saving four hours and 30 minutes that's that i think that's a big win um so the thing was the mouse so i put in my mouse and i think the mouse is the most common case because a lot of people use this in their computers those little pluggable mouses i use a regular mouse that just has a hotel and your plug forever but it's very similar a case and um basically i have my screen on and my screen off idle and my screen on is like a reference of how it behave and then i have my mouse out of the box which is the blue line which is very similar to my screen on it is good and compatible so that means that your mouse is not really eating your battery there are some mice out there that are criminals on this so be be aware of that and then and then i did my mouse on the 316 and you notice it's still it's still good but then i did tune the system by having the mouse connected and the difference was so great it is about two hours and 25 minutes of battery savings by having my mouse tuned so if i can have my mouse the convenience of using my mouse especially now with this tracking thing is i forgot the name of it the panels the track panels that are so complicated to use especially if you are not used to it and you have the convenience of having your mouse you will have two more hours only if you just tune your system that is big savings uh and very nice and convenient so highly recommend to tune your system when you use any time now we're going to talk about other distributions and again i only have ubuntu and devian at the moment to compare i will have all the distributions through the time this has been about six months of work on on doing these presentations and the more i do i know that i learned that i have to of course go to the next new kernel and retake all my data in both distributions and then also just update things and change and it's been fun but it's a lot of time anyways in here we it was actually very nice and comparable i was pleasantly surprised but the one thing i thought was actually weird is that ubuntu behaved a little bit better than devian within the screen on idle and this i use the one thing i did in this in this test to make it more like a common base i use kernel 316 and i also use power top i make sure that my system was fully tuned in order to make this happen and the reason why i did this is because usually with the distributions that come the kernels that come within the distributions they have certain changes that are specific for that distribution and they just have so many tweaks and things and so i think it would be more fair to compare apples to apples here so for the screen on idle if you use ubuntu you will have 19 more minutes of battery life and with the screen of idle you have 11 more minutes it's small but i feel there is room for improvement in there in the devian world and then chances are that in the next kernel release things change i'm not sure what would be the variables here but in order to identify what makes this difference i feel one will have to go in a deep understanding on what what are the different components of the system and how they are behaving in terms of power of course okay so as you know there is a lot of room for improvement here um again kudos to devian to have powered up to have the latest version of it installed but i still feel that the distributions can do a more aggressive approach to do better power management on the systems that are out there ubuntu for instance they are trying to be good class citizens and they have a place where they say these are the platforms that we badge for and they even have a website and they have a list in there of the systems it's very cool but i feel they could do a little more and and we all could do a little more right and what i mean by that is um like for instance i show you there were some changes on the graphics driver intel graphics driver and that if you use those flags your system will behave better and will have a better um it will have more mileage your battery will have more mileage right the question in here is how do you know that you have to actually set those flags right well that is something that we are working at intel and trying to get that data out there for the community to learn but i feel that we could work in a better partnership with our distribution partners and and solidify those that methodology where this data gets to their hands that's one place that i see that we can influence and get better at and i feel this forum is a great opportunity to open that discussion the second thing i feel that we could do better is um the distributions probably could have a database when they install the system where they know what are the best known configurations and match that to that configuration and that do that for the user so that the user doesn't have to run power top every time that they start the computer that would be very nice but that would take a lot of work understand on the part of the distributions there is always a happy medium right so the happy medium in my in my scenario here is how about giving the ability to the user of tuning their power when they install the distribution on their computer um having the ability to survey what are the devices probably using even power top or a subsection of power top or you're better the tool that you have that you like and run it while you do your installation so that those configurations are kept and are kept throughout the life of the computer i feel that would be a very um good thing if it happens from from the distributions um and then the other thing is well this is actually a boring one but i'm going to be boring and use uh solid colors for your backgrounds because that's what it is up most of the times on the computer and yes it's boring but it saves you guys save save a lot of power and then um um i think that's all the things i feel that we could do that i can think of at the moment um i want also to invite oh before i go to that i want to invite everybody who is in this room to be part of power top as you are all users or most of you are users it happens that i am also the maintainer of power top hint all the presentation right and um it's um really nice community and is growing and we accept patches from everybody it's an open source project and um it would be really nice if we get more people engaged so i would like to invite you all to go to one that or forward slash power top and get our ripples and start contributing and have ideas and bring them on and then with that i want to thank you and open the questions so just two quick questions uh the first is so how much in aggregate were you able to increase your battery life on um so this is this was a system that lasts six hours and 30 minutes and i put it so it was lasting about four hours at first and then i was lasting the five and then the food six and a half and sometimes a little more sometimes a little less it changes right um if i go back in terms of of time my last slide one of the last slides um tell us the one with the screen this one that's the most amount of time that you can that you will get this is this is i did everything in here i had my one color on the background i tuned my system using power top and i also um added all the flags on my kernel startup and so that did the trick for gaining four hours and 35 minutes all together and the other question was so how does this compare to other operating systems which we that's a good question so actually um windows is doing a really good job at tuning their operating systems to the new platforms they are very aggressive and they work with intel into getting their systems but it turns out that at the open source technology center we only do linux right so um it's been uh the disability has been increasing and there are more teams and more people and more engagement on that sense um there are a lot of platforms of course and there is android and then there are they all do different distributions but the idea is that with these presentations i'm giving i spy more interest in the community so that the different distributions open and help and do more work on terms of power management sure i'm sure i could look this up when i get home but is um power top at intel specific tool or does it work with other processor family that's a very good question so power top works mostly on intel platforms uh i know it has uh ports into some arm arm architecture and also amd uh unfortunately i don't have any of these things and i don't do tests on them we have a validation team which which do but is very narrow their scope in that in that terms but yes they have support and again it's an open source project so if you see that you have a nice processor that you want to have the ability for that be my guest bring it on and we receive your patches and we make it happen yes right here just to provide a bit more detail on the arm stuff it's it's slightly more intel are quite organized about having all those power states and it's nice and consistent across the entire chip family chip families and amd have done the same kind of thing whereas an arm world there's all sorts of power states but they're completely different on every um chip family so it's a lot harder to go what do we even call these states so we haven't got the same consistency which makes it rather harder to kind of provide the same feedback but still there is reasonable support for at least some chip sets i'm not exactly sure what is and isn't and they've they've realized this is a problem and people are at least standardizing some kind of level names um i haven't been keeping up with exactly what's been going on but basically linaro has been doing quite a lot of this for the last four years so you get more or less the same experience thank you i think we are out of time they showed me the red carol ready so if you have more questions i will be at the whole in the next sessions and thank you very much and uh don't forget to tune your systems in terms of power