Last active
December 11, 2015 20:58
-
-
Save bugcy013/4658769 to your computer and use it in GitHub Desktop.
oProfile
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
| oProfile | |
| ======== | |
| oPrifile required to vmlinux it's not avaliable in ubuntu 12.04 | |
| you need to install some kerenel related packages | |
| If there is no -dbg package: | |
| Create an /etc/apt/sources.list.d/ddebs.list by running the following line at a terminal: | |
| echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | \ | |
| sudo tee -a /etc/apt/sources.list.d/ddebs.list | |
| Stable releases (not alphas and betas) require three more lines adding to the same file, which is done by the following terminal command: | |
| echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse | |
| deb http://ddebs.ubuntu.com $(lsb_release -cs)-security main restricted universe multiverse | |
| deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | \ | |
| sudo tee -a /etc/apt/sources.list.d/ddebs.list | |
| sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 428D7C01 | |
| Easiest way to obtain vmlinux under Ubuntu is to add ddebs repository and install kernel debug symbols: | |
| sudo apt-get install linux-image-$(uname -r)-dbgsym | |
| vmlinux then can be found here: | |
| file/usr/lib/debug/boot/vmlinux-$(uname -r) | |
| Download oprofile | |
| ================= | |
| http://prdownloads.sourceforge.net/oprofile/oprofile-0.9.8.tar.gz | |
| tar -xzvf oprofile-0.9.8.tar.gz | |
| cd oprofile-0.9.8 | |
| sudo apt-get install libpopt-dev binutils-dev | |
| ./configure && make && make install | |
| Moniter pertucular pid --callgraph | |
| ======================= | |
| operf --vmlinux=/usr/lib/debug/boot/vmlinux-3.2.0-33-generic --pid 18079 --callgraph | |
| --callgraph means create call graph | |
| -c categorizes samples by cpu | |
| -t seeing per-thread samples in multi-threaded applications. | |
| Getting Call graph with nice graph | |
| =================================== | |
| http://gprof2dot.jrfonseca.googlecode.com/git/gprof2dot.py | |
| apt-get install python graphviz | |
| opreport -cl --callgraph --image-path=/lib/modules/3.2.0-33-generic/ | ./gprof2dot.py -f oprofile | dot -Tpng -o output.png | |
| check call graph | |
| ================ | |
| root@dvcliftonhera150:~# opreport --symbols | |
| Using /root/oprofile_data/samples/ for samples directory. | |
| warning: /nfs could not be found. | |
| CPU: Intel Sandy Bridge microarchitecture, speed 2.001e+06 MHz (estimated) | |
| Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 90000 | |
| samples % image name symbol name | |
| 967 19.5868 vmlinux-3.2.0-33-generic __mem_cgroup_uncharge_common | |
| 813 16.4675 vmlinux-3.2.0-33-generic free_pcppages_bulk | |
| 745 15.0901 vmlinux-3.2.0-33-generic mem_cgroup_del_lru_list.part.37 | |
| 650 13.1659 vmlinux-3.2.0-33-generic zap_pte_range | |
| 392 7.9400 vmlinux-3.2.0-33-generic release_pages | |
| 267 5.4081 vmlinux-3.2.0-33-generic free_hot_cold_page | |
| 180 3.6459 vmlinux-3.2.0-33-generic page_remove_rmap | |
| 173 3.5042 vmlinux-3.2.0-33-generic get_pageblock_flags_group | |
| 134 2.7142 vmlinux-3.2.0-33-generic free_pages_and_swap_cache | |
| 102 2.0660 vmlinux-3.2.0-33-generic lookup_page_cgroup | |
| 62 1.2558 vmlinux-3.2.0-33-generic free_pages_prepare | |
| 53 1.0735 vmlinux-3.2.0-33-generic __tlb_remove_page | |
| 52 1.0533 vmlinux-3.2.0-33-generic __dec_zone_state | |
| 44 0.8912 vmlinux-3.2.0-33-generic mem_cgroup_uncharge_page | |
| 39 0.7900 vmlinux-3.2.0-33-generic __pagevec_free | |
| 37 0.7494 vmlinux-3.2.0-33-generic mem_cgroup_charge_statistics.isra.21 | |
| 31 0.6279 vmlinux-3.2.0-33-generic __ticket_spin_lock | |
| 30 0.6077 vmlinux-3.2.0-33-generic __mod_zone_page_state | |
| 27 0.5469 vmlinux-3.2.0-33-generic vm_normal_page | |
| 19 0.3848 vmlinux-3.2.0-33-generic __dec_zone_page_state | |
| 11 0.2228 vmlinux-3.2.0-33-generic _raw_spin_unlock_irqrestore | |
| 11 0.2228 vmlinux-3.2.0-33-generic zone_page_state_add | |
| 10 0.2026 vmlinux-3.2.0-33-generic PageHuge | |
| 9 0.1823 vmlinux-3.2.0-33-generic mem_cgroup_del_lru_list | |
| 6 0.1215 vmlinux-3.2.0-33-generic memcg_check_events | |
| 5 0.1013 vmlinux-3.2.0-33-generic _raw_spin_lock_irqsave | |
| 2 0.0405 vmlinux-3.2.0-33-generic __call_rcu | |
| 2 0.0405 vmlinux-3.2.0-33-generic __mem_cgroup_target_update.isra.13 | |
| 2 0.0405 vmlinux-3.2.0-33-generic __mem_cgroup_threshold | |
| 2 0.0405 vmlinux-3.2.0-33-generic __rmqueue | |
| 2 0.0405 vmlinux-3.2.0-33-generic __ticket_spin_unlock | |
| 2 0.0405 vmlinux-3.2.0-33-generic acct_collect | |
| 2 0.0405 vmlinux-3.2.0-33-generic cpuacct_charge | |
| 2 0.0405 vmlinux-3.2.0-33-generic dec_zone_page_state | |
| 2 0.0405 vmlinux-3.2.0-33-generic mem_cgroup_update_page_stat | |
| 2 0.0405 vmlinux-3.2.0-33-generic memcg_check_events.part.34 | |
| 2 0.0405 vmlinux-3.2.0-33-generic mutex_lock | |
| 2 0.0405 vmlinux-3.2.0-33-generic rcu_enter_nohz | |
| 2 0.0405 vmlinux-3.2.0-33-generic remove_vma | |
| 2 0.0405 vmlinux-3.2.0-33-generic tlb_flush_mmu | |
| 2 0.0405 vmlinux-3.2.0-33-generic unlink_anon_vmas | |
| 2 0.0405 vmlinux-3.2.0-33-generic unmap_vmas | |
| 1 0.0203 nfs /nfs | |
| 1 0.0203 vmlinux-3.2.0-33-generic __alloc_pages_nodemask | |
| 1 0.0203 vmlinux-3.2.0-33-generic __brelse | |
| 1 0.0203 vmlinux-3.2.0-33-generic __free_pages | |
| 1 0.0203 vmlinux-3.2.0-33-generic __get_free_pages | |
| 1 0.0203 vmlinux-3.2.0-33-generic __inc_zone_state | |
| 1 0.0203 vmlinux-3.2.0-33-generic __rb_erase_color | |
| 1 0.0203 vmlinux-3.2.0-33-generic __rcu_pending | |
| 1 0.0203 vmlinux-3.2.0-33-generic __sk_dst_check | |
| 1 0.0203 vmlinux-3.2.0-33-generic __slab_free | |
| 1 0.0203 vmlinux-3.2.0-33-generic _atomic_dec_and_lock | |
| 1 0.0203 vmlinux-3.2.0-33-generic account_system_time | |
| 1 0.0203 vmlinux-3.2.0-33-generic alloc_pages_current | |
| 1 0.0203 vmlinux-3.2.0-33-generic calc_delta_mine | |
| 1 0.0203 vmlinux-3.2.0-33-generic call_rcu_sched | |
| 1 0.0203 vmlinux-3.2.0-33-generic check_cpu_stall.isra.36 | |
| 1 0.0203 vmlinux-3.2.0-33-generic clockevents_program_event | |
| 1 0.0203 vmlinux-3.2.0-33-generic dnotify_flush | |
| 1 0.0203 vmlinux-3.2.0-33-generic exit_idle | |
| 1 0.0203 vmlinux-3.2.0-33-generic ext4_da_page_release_reservation | |
| 1 0.0203 vmlinux-3.2.0-33-generic fput | |
| 1 0.0203 vmlinux-3.2.0-33-generic hrtimer_interrupt | |
| 1 0.0203 vmlinux-3.2.0-33-generic inode_wb_list_del | |
| 1 0.0203 vmlinux-3.2.0-33-generic mem_cgroup_uncharge_end | |
| 1 0.0203 vmlinux-3.2.0-33-generic module_put | |
| 1 0.0203 vmlinux-3.2.0-33-generic mutex_unlock | |
| 1 0.0203 vmlinux-3.2.0-33-generic native_write_msr_safe | |
| 1 0.0203 vmlinux-3.2.0-33-generic next_zones_zonelist | |
| 1 0.0203 vmlinux-3.2.0-33-generic prep_new_page | |
| 1 0.0203 vmlinux-3.2.0-33-generic tcp_twsk_destructor | |
| 1 0.0203 vmlinux-3.2.0-33-generic tick_sched_timer | |
| 1 0.0203 vmlinux-3.2.0-33-generic tlb_finish_mmu | |
| 1 0.0203 vmlinux-3.2.0-33-generic udp_lib_unhash | |
| 1 0.0203 vmlinux-3.2.0-33-generic unlink_file_vma | |
| 1 0.0203 vmlinux-3.2.0-33-generic update_curr | |
| 1 0.0203 vmlinux-3.2.0-33-generic zone_watermark_ok | |
| root@dvcliftonhera150:~# | |
| root@dvcliftonhera150:~# opcontrol --no-vmlinux | |
| root@dvcliftonhera150:~# opcontrol --deinit | |
| Unloading oprofile module | |
| root@dvcliftonhera150:~# echo 0 > /proc/sys/kernel/nmi_watchdog | |
| root@dvcliftonhera150:~# | |
| root@dvcliftonhera150:~# opcontrol --start --callgraph=16 | |
| opcontol --image=all | |
| <dhanasekaran> root@dvcliftonhera150:~# opcontrol --status | |
| <dhanasekaran> Daemon paused: pid 28006 | |
| <dhanasekaran> Session-dir: /var/lib/oprofile | |
| <dhanasekaran> Separate options: library kernel | |
| <dhanasekaran> vmlinux file: none | |
| <dhanasekaran> Image filter: /app_packages/jdk1.6.0_30/bin/java | |
| <dhanasekaran> Call-graph depth: 16 | |
| <dhanasekaran> root@dvcliftonhera150:~# opcontrol --status | |
| <dhanasekaran> Daemon paused: pid 28006 | |
| <dhanasekaran> Session-dir: /var/lib/oprofile | |
| <dhanasekaran> Separate options: library kernel | |
| <dhanasekaran> vmlinux file: none | |
| <dhanasekaran> Image filter: /app_packages/jdk1.6.0_30/bin/java | |
| <maynard> he profiling daemon is currently active, so changes to the configuration | |
| <maynard> will be used the next time you restart oprofile after a --shutdown or --deinit. | |
| <maynard> dhanasekaran, Let's start from the beginning. Do the following commands: | |
| <maynard> opcontrol --deinit | |
| <maynard> opcontrol --reset | |
| <maynard> opcontrol --start | |
| <maynard> then run your hadoop or whatever you want to profile | |
| <maynard> then opcontrol --deinit | |
| <maynard> then 'opreport --long-filenames' to show summary of executables that were profiled | |
| <maynard> then, from the summary output, pick the executable pathname of interest and do: | |
| <maynard> opreport --callgraph <exe_pathname> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment