Case of the mysterious slow down

About 1 month ago my Alienware suddenly slowed down. Like really really bad slow down. To the point where Firefox would take ages to open the google.com landing page.

Now I had attributed this to Firefox itself being slow as was reported elsewhere but something did not feel right. Switching windows (Alt+Tab) to a regular terminal would also be terribly slow. Like ~5secs to just switch. This certainly cannot be just be Firefox tossing it up, can it?

1. Rule things in and rule things out
So I decided to dig. First off “top” indicated ~100% CPU consumption. So something’s consuming all of the 4 cores. It was always Firefox. I tried different websites, including Youtube, WordPress, Reddit. It produced similar results. So I decided to try Chrome and it was darn near similar. Then tried other applications. I deliberate avoided Libreoffice as it might genuinely be a slow application. VLC tends to be low on CPU but reasonably high on GPU consumption. Even VLC had a similar behaviour. What this told me was that the whole system was running dog slow.

2. So is it a CPU problem or something else?
To test this theory I checked if it was just the CPU or if the GPU was also behaving similarly. A quick OpenGL program with a dull CPU usage but high fragment shader usage ruled the GPU out. The CPU was still pegging although not all the cores. So then I checked the disk I/O and it was fairly inexistent. No issue with RAM consumption as it was always <50%.

3. So is it malicious?
Around the same time I was reading about compromised systems. This bothered me as it could mean something really really nasty. I know, I made a leap based on nothing but it was worth ruling out. Thankfully Linux Mint makes this rather simple. My /home is on a separate partition so all it meant was wiping out the /, reinstalling the OS, creating a dummy account, and retesting. Took about 20 mins to do all of this. Nope still slow. So either this was really really deep or I need to stop heading down this path. I decided to stop.

4. Is it hardware?
Power settings could lead to this kind of a behaviour. So would heat protection if it decided to kick in. I checked the cpu governer and forced set it to “performance” mode. Along side I opened up the laptop and cleaned up all the dust because the CPU temperature was hovering at 65C. Not too hot yet, but might as well bring it down. This definitely helped and brought it down to 45C on peak 100% count. I was prepared to open the CPU heat sink up and apply a dab of thermal grease but decided against it as it is better to first verify if the heating issue was from constricted airflow or if it was from thermal flow resistance. Anyway not opening up the heatsink was the right call.

5. Is it still the hardware?
Now that i ruled almost everything else out, I wanted to pay closer attention to the CPU itself. Since neither Firefox nor Chrome are applications that would have serious performance bugs, I wondered if there was something else going on. This is when I started paying closer attention to the cpufreq toolchain.

I paid close attention to the output.
$ cpufreq-info

analyzing CPU 3:
driver: intel_pstate
CPUs which run at the same hardware frequency: 3
CPUs which need to have their frequency coordinated by software: 3
maximum transition latency: 0.97 ms.
hardware limits: 800 MHz – 2.90 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 800 MHz and 2.90 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency is 870 MHz.

AT the same time I noticed that the CPU was pegged at 100%.

Here comes the AHA! moment. While the OS correctly recognised the CPU frequency range, it was reporting the current CPU frequency to be 870MHz. Way below what it should be set to given the 100% consumption. That got me thinking. What could this mean? I tried to force set the frequency to 2.90 GHz but it would ignore this. This was the second AHA! moment. So the OS doesn’t seem to have the ability to set the frequency. Now who could do that? The CPU itself, the power settings, the thermal settings or something else? I’ve ruled the CPU being a problem, the power settings, and the thermal settings purely by coincidence during the earlier steps. So what could it be? Maybe something lower than the OS – the BIOS.

6. It is the hardware, but not the way I thought.
So I went into the BIOS, checked he Intel Speed Step and disabled it. Restarted. No change. I then decided to just follow IT Crowd philosophy. I reset to defaults.

7. Eureka!
… AND I got a warning when I started the laptop. What I saw was this message: http://www.dell.com/support/article/us/en/19/SLN148385
But I was using the Alienware adapter. What the hell is it on about? None of the resolutions listed on the page made any sense. No wait.
“The AC adapter is not fully connected to the system.” Huh? Are you essentially saying a loose contact? Wait what?
So I started twisting the cable and restarting to see if it made any difference. And it did! If I held the wire straight out I didn’t see the warning message. So inspired by MacGyver I came up with a way to hold it in place. Also reminded me of the TV antenna vaastu orientation.

You can see how it looks now at the end of the post.

8. And we have a winner!
With the binder clips holding the cable and no warnings in my face, I restarted the system. It worked. It damn worked. Everything was back to the speeds to which I was accustomed. Now granted this whole binder clip setup is a hack. The true problem, quite possibly, is that I have a loose solder joint somewhere.

In Summary.
1. MacGyverism is a way of life
2. Thermal characteristics hurt performance. Spring cleaning is valuable
3. Never ignore warnings. Hardware or Compiler doesn’t matter
4. Not all Eureka moments involve water, a bath tub, and a naked guy running out into the streets

 

MacGyver

Advertisements

Google Galaxy Nexus and Exchange server connectivity woes

I faced my first time wasting task today – connecting the newly acquired Galaxy Nexus from Google to my company’s Exchange server. I will be quite candid – Jelly Bean has a lot of issues with stuff strewn all over the place.

I am not entirely sure which one of the following actually got the exchange server connection working but I am pretty close to sure it was the workflow I was using.

Symptoms: I set up the email account by adding a new account, then setup the exchange server details, it connects to the server (I checked using the outlook web app) successfully and then hangs at “Waiting for sync”. The one thing I noticed was that the application would tell about “Enforced security” but I would never get a pop-up that sets the security.

Typical steps: Delete account, got to Settings->Apps->Email and then clear data/clear cache after every thing I tried, I would execute the above steps.

Please note that my company’s exchange information had a different format for username and a different form for the exchange server url.

A list of the factors:

– PIN setup before hand: I had a pattern unlock for security setup before I started setting up the email. When it did not work I changed the pattern to PIN lock and tried again. Then I changed it to “None” so I did not have any security measures. None of these helped.

– Manual setup: When I was adding the account my company’s auth scheme and exchange server were different from the defaults being populated in the Email app. So when I entered the email id + passwd and pressed next it would always fail with authentication. After this, I started entering these details and pressing “Manual setup” directly. This is the step that might have had the highest probability in contributing to the success because I did not do this for a long time while fiddling with other parameters. In the step that brought be SUCCESS! I did not hit manual setup. Instead I hit next, let the app auth fail then proceeded to enter the details again.

– Auto sync: Settings -> Data usage -> Mobile data was on. I turned it off (I do not have a data plan as yet)

Mobile data.Settings -> Auto-sync data off is the current setting. I did turn this setting on and off a few times.

 

Solved:

This seems to happen whenever I disable auto-sync feature. Mind you it doesn’t always happen but it goes away if I enable the auto sync and then sync. Then if I disable auto sync things work fine.

Why the Wii U doesn’t give me a hardon

Nintendo released a new console @ E3 named the Wii U. I looked @ the online video which was more about people acting up in a white room than games that looked fun. Iwata apparently said that they should have done a better job at presenting the console than they did. I think that they should have come up with a better idea. Here are my issues with the new console.

It definitely is backwards compatible with the Wii. Nintendo took a beating with the N64 (PS) and the Gamecube (PS2) because they were only evolving and not revolutionising gaming. Wii, NDS and the GBA changed the way things actually worked in video games. The Wii U is again an iteration. I never felt bad about low powered hardware on the Wii because the beauty of the console is the controller and WHAT we can DO with it. Sure it had quirks but who gives a damn? Wii U games will definitely have great sales but it doesn’t leave a mark on gaming yet because it is just an iteration.

Compare that to the Kinect. It just took all the controls from the Wii and said – hey no controls anymore. Well that’s a revolution. Computer Vision has been a subject for academics for a very long time but shoving it into a console changed the face of the 360. I was expecting something bigger than Nintendo and no I do not have any ideas when it comes to this subject. If I had, I’ll not write about it on my blog. I’ll build a company around it.

Spiced up hardware will not get Nintendo anywhere. Who gives a damn about more white boxes in the living room? It is important to note that the difference will be what is it that you can do with this device that you could not do earlier? Wii controller just gave positional feedback. You could not get that from traditional controllers. Kinect gives a full skeleton recognition that no one could do earlier. While a good idea is important, getting good results, consistently is even more important for any hardware.

Bad news for RIM

http://www.intomobile.com/2010/11/19/iphone-satisfaction-survey-motorola-rim-blackberry/

This is definitely bad news for RIM and it is bad news for me since I’ve been betting on Blackberry making inroads into the smarphone market. Losing market share to iPhone is one thing but coming in the 5th place in a customer satisfaction survey is horrible. Even worse is the fact that Samsung beat RIM.

I’ve been thinking about it and I’ve noticed that most of the talks from Blackberry tend to take aim at iPhone. That’s a sad situation to be because all that does is set the upper bar to “iPhone”. Actually you are fighting a battle on iPhone’s terms and there is no way you can win because Apple’s CEO happens to be a dude with a reality distortion bubble around him. Do you have anyone like that huh huh? Instead rely on good technology and customer experience. It doesn’t mean that you stick more beef into the cellphone. Give developers a good hand and trust me you will have so many good apps that you will have to worry about cluttered “desk space”. Hey, that’s a nice problem to have 😉

Playbook Air Application cockups

Well hello world. That’s all I was trying for a moment. It ended up being quite a long process. I got interested in the Blackberry Playbook apps around 2 weeks ago and since then I’ve had one headache after the other. Fear not since my definition of an expert is someone who’s committed all the possible mistakes in a field.

I am not an expert yet since I’ve taken only one path along and there is a long road to travel. However, I will continuously post my experiences just to ensure that others, who can STFW, will not have to go through the same pain as I did and thus can save 2 weeks atleast. So here goes…

My background:

I’ve not done much flash development (none on AS3 whatsoever) since I come from the world of console video games. 8 years on it with C/C++ and a host of other languages does things to you when it comes to a new hardware. So I got all interested in this playbook thingy. I decided that I wanted to develop something cool on the playbook. That was where the first hurdle came in. Playbook, atleast for now, only supports AIR apps. Although the good news is that these apps will be rendered using OpenGL ES, it was a bummer for me. Being a fan of Blackberries I said, fine, it is just another language and let me go ahead with it. Before I even got to understanding the language, I needed to write “Hello World”. This was the second bummber and one that took far too much time. The Blackberry website lists very little information on the non Adobe Flash Builder 4 packages. I do not have the money to purchase Adobe FB so I was looking for alternatives. Lo behold the flex SDK and the AIR SDK are open sourced and available for free. This implied that I did not have to purchase Adobe FB  (not Facebook you git). I talked to a bunch of other seasoned flash dudes from the company I work for (Sierra Atlantic). One of them is Sudhir and he helped me out in figuring out how to do this. He has been using Flash Develop + Flex + Air for a while now but never touched the Playbook SDK. I hope the following will help the next developer churn out a cool app.

To start off, let’s keep things simple.

1) Download Flash Develop (http://www.flashdevelop.org/community/viewforum.php?f=11) and while you are at it donate something to this awesome project.

2) Install Flash Develop and let it also download and install Flex for you. That will keep some of the other configurations easy.

3) Download the AIR 2.5 SDK from http://www.adobe.com/products/air/sdk/ Extract it to a location and keep track of this location

4) Extract AIR SDK to a location and take note of it

5) Download and install VMware http://downloads.vmware.com/d/info/desktop_downloads/vmware_player/3_0

6) Download and install the Playbook simulator by following http://docs.blackberry.com/en/developers/deliverables/21877/Configure_the_BlackBerry_PlayBook_simulator_1347134_11.jsp

Note that this works only for 32 bit OSes. For 64 bit OS install by following this link: http://blog.swfjunkie.com/2010/10/getting-started-blackberry-playbook-development-setup/

Ignore anything that refers to Flash Builder. Essentiall you are just extracting the ISO image and installing it using VMWare.

7) Download and install the Playbook SDK by following http://docs.blackberry.com/en/developers/deliverables/21877/Installing_the_SDK_1347128_11.jsp#Install_the_BlackBerry_Tablet_SDK_1347129_11

Again, this won’t work for 64 bit OSes. So I followed this link: http://shanky.org/2010/11/03/first-steps-with-blackberry-playbook-air-sdk/

Okaaaaaaaay, now all of the above links will help you install and get ready for development. However, when it comes to using FlashDevelop with the Playbook SDK, it is extremely hard to find decent links. So this is where my friend Sudhir helped me out.

Using this link I got started. http://www.studiochris.us/2010/flashdevelop-and-blackberry-playbook-development-the-basics/

However the 3rd bummer was just a few feet away since the application would compile and run fine in swf format and in air format. It did not like me whenever I wanted to deploy it to the playbook emulator. Whenever I used the command line tool it would spike on me with “Invalid value ” for Package-Author” stupid error message. At first I thought that I had to enter the author field somewhere but there was no such facility and that got me to think like a regular programmer. What if the Playbook parser was wrong and it was spewing out gunk? It turns out, I might have been correct since the error had nothing to do with the author field.  It had everything to do with the project xml file. In my case it was called “application.xml” and there were two fields missing in it “description” and “copyright”. So I went in, filled those two fields up in the xml file. Then with fingers crossed, I executed the command line statement… and voila I could see my app installed on the playbook vmware image. Brilliant.

Now all I need to do is write a cool programme. Before leaving, I’d request the Playbook support team to fix some of the glaring issues in the SDK. First the lack of support for 64 bit OSes. Second have better support for Linux. Third show me the Playbook appstore already!! Fourth damn it man, all I keep saying nowadays is “Playboy” or “Blackbook”. I’d appreciate a better naming convention ;). Fifth and the most important thing – better tutorials. I will post tutorials on my website regularly but I was hoping to find some right on the Playbook developer website. Sixth and probably hard to come by – how about native C++ support? You are missing out on all those uber cool OpenGL developers because they have to now use AS3.

Optimisations on 5800

I updated my Nokia 5800 Xpress Music and lo behold the whole thing is slow as a snail now. What’s worse? Their own DRMed (Digital Restrictions Management) concked off and won’t allow me to play the songs preloaded in the phone.  That did not bother me anyway because they had a terrible set of songs in the first place.

So I am asking Nokia – give me a job for optimising your operating systems (Series 60 Rel 5). I’ve done that on my game earlier and can do it again. On the other hand if things don’t get better Nokia will lose a loyal customer. Watch out for HTC is in town now.