Using the Application Energy Toolkit on a MID

Submit New Article

Last Modified On :   November 18, 2008 4:00 PM PST
Rate
 



Using the Application Energy Toolkit on a MID

By Dale Taylor                        last updated: 14Nov2008

Keywords: MID, Power, Linux, Midinux, RedFlag

The Application Energy Toolkit as available on ISN is a useful tool for measuring the power consumption of your application.  Adapting this tool for use on a MID takes some adjustments.  This documents what changes were necessary to build and use this tool on a MID running Midinux. 

Start by downloading the .tar.gz files from ISN.  You’ll want the Linux files which are distributed only in source form.  Here’s the link to the article which has the files:

            http://software.intel.com/en-us/articles/application-energy-toolkit

I extracted the files into my user folder as /projects.  The package comes with a file “qtacpi.pro” which is used to build the make files for your environment using qmake.  My clean Ubuntu system did not have QMake, to get it I ran the following:

sudo apt-get install libqt4-dev

This installs QMake and the necessary libraries to run it.  In the same folder as you extracted the toolkit files, type “qmake” to process qtacpi.pro and build the make files.

Now you have the files necessary to build the application, but on Ubuntu the g++ compiler is not installed by default.  To get it you need to run the following:

            Sudo apt-get install g++

This will install g++, but it turns out that the App Energy Toolkit uses the QWT package so you’ll need to install that and all of its necessary libraries too.  This part can take some time so I’ll step through what I did.

Using the Package Manager I found the “libqwt5-qt4” package and installed it, both the runtime and Dev components.  You must make sure and install the development components or you won’t be able to build and link.

I also had to install the “ncurse5” development files so that you can link using them too.

Once I reached this point I was able to completely build the Application Energy Toolkit.  The result was a binary executable named appenergy in my projects folder.  Build the project by typing:

            Make

The binary runs fine on my development desktop.  I copied the binary to a USB memory stick and on the MID, I used the Midinux GUI and made a folder called apps where I copied the binary.  On the MID, it failed to run.  No messages, nothing.  My guess was that some of the necessary libraries were missing so I went about figuring out what those are.  Typing the following command on the desktop shows all libraries that the loader wants when it loads up the binary.

            ldd appenergy

This produces a nice list of all dependencies.  I could then run the following command to see all packages installed on my desktop.

            dpkg –l | more

With the list in hand I was able to dig around on my desktop and find all of the necessary library files.  The application was built using older versions of some of the libraries I had, so the linker resolved this because the newer packages replaces the older libraries with links that point to the new files.  This works fine on the desktop, so I tried simulating this on the MID.  Now there’s a new problem.  On the MID, due to size reasons the full versions of all command functions are not actually installed, there’s an app called BusyBox that emulates most of them but as it turns out it doesn’t provide full functionality.  This BusyBox feature doesn’t appear to support links using “ln” so I couldn’t make the link files that point from older versions to newer ones.

Fortunately there’s a reasonable work around to this.  By renaming the newer libraries with the older names, the loader on the MID can find the requested files and load them up.

Here’s the names of the files you’ll need to get and what you need to rename them on the MID to get them to work.  These are the main binaries loaded by appenergy.  I renamed them and copied them to the same folder as the application.

            libQtSvg.so.4.3.4 rename as              libQtsvg.so.4

            libQtxml.so.4.3.4 rename as               libQtxml.so.4

            libaudio.so.2 (correctly named, no updates)

 

As it turns out these binaries have dependencies so you’ll need to also get the following 3 additional libraries:

 

            libQtcore.so.4.3.4 rename as             libQtcore.so.4

            libQtDBus.so.4.3.4 rename as            libQtDBus.so.4

            libqwy-qt4.so.5.0.2 rename as            libqwt-qt4.so.5

 

Ok, we’re almost there.  Now we have the application and in the same folder all of the binaries it needs to run.  On the MID with Midinux, the default folder is called MyDocs, which is where that portion of the full path comes from.  To make sure the loader can find the libraries, you run the application with the following command (note the space between the two paths):

 

            LD_LIBRARY_PATH=/home/root/MyDocs/apps  /home/root/MyDocs/apps/appenergy

 

It took a bit to get to this point, but once you do, you can now run the Application Energy Toolkit on a MID.

 

There are some UI issues that need to be worked on to make the energy kit more useful on the MID, those are works in process and when reasonable the changes will either be documented here or added directly to the downloaded files.