Posts Tagged ‘google’

Debugging the Android Battery

Does android battery suck, or is it usage? In short it does suck compared to other popular alternatives(the i range). However the purpose of this post is not to start a witchhunt or rant but to arm you with tools to debug your battery usage. I will help you track down your battery hog(s) and then suggest some methods to tackle them.

There are 4 main causes of battery hogs:

  1. Cell Phone Usage
  2. Display
  3. CPU usage
  4. Sensors like (GPS, Wifi etc)

Lets start with the easy one:

Cell Phone Usage

Cell tower is the one that provides you connectivity, EDGE and 3G. Unfortunately weak signal can cause this to use exorbitant amount of  battery. If you are experiencing full battery drain in about 2-3 hours then this is most probably the culprit. First thing to do is go Settings -> About Phone -> Battery Use -> Cell Phone standby. Look @ Time spent without signal. Any number other than 0 is very dangerous. There are no practical solutions to this problem. Search for network and fix it. This will prevent phone from searching network when signal is weak. However this may not work when you go on roaming and if you spend most time out of signal this will still consume battery.


The only downside of having a large screen is that it consumes exponential charge. If you using an LCD screen, your phone is only likely to survive 4-5 hrs of screen on time. This is assuming that you are not performing any CPU intensive task during that period like gaming, video etc. It is highly likely that you will consume 4 hrs of usage out of your phone in the entire day hence its unlikely that your phone will survive more than a day. The only aspect to debug here is if some freaky software or buggy ROM is keeping your screen up. Gingerbread provides you clean interface to check your screen on period. You can use Juice Plotter on non gingerbread phones but it has been known to consume a lot of battery itself. Make sure you only use to to debug your screen and not on a regular basis.

Have a look at your Screen ON time and make sure you are getting around 4 hrs of usage. Any thing less than that means that you have issues with your battery. Look through the CPU Usage and Sensor usage area  debug those issues.


  1. Choose an AMOLED screen phone: AMOLED screens consume very little battery in comparison to LCD Screens.
  2. If you have an AMOLED screen then choose darker themes while browsing/surfing/wallpapers. A light color pixel consumes about 5.8 times more energy than dark pixel. This method will not work for LCD phones. You can see the impact of changed wall paper using Current Widget. This will tell you how much charge your phone is consuming(wait for couple of min for it to refresh when you change the wall paper).
  3. Choose  lower screen brightness in general. Rely on Power control widgets to increase screen brightness when required.
  4. Reduce display timeout to 30sec-1min. Adjust that to a time that is comfortable to you.

CPU usage

Today’s CPU are beast. This means not only they are fast and powerful they consumAndroid allows apps to ask for CPU while not using the screen. e millions of amperes of precious juice(okay maybe not millions). CPU usage is a bit tricky to debug in pre-Gingerbread phones. You are mostly led to superstitious advices to control power usage. You can see as much as 10-20% battery usage overnight when you were not using the screen, this is because  Android allows apps to ask for CPU while not using the screen and poorly designed apps continue to update even when they have not been used in a while draining CPU. Enough rant now to function, to debug CPU:
  1. Launch Spare Parts. Fortunately this is bundled in Gingerbread phones, for Froyo you can try out this market app and hope it will work.
  2. Look at Battery history inside Spare Parts. Select “Other Usage” in first drop down.
  3. Check out Running time vs Screen On time.
If these two numbers are widely different then you have a problem on your hands. This means that some app is keeping CPU awake even when your screen is off. To find out which app
  1. Launch Spare Parts
  2. Look at battery history and select “Partial Wake Usage”
  3. Now you will see which app is the culprit and eating up CPU.
Now comes the hard part . You can reduce your running time by disabling this app. If the app manufacturer is good, he would have provided you means to reduce its battery usage(Disabling sync, changing sync from push to hourly, reducing data refresh etc). If not then you should uninstall the app and use something else for that purpose. Keep repeating this exercise till your running time is almost equal to your screen on time.  You will see radical improvements in your standby time with this exercise which in turn can reduce your charge cycles to as much as 2 days.
Other than choosing good apps which use CPU wisely some suggestions:
  1. Use less push sync in general. True push is only available with Blackberry everybody else is doing a very frequent pull to emulate push, so make sure you don’t use push where its not required.
  2. In my opinion disable auto sync all together and do a manual sync when needed. You can put the auto sync button in your power widget and flick it on and off whenever needed
  3. Use Juice Defender it will give you good usage patterns(disabling sync at night etc).
Solution for Advanced Users: if you need all the apps that sync but still want to reduce your battery usage you can try Set CPU to underclock your CPU. You can also use the inbuilt underclocking baked into the CM7 ROM. This solution will only work if you have rooted your phone and your kernel supports underclocking. Default android kernel comes with OnDemand CPU clocking. CPU almost instantly scales to max frequency(like 1Ghz) from its min frequency(like 245Mhz) when required. You will need this kind of speed for gaming/browsing etc however its not required for sync and other background tasks. Set CPU lets you configure so that
  1. Your CPU scales slowly(Conservating  scaling/Power intensive), especially when you have very little battery left
  2. Reduce highest CPU frequency to something like 700 Mhz especially during the night or when the screen is off
Keep in mind however that these solutions can impact your phones performance while rendering pages, gaming etc, so do not reduce cpu frequency or scaling when your screen is on to prevent frustrating experiences.

Sensor usage

If you have reached here then the problem is quite simple shut off all your sensors :). Well Android provides various ways of debugging sensor usage, have a look at your Spare parts => Battery History => Sensor Usage/GPS Usage. If you see a lot of devices are using GPS Sensor you are likely to see a lot of battery loss. Its unfair that android does not let us control which device has access to my location and which does not, I hope they will add that in future versions of android. Meanwhile if you see useless apps tryto access location(mostly to serve relevant ads etc) then you can adopt the following solutions:
  1. Disable both ways to determine your location in Settings => Location and Security. If you really need location then go for “use wireless location” instead of GPS for location. Use GPS only in critical situations where precise location is very necessary
  2.  Change Wifi sleep policy (in Settings => Wireless and Networks => Wifi Settings => Menu key => Advanced => Wifi Sleep policy => When screen is off) This will switch off your wifi and turn on  mobile network when you are not using the screen. This way your background apps can use your slow mobile network to sync while saving wifi juice.
  3. Turn on “Only 2G network” in (Settings => Wireless and Networks =>  Mobile Networks) . This will switch off your 3G network and use only 2G which uses much less battery and is much slower. You can also use 2G/3G switcher in power widget to control this if you rely on 3G for browsing.
Got any other suggestions?? Let me know in comments…

Page Faults and Context Switches: Chrome, Flash and Techcrunch are killing my system

Update: Beta News reported a similar performance drop when running chrome on Windows 7 RC

I am a power user. When I surf, I have around 20-25 tabs open. I have many processes running simultaneously on my windows 7 RC.TaskManager When I code, I have a test Ubuntu installation running on VMware.  To do all these, I spent most of my earnings on a 17″, Core2duo 2.4Ghz, 4GB ram, NVidia 8600M GT Dell Inspiron Laptop 1720. I have been using Google Chrome since the day it was made available and i keep up with the latest builds of the same. I also love the fact that it was zipper than my earlier favorite(Firefox) in opening new tabs. But, the whole time Google Chrome has been stressing my laptop’s hardware.

To prove my point, take look at the screenshots from Process Explorer, a Task Manager replacement for Windows. The Laptop was restarted and the screenshots were taken after around 4-5 hours of casual browsing with around 25 tabs open. I also had a Hadoop installation running on a VMware Player. Simultaneously, I was also dabbling  around with some code in eclipse .

The following were my observations

  • The Browser Process of Chrome is doing over 10 Million Page Faults. The closest that comes to this process is the Microsoft AntiMalware service(Morro engine) at 2 Million. As you can see in screenshot 1(below), the whole top list is dominated by Chome processes.
  • The Flash process has over 70 Million Context Switches(see screenshot 2(below) which was taken 20 odd minutes after screenshot 1), @5000 Context Switches/sec which is quite appalling.  The nearest competitors are Interrupts, Chrome again, Google Talk (Another Windows Application from Google)
  • Lastly,, Mike Arrington’s “Bloat-ware” Blog , one tab of which is taking around 500MB of RAM taking the total RAM occupied by all  Chrome  processes at 1.05Gb (Note: Firefox was really good at this. I seldom get past 400-500 MB on that many number of tabs). Also funny thing is that,  if you compare Techcrunch to Gmail, the latter  just takes 64MB of ram(see Chrome’s Process Manager screenshot above)

Let me teach my readers a quick Computer Science 101. The following explanations are over simplified, so if you are not satisfied with the explanation, go read Wikipedia for a detailed discussion over the same.

Page Fault: When a processor tries to fetch some block of data from the memory, if doesn’t find the data in the memory it tries to get that data from the hard disk. Operating system manages the blocks of memory and moves some of them to the HDD based on Most Recently used criterion. Since you know the over head of a disk access is way larger than a memory access, too many page faults translate to more spinning of the hard disk. Read Wikipedia for a detailed description

Context Switch: In a multiprocess environment like windows. The cost of switching from one process to another process is quite high. If an application keeps switching very fast, that means it’s not getting enough cpu time to do its work, and it is wreaking havoc on the other applications by decreasing their effective cpu time also. Read Wikipedia for a detailed description

Few things come out of this little insight

  • Flash NPAPI plugin is a useless piece of crap. Even after 10 major versions, they still have an ill designed system. (Some people have told me this was specific to chrome as according to them Flash runs fine on Firefox)
  • Chrome even though is very fast in terms of HTML rendering and JavaScript execution. But, it kills the system by the large number of PageFaults and Context Switches it does.
  • Techcrunch seems to be doing more job than a complex web-application like Gmail. Or is it because the 20 odd flash ads they have on their Blog. They could be even doing mouse pointer/user tracking or even Javascript  code Instrumentation. Who knows!(Just Kidding). What ever it is, they need to find and fix the root cause of the problem.

If my readers believe they are also suffering from the same fate as I am, I would request them to put their stats up in the comments section.

I am using Chrome with Flash 10.0 on a Win7 RC ( Yeah I know that it’s a unstable combination. But, even when I was using Chrome 2.0 on Vista SP1 with Flash 9, I had the same problem)

Process ExplorerProcess Explorer2

Google is the next Microsoft

“Google is more like us than anything that we have ever competed before.”

This famous quote about Google is by none other than Bill Gates himself. Microsoft is one of the biggest and fastest growing giant, the world has ever seen. The reach of Microsoft in various fields is inspiring. With a steady product range and effective marketing strategy, Microsoft is poised to become bigger and better by the day. Google is a relative new comer and often underestimated in comparison to Microsoft. True Google has an entirely different revenue model and ideology but that ideology to organize the world’s information is the key to success of Google in the fields where Microsoft has been unable to leave a footprint.

Everybody knows that Web is growing at a rapid rate. Over 5.4 million new sites are put up monthly and the success of Google in monetizing this exponential growth has made Google the fastest growing company in the history of the world. . The growth of internetYoutube will inevitably have far reaching consequences than earlier predicted. It has already started pushing more and more desktop functionality to the internet making all our information available everywhere. Google has anticipated this trend and has started developing applications to mimic the desktop functionality. No spreadsheet in the world will provide you with infinite rows and columns like Google spreadsheet, and no Second Life Logohard disk can provide potentially infinite video storage space like the way YouTube does. The consequences don’t stop there. Ads were well known to the real world till Google came along with state of the art Adsense. Now the traditional video ads that we are so familiar with on television are being replicated in Adsense. Your friend circle has migrated on the web, your college facebook, your mails, your calendar, even you yourself can now have a second life.

There are no two ways about it. Google has not only pioneered the IT revolution it is leading it with an online revenue generation of over 16.59 billion dollars, if that’s not enough then check this out; Google owns about 5% sites in the world that’s 77 million sites worldwide. Only those companies will continue to succeed which are backed by effective research and the best employees. Microsoft is renowned for its efforts in research and work culture. Microsoft has come up with products which have ensured its continued capture on existing market. Google is not far behind with its unique way of promoting research among its employees. I am of course talking about the 20% free time, which is an integral part of Google’s company policy. Using this Google has targeted the researcher in its employees. This free time has lead to numerous products which are in main stream for Google like Orkut, Gmail and even the popular Adsense. This unique work culture also has been the key to attract the best employees around the globe. Not only this, If you are wish to know in depth about any field the best lecture you can find is probably Google tech talks. Google tech talks are available on Google videos on almost all fields (Bio fuel, Second life to begin with). People who talk are from variety of backgrounds and are generally the forerunners in their field.

Those who claim that Google is not the next Microsoft have perhaps not observed the striking similarity between the acquisitions undertaken by Google in the recent years and that of Microsoft in the early 90s. Microsoft undertook major acquisitions in process of its growth targeting a vast array of companies. The companies’ skill set ranged from Business Intelligence to server virtualization.

EngyroAquantiSoft Artison

Microsoft’s aggressive takeovers were the backbone of its strong and innovative lineup of software. Google also is actively acquiring companies with a wide agenda in mind. It has acquired companies like Double click to improve its existing ad services and it has also acquired companies like Android to expand into mobile devices thereby diversifying its target market.

Anybody who has observed the growth of Microsoft knows that acquisitions were not the only way Microsoft grew. It undertook major alliances with companies such as Dell, IBM. A prime alliance methodology was the OEM alliance, this alliance helped Microsoft to capture the desktop market. Google has also learned from this and started alliances with a wide array of companies. For example the alliance with Airtel in India, Apple iPhone in US and the major alliance with Firefox which ships Google as a default search in over 150 million browsers worldwide. This shows that it has the business acumen to compete with Microsoft and even outsmart it.

A major speculation made on Google is that its state in the market is fragile, owing to the one-dimensional success that it has established till now. However I would like to point out that Google is not as fragile as they think. There are several reasons for it.

  1. Google shows interest in competing startups and acquire them if they show promising talent, for example YouTube.
  2. Google has always stimulated diversification by keeping its employees in small groups imitating the research groups kept in the best universities in the world.
  3. A typical misconception about Google is that it leads the market solely because of its powerful search. Very few people know about its Map Reduce. What is this Map Reduce? Imagine the power to organize millions of bytes of information in a matter of seconds. The power that enables Google to process over 20 Peta bytes of information daily. This magic sauce allows Google to quickly test out its innovative ideas in matter of days faster than anybody else in the world. Taking this amazing algorithm in account, who’s to say that Google won’t venture into as many dimensions as Microsoft if not more?

Reaching the heights to which Microsoft has reached is an ambitious target. There are very few companies in the world that can achieve what Microsoft has done in the software market. There is always the chance that Google may also fail to do so, but I think that it does have the right mix of ingredients to become a Microsoft or even topple it.

PS: I could talk about how Microsoft and Google both are being sued for antitrust or how both have shown monopolist tendencies, but I believe that this point of view would not weaken my cause but would also not be credible. Just because Google has made the same mistake as Microsoft in a juncture of its corporate lifetime does not prove or disprove that Google will become the next Microsoft.

Threats to privacy in 2007

Well there are no 2 ways about it, the world is entering the age of data and even if you want to protect data, you inevitably have to provide it to sites/insurance salesman/girlfriend/devil. While the latter 3 are not so harmful the first one can be quite a death threat. So how to ensure that your account has not been hacked and your life stolen from under your feet:

  • GMAIL hacked:

    Open your Gmail account settings and check your filters. If you find a weird filter which was not made by you , then your account was HACKED.

    This was a nifty little trick to hack the gmail javascript and add a filter that sends mails as designated by the hacker to a particular account. The emails are also deleted hence you cannot retrieve them. Moreinfo here. (Google has fixed the vulnerability but if your account was hacked you will still have to manually correct it). Curse google for not being a little more vocal about it and tell its users.

  • Google reader hacked:

    Go to your google reader and unshare all items

    Okay Okay the reader is not hacked but Google has started its new share feature that not only allows you to force your shared items on your friends “All items” list, but also to all the folks that you have ever contacted(mailed, send gtalk request to). So if are privy about your shared items in any other mode (besides all and none) you cannot do so with current Google reader settings. There are workarounds( but I am more of a better safe then sorry kind of guy 😀

  • Taking over of double click:


    Google’s attempt to buy out display ad service DoubleClick has received the approval of the US Federal Trade Commission (FTC), although it still faces European antitrust scrutiny(I trust in Europe).
    The £1.56 billion deal has been heavily-criticized for potentially reducing the options open to web marketers and endanger web user privacy. There is nothing you can do about that except pray to god that the big brother(Google) doesn’t take over

  • What privacy??

    “you grant Google a worldwide, non-exclusive, royalty-free license to reproduce, adapt, modify, publish and distribute such Content on Google services for the purpose of displaying, distributing and promoting Google services”

    Ya thats true for Picasa, Google groups and many such services, including google apps.

  • General privacy concern:

    Well, use MSN atleast you’ll die in peace I don’t think more needs to be said

There are many other threats out there to privacy. But bottom line is that in this age of data, stricter privacy laws are in demand, because as you can see from above not much can be done to protect your data(besides not using the service at all). Protection of IP needs to take front row, the more social we get , more problems will emerge. So you can either put your head in sand and hope that your data is not being used, or stand up straight and take action.