Created
February 17, 2012 02:52
-
-
Save bticino/1850118 to your computer and use it in GitHub Desktop.
oprofile on dm365 (arm926) with 2.6.32.17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WHY oprofile | |
| ============ | |
| http://performancewiki.com/oprofile.html | |
| "If you are performance-testing applications on Linux, then you would want to know oprofile. It is the equivalent of similar tools like tprof on AIX. | |
| oprofile isn't hard to use at all, and quite the opposite from what people think, it is easy to use, and it casues low overhead on your system. In most instances, you will only use two of the commands that oprofile provides: opcontrol and opreport. The opcontrol command configures oprofile and manages the kernel and userspace profiling components, while the opreport command generates reports. | |
| You can read the manuals to know more about the tool on its web site, but here are several usages that can get you start right away (after you installed it)." | |
| UBUNTU 10.04 TEST | |
| ================= | |
| OPROFILE: http://doc.opensuse.org/products/draft/SLES/SLES-tuning_sd_draft/cha.tuning.oprofile.html | |
| STEP1: http://lovebug356.blogspot.com/2008/06/oprofile-setup-on-ubuntu.html | |
| INSTEAD: of http://www.centos.org/docs/5/html/ \ | |
| Deployment_Guide-en-US/s1-oprofile-gui.html , \ | |
| I prefer the opcontrol command line. | |
| CALLGRAPH:(it is not a graphic...): http://oprofile.sourceforge.net/doc/opreport.html | |
| KERNEL: http://www.centos.org/docs/5/html/Deployment_Guide-en-US/pt-kernel-configuration.html | |
| IMPORTANT: http://oprofile.sourceforge.net/doc/interpreting-callgraph.html | |
| STEP2. THE GUI for control | |
| apt-get install oprofile-gui | |
| oprof_start | |
| I don't like, not clear | |
| STEP2.1: THE GUI for report | |
| http://ozlabs.org/~jk/projects/hiprofile/ | |
| Fantastic | |
| hiprofile -o profile-output | |
| firefox profile-output | |
| But before collect the data ... | |
| STEP3. More ideas | |
| http://oprofile.sourceforge.net/examples/ | |
| http://blogs.gnome.org/bbiggs/2005/10/12/using-oprofile/ | |
| STEP4. My script | |
| oprofile_automatic | |
| ===================== | |
| #!/bin/bash | |
| set -x | |
| KERNEL=...path... | |
| DATE=`date +"%F-%H:%M:%S"` | |
| cat <<EOF > string_example.c | |
| #include <string.h> | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #define SIZE 500000 | |
| static int compare(const void *s1, const void *s2) | |
| { | |
| return strcmp(s1, s2); | |
| } | |
| static void repeat(void) | |
| { | |
| int i; | |
| char *strings[SIZE]; | |
| char str[] = "abcdefghijklmnopqrstuvwxyz"; | |
| for (i = 0; i < SIZE; ++i) { | |
| strings[i] = strdup(str); | |
| strfry(strings[i]); | |
| } | |
| qsort(strings, SIZE, sizeof(char *), compare); | |
| } | |
| int main() | |
| { | |
| int i; | |
| for (i = 0; i < 5; i++) { | |
| repeat(); | |
| sleep(1); | |
| } | |
| } | |
| EOF | |
| # If you want to use opannotate uncomment ggdb | |
| CFLAGS="-Wall " | |
| CFLAGS+="-ggdb " | |
| CFLAGS=$CFLAGS make string_example | |
| opcontrol --vmlinux=$KERNEL/vmlinux # with debug symbols | |
| opcontrol --deinit | |
| opcontrol --init | |
| opcontrol --start | |
| ./string_example | |
| opcontrol --dump | |
| opcontrol --stop | |
| opcontrol --shutdown | |
| opreport -p $KERNEL > oprofile_report_$DATE.log | |
| # This is clear | |
| opreport -p $KERNEL -% > oprofile_report_percentual_$DATE.log | |
| opreport -p $KERNEL --callgraph=1 > oprofile_report_$DATE.log | |
| opreport -p $KERNEL --callgraph=2 > oprofile_report_c2_$DATE.log | |
| opreport -p $KERNEL -d > oprofile_report_d_$DATE.log | |
| opreport -p $KERNEL -a > oprofile_report_a_$DATE.log | |
| opreport -p $KERNEL -l -a > oprofile_report_la_$DATE.log | |
| opreport -p $KERNEL -l > oprofile_report_la_$DATE.log | |
| opreport -p $KERNEL -f -l -a > oprofile_report_fla_$DATE.log | |
| STEP5: opannotate | |
| ============== | |
| You need to recompile with -ggdb, so it is intrusive on | |
| your release setup. | |
| CFLAGS="-Wall -ggdb" make oprofile_example | |
| http://maemo.org/development/documentation/man_pages/oprofile/#5 | |
| STEP6: ARMEL on DM365 | |
| =================== | |
| oprofile-gui 0.9.6-1ubuntu4.4 (armel binary) in ubuntu lucid | |
| TODO | |
| STEP7: ARAGO on DM365 | |
| =================== | |
| TODO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment