Home
Name Modified Size InfoDownloads / Week
instrument 2014-05-07
analysis 2014-05-07
README 2014-05-07 2.4 kB
Totals: 3 Items   2.4 kB 0
This program is used to generate function (subroutine call) dynamic power profile. 

There are general several things to notice in order to use the library.

1. The program relis on GCC compilier and -finstrument-function option. 

2. The version of your Linux kernel must be higher than 2.6.31 to  the system callses the system call "__NR_perf_counter_open"(in the latest version, the name is "__NR_perf_event_open") to stat the hardware events, such as L2 cache miss.

3. BerkeleyDB is requried to be installed. We use it to store the collected function information. Beaware of the "include" when compiling the library. Currently, the default value is "/usr/local/BerkeleyDB.5.2/include/". 

4. instrument directory contains source code to build the library. analysis directory generate the power profiling.

5. Power model is stored in power.c in analysis directory. The model is based on a CPU MEM subsystem. Care must be taken in order to use it to generate accurate power model. You can also change the power model based on the collected information and the setting of your machine.


EXAMPLE: your source file main.c. The default compiler is GCC.

1. go to directory instrument/Debug/. 
   type "make". 
   it will generate libsafari.a

2. go to directory analysis/Debug/. 
   type "make". 
   it will generate executable analysis

3. compile your source code as normal but one more option: 
   gcc main.c -c -finstrument-functions

4. Link main.o with libsafari.a 
   gcc main.o libsafari.a /usr/local/BerkeleyDB.5.2/lib/libdb-5.2.so

5. run a.out

6. after exit, you will have generated a my_db.db which stores all the function info. 

7. put my_db.db in the same directory of analysis. 
   run analysis

The output is as follows: 
Estimated power may not be accurate if function execution time is less than 100 millisec 
Address 8049e4c, ID 10911, avg exec time  2665 ms, cpu   166 mW, memory   110 mW
Address 804abd1, ID 10910, avg exec time     1 ms, cpu     0 mW, memory    77 mW
Address 804b15b, ID 10910, avg exec time  2645 ms, cpu   162 mW, memory   106 mW
Address 804b0dd, ID 10910, avg exec time     3 ms, cpu  1023 mW, memory    82 mW
Address 8049e9e, ID 10911, avg exec time   239 ms, cpu   269 mW, memory   108 mW
....

The address is the function address from symbol table. Then it gives the execution time of the function and estimated cpu and memory power.


	 
Source: README, updated 2014-05-07